From 3444e810a6262fd0ece80ca1c82789c8962137c8 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 13:27:05 -0700 Subject: [PATCH 01/20] even smaller bignum modexp test, and fixes --- evm/src/cpu/kernel/interpreter.rs | 16 +- evm/src/cpu/kernel/tests/bignum/mod.rs | 22 +- .../tests/bignum/test_data/modexp_outputs | 1099 ----------------- 3 files changed, 24 insertions(+), 1113 deletions(-) diff --git a/evm/src/cpu/kernel/interpreter.rs b/evm/src/cpu/kernel/interpreter.rs index 4f47c91f..a6fe2184 100644 --- a/evm/src/cpu/kernel/interpreter.rs +++ b/evm/src/cpu/kernel/interpreter.rs @@ -400,14 +400,14 @@ impl<'a> Interpreter<'a> { _ => bail!("Unrecognized opcode {}.", opcode), }; - if self - .debug_offsets - .contains(&self.generation_state.registers.program_counter) - { - println!("At {}, stack={:?}", self.offset_name(), self.stack()); - } else if let Some(label) = self.offset_label() { - println!("At {label}"); - } + // if self + // .debug_offsets + // .contains(&self.generation_state.registers.program_counter) + // { + // println!("At {}, stack={:?}", self.offset_name(), self.stack()); + // } else if let Some(label) = self.offset_label() { + // println!("At {label}"); + // } Ok(()) } diff --git a/evm/src/cpu/kernel/tests/bignum/mod.rs b/evm/src/cpu/kernel/tests/bignum/mod.rs index aa9d1aa0..08b9774c 100644 --- a/evm/src/cpu/kernel/tests/bignum/mod.rs +++ b/evm/src/cpu/kernel/tests/bignum/mod.rs @@ -29,6 +29,7 @@ const TEST_DATA_ADDMUL_OUTPUTS: &str = "addmul_outputs"; const TEST_DATA_MUL_OUTPUTS: &str = "mul_outputs"; const TEST_DATA_MODMUL_OUTPUTS: &str = "modmul_outputs"; const TEST_DATA_MODEXP_OUTPUTS: &str = "modexp_outputs"; +const TEST_DATA_MODEXP_OUTPUTS_FULL: &str = "modexp_outputs_full"; const BIT_SIZES_TO_TEST: [usize; 15] = [ 0, 1, 2, 127, 128, 129, 255, 256, 257, 512, 1000, 1023, 1024, 1025, 31415, @@ -509,7 +510,9 @@ fn test_modexp_bignum_all() -> Result<()> { let exp_bit_sizes = vec![2, 9, 11, 16]; for bit_size in &BIT_SIZES_TO_TEST[3..7] { + dbg!(bit_size); for exp_bit_size in &exp_bit_sizes { + dbg!(exp_bit_size); let b = gen_bignum(*bit_size); let e = gen_bignum(*exp_bit_size); let m = gen_bignum(*bit_size); @@ -533,9 +536,13 @@ fn test_modexp_bignum_all() -> Result<()> { let mut modexp_outputs_iter = modexp_outputs.into_iter(); for b in &inputs[..9] { // Include only smaller exponents, to keep tests from becoming too slow. - for e in &inputs[..7] { - // For m, skip the first input, which is zero. - for m in &inputs[1..] { + for e in &inputs[..6] { + if b.is_zero() && e.is_zero() { + continue; + } + // For m, skip 0 and 1. + for m in &inputs[2..9] { + dbg!(b, e, m); let output = modexp_outputs_iter.next().unwrap(); test_modexp_bignum(b.clone(), e.clone(), m.clone(), output)?; } @@ -572,13 +579,16 @@ fn test_modexp_bignum_all_full() -> Result<()> { } let inputs = test_data_biguint(TEST_DATA_BIGNUM_INPUTS); - let modexp_outputs = test_data_biguint(TEST_DATA_MODEXP_OUTPUTS); + let modexp_outputs = test_data_biguint(TEST_DATA_MODEXP_OUTPUTS_FULL); let mut modexp_outputs_iter = modexp_outputs.into_iter(); for b in &inputs { // Include only smaller exponents, to keep tests from becoming too slow. for e in &inputs[..7] { - // For m, skip the first input, which is zero. - for m in &inputs[1..] { + if b.is_zero() && e.is_zero() { + continue; + } + // For m, skip 0 and 1. + for m in &inputs[2..] { let output = modexp_outputs_iter.next().unwrap(); test_modexp_bignum(b.clone(), e.clone(), m.clone(), output)?; } diff --git a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs index 543f2456..071cb222 100644 --- a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs +++ b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs @@ -1,66 +1,3 @@ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 0 0 0 @@ -110,7 +47,6 @@ 1 1 1 -0 1 1 1 @@ -124,22 +60,6 @@ 1 1 1 -0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -1 1 1 1 @@ -152,22 +72,6 @@ 1 1 1 -0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -1 1 1 1 @@ -178,37 +82,6 @@ 1 1 1 -1 -1 -0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 0 21 21 @@ -216,13 +89,6 @@ 21 21 21 -21 -21 -21 -21 -21 -21 -0 0 309 5842587018385982521381124421 @@ -230,13 +96,6 @@ 5842587018385982521381124421 5842587018385982521381124421 5842587018385982521381124421 -5842587018385982521381124421 -5842587018385982521381124421 -5842587018385982521381124421 -5842587018385982521381124421 -5842587018385982521381124421 -5842587018385982521381124421 -0 0 169 1232997389102826268860991065105 @@ -244,13 +103,6 @@ 56424335153278151789523409664996995581162067431087086213061556134977632914449 28522822713801268588036943398667804191745915805046109428618723188679866502161 31706899640538131462557950751123123992423743151283050819612655945089903928361 -1626949887851522216050918195251855667936019233629512014857416262882459162506846482867598420124655122796334698879679058256496280388512107842122550266897 -3456644180256483296524124683106942480722843461305992677766332070622386105650335816178720659995652203171430416751945868032819203139048842456194585731900908 -6658621772694490037410881754126282754619191463278934006643576166056374826395321115677201742806056121601730868428249390651828408651815409287407418905560894 -2188719266686453452930405899199235044753192686954839466176162624683199938127424638750308949204554559166758220326224401920489333667474175603924673521175569 -6123795749220870070888957688126499811687439102580957107200324670516588221814874336490966980509479995815372272026912905873172415251713982723428918913460049360806724424126068570078686852874442462644585471618684175096178614463856372447395923736155404199722474001519774161213336837801565210105511353961489 -21733503076822274238215696841643994124465086209245797663103653662160183433375325239843496825811576935617701675430794656070743382504699894663869396198800858049123949931636855462200807567378261808374350727356914491895652225869425999023896449493174464626623879583913773127532285149008185808669981457659175411110681467646497612200879789944122607924142423967190374513947785974855081897919456043288039161362376188824242511311222201467365944959686354630547972 -0 0 501 163832143645086957897416441857 @@ -258,13 +110,6 @@ 1950081577919450936472563652220396332042682835950151822696779432336405037057 89705076639198166424843052158202309145112564081865083245095301525986942648321 161580799869287829122678259656507339171378764462605635944908315838074450225541 -119111099232869461943255917709559971029471489246820147748389884283220680875449970114508127905572794881898139347855563980545398801715283004632963481601 -2340550614088062323035521333507933205420749928049240408457893198554975629380160875595843975025528241912895931129450956293623201875314056184463318790281141 -9658263392514739927662836103088426769134800307082054844647958520598804818351406352355729785509682250873421347556031006118797390529574721358615425274369903 -4647428455414528310735419222346137778331384012634538551014412602117023622880652353771726881116679285768237724443091476402706202263926819772616832419102721 -4105943439683327149496995432917731734349623330617416765444758819531334403459555965005600275959433826680513222328275949889828341311187920607090355380046540579908947040106371789193081113409035077098486792404385747715667974409598976733840748313362165044117491316370103556122704636978835764926194391187457 -28645769207390246795138025157012310806200949947458739337397211179141156343070918052774971042600619689369921890873698767518883214265612034430865062720501567943382208222029969252942575712244757709457154177152894494535042763023966349374143513752560929258976200745379909865727692592552226677876935892285307870731885285227994511501363645824725317338462104668462291125838004650196777287385052153407326433125418796527586257544647700218132360787318720777100831 -0 0 361 349605011617414033395053481789 @@ -272,26 +117,6 @@ 16196520401421423385786338368215415982698439852342927927980513551465948892989 25448670785549471741073803593965176921136178751681542787519830340854942519101 208746275861806526568796522022506082930013066308764940459575687169043802837726 -1405046333573254154362728566205440659065789596162373947677922992002779706150301916091557545001891022758808422492046510466274149060187173986171371114301 -4109950494713993893142341968876859588899697995149574488387185284937507905151071268229544837244462536429462991654059099118254521939414590134998340719446475 -844468128021093833521017258842640197099986073495355910940365822372902152436005754957689228609364360833723273104884193579513808541852965164830299937335266 -4841490524461293458775865719630252706317774131797304941603107709106391551373400827563106022147424343461775948749633172375219539070706909069136692738510653 -7273173343143062730116325603650929579289657910222550340667872300408581237430197382410051906687144077202863842569199267502562443871512075909613158282763060439777587356925584672588460920490499485650537891223823337073005846524449165906099576249848470870580763810627114753982636643198831102678792829914941 -28046651509673296558629424584063249731669578718145238261130675472681779110268140721442904856558473621167727640615713345067811595168883183810857635560068796253449136272338112002671317203041266904678503071806393932350113469015095445921306266450082664767442783548486830460889239098543969021176454257806145698621983814164824010062639366791567674987083305882183188142795298379711201433370817683665471805353684719806585009665707704695044458674998071553291930 -0 -0 -625 -268138222663085878899055263745 -24352877979184920020466043837322220276 -34834821705580047870320807590104282154881192418891909778995311440625022271489 -107743694625338367548278288079708411290661245510293131426406157730911501680641 -118236082284243482508848267847953427609046466568857110070954823921881387042791 -314573941438267599881423465112523804707482828315168316649965301003974020258305280672271797781262619454377248842022918324247905069090181693176119558145 -1855138457669725370795603609175257635850787505475418783821961151316324964106211402480574231460442281436102848418947738954752184731638654925034081955953702 -540244355168038810439245856412365092477075663815074675095751794574495975677637107674742162091364766891790053303512224504116561928038681836474597949011431 -22981118609480295020302390537085998300920429526471726567398293023445956296114258286587907654003543675558782486527003079440548040281611791112262372611325953 -6951084942072485004602792642768728173731086340286788608361716458550264564967198485402397629024961093884371645054422216571333979237852755889053521204926773487912585360977600077358240969038752377614031729154197921202596341838056184283438478913472604440906205314054471964590715571751484579200485577195521 -33110177016061425855873050546700017053104395816945007989361323145125706671247445069352845357430211170094709814842881235921295997550815440918489134011703431383697905373158706778267396782608658244538288231998579363509402374934461434235027334113339168112113235815389810790459912467851237692233387577938141749136860402850772218835907235676691685574301095898691939348359786379380091090548413315980192736618829302554133559996331787700989395178469522588716520 1 1 1 @@ -299,14 +124,6 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -1 -0 5 0 908 @@ -314,13 +131,6 @@ 908 908 908 -908 -908 -908 -908 -908 -908 -0 20 0 444539926163396060618371891200 @@ -328,13 +138,6 @@ 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -131765835135960660552807451524089028158233849469678584969822208 -0 4 0 458477653689271929750159360000 @@ -342,13 +145,6 @@ 39622934661811821553763744630506213929196932096668444518123439737845028225024 11662422067291787594026815204283885427659195788081136348012846295902003920896 196850617542733211416217278410575369737876420896781853126317893743949824168141 -2683172422101341871005722746258376340307644953044191751444605309114182348157085796971409744620711498580309302182985308212586435414886374286350975238144 -3484767657771443762420853002633790658478025026595023030399445962591501743459655114168018705061836715787328457528577115561192630399480939905028160741471812 -826369288885297875981086985856579353870084500166446900173411432842694716669231467968748002518734902939451616083284004742033317955616293179658208664891021 -22202087655311450647135419149250531087927146350676835345655785380157598138557194753184373294689489916297473124960377821312544654416163136210039001929744384 -5867290145612847972373997073309915340902862989135230389100858222930181445218524888102172986857355110271349287326639814908840476463002707271202642441777343076399506363351555575169003649515921567023847735339868023560115487675698958077623452675911334000167018425794800395206246266829715066932889888227328 -6613183629137681279087117062720950270493246965665653353814545527865422606963860172688377962562995370224937823909402574900579151120138866568996446233013596125260317722731462888479963743727090415264356847381807593700110142796538796057208396283278444005900325957636550564820775653606338375016287872257899328947954420594292130424139307631549548532332505581708062755002798299585128036685598543159971540741219646857517061331622628267531564244017650020495747 -0 16 0 491348889049443876707510517760 @@ -356,13 +152,6 @@ 12836249910756408599207651670402691470189457253048470571408310293697570799616 89957821137359056393801843026144645477720961240687064113356371611922523488256 186628143002875342454100646575613221588500043779267673627434610024013060416436 -57810819572866260801492155256759413876483749626656973452292976127618654522846001818070108358802224938885657621123322444739974859616822961140014252032 -3586935919752527353984027215088868451772937854013928716747601409083300019440067660008036473811750553056666280422401084064457379199486614970622678033275267 -11435172354316143741773241295887896087133672859698695578907055835282817586890921066517171600518967766241323412371609567006600523639894522363112407210324509 -15149040910228070805694652326182650730845401534077532391632591405118117144643051256922675471878552887101021773709591676502861584900921169634374950540279808 -4352157484305171917414400736736974322230700579288245632185873247491184195730898991437344106792548923888580847271187361373793947913900504263300740461685586606358268444829299316120497158281612307205034189058550655426163375786508423319573157431875873496129188997627673849109716799860744235677774874935296 -24655669188850607011881278212500400404795975111909544352042335778191251712079013936428534764805902649880208931889745231758199080159268053714657146238568540885026847910322826747799581068534312565470606227666766265055047378610529765358823154325332792516751882522879055713682140011583363538951298044003038164972718406208736221386819603161486554136555558914468701937507614273119563961498468609340048830696861579728696267046957787891673696324284268296592010 -0 20 0 995158961158262555374402928640 @@ -370,26 +159,6 @@ 6919681730812989105961680682293875199438003339556752544938537021004054528000 111415284413375575279069783743044849713138799010818236990829948938800785784832 2671371225382503991550810752302543668307773911036096851249073522360117594907 -3196717805164369921128204528085730572110803813535280667544983013152498020676968653158980718912649444544541678773084521623843027455344890340658923962368 -1238216679956500444264616028232887647747940490327785007262817775307688862239704307927037312429375849475227131933476467593816834523153314124523020288669761 -11027839566584582470519059073521721670466350661122931561173065258823257321580571220589430064206794766082774897831215317085884716390531116370426677289293467 -2022634134337910980433929460688286697109516578140587883097911933500075648632085115589857581520940210394331242638360018211669767050461136520845948293742592 -10563633569776338863997290139173141475448369840952853889830314442522523629045149771574493906944834062931170774068081579834010118509008087930549452650473545745495642812824093639365842736796360564731533873032609439082530461159518786091690259460722677617446344350444358408993792066302845337558798580056064 -12824372483412385861669199400205004566724858538474303800494747762440269818404951059835352877380356415578282393020015717678870100435248949572316256128400151457357751827937645568676301032707345577683626030686702589840795543017433728119877924868065460364994171679438527788229515928801213836621134264837100427090704057536254578168099404041165838330491183445948965724854110273982983705590693431410760655261855587976233430383255504302646591767978918856150863 -0 -16 -0 -1074929557660986703509960261632 -310308103079793704575757950092990989086 -45830377016999964195415645114843325971494172471228418297876829545637299093504 -101060401631390047762632218125084929475187708866471415222687033363449381912576 -130474939331530224408995396282441784260419370120207375947563617259552477561186 -2355941672152922857080918796873312219472407301725598088408859346047953344326591361786096096705419672944173727217808802505470853131296892573634755821568 -1316454184270635300204354290028403652975569924791362044247281669809677739990181839549155145392827806973474851174980544451539377747682379975465127356763282 -1438923259930704879657001108769207409876637192084506601145086731796010515496862959970405934371385188574753305943073462813023599491372378876317837370133527 -3751312292780009820304966556683277538490745683704566160236438372682961982986048670343223416367070064938538731816396930813426231559274819821553090255912960 -1940812635972614747466109277992726340848630072707912304640929127912329064087768370597314351590495738864766600213011565689114652892971392013558976325205708385347610787529794002191911334996478270010718764337052847791754345043741034784083083057127201125434592632894903882614831512194082202201086343774208 -18021429550902313767357511567759601756356647595430959756983217203030344977480124379576430774082535283607744829695070380577186356624450300463936384113907659808083311741619551253897275613952178963423684191041978549151808016907300923588567042148170623295160006737511147422878843457848402746737171046772562256330802876792353279038296767776587843369343160581335263159088902098345089167246852603087883635586088364841422928542822495523562426663120058625130224 1 1 1 @@ -398,27 +167,12 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -0 -1 160 0 1267650597867046177654064545792 1267650597867046177654064545792 1267650597867046177654064545792 1267650597867046177654064545792 -1267650597867046177654064545792 -1267650597867046177654064545792 -1267650597867046177654064545792 -1267650597867046177654064545792 -1267650597867046177654064545792 -1267650597867046177654064545792 -0 1 312 0 @@ -426,13 +180,6 @@ 43179616752915754651548109831528453372307533305539601542967080491130306953216 17577324162381258630474635337405333643146914114762554675606397827067886436352 24302243256145833886805174285503224697924343810958724170274784478667392432942 -2455073261000987918671945239574537486815749129964150471432702836905807585811396531610253905941293957332101512899044268740293992626007607127083491262464 -1077242566599992264249169571444336551411248487528972966637628471569432402384081668659908518747150256909990581460430565820193233307152827275575539899170758 -13073126603118771003805243197447306343271660677454831683154753707889268850436361661628016500641989777790467968280342772010149753216162050495370020985042625 -20998284069276981893190892536141895412205721732777582241948778013718640245971369156599887283883776856426273476192138787335689583588114031186267728857006080 -9895687224941938536992396259410735585498593485949826080868857632522617767715344081138466212990213054852400162837201310103538489800752934384336855267244623540847988822661005638222750684585548680702427543946047149085737687298331380026993105619948605279977576581565502199750299350287074957960820551581696 -20330471440166965706846550975654713890652417870226965905923146732405275304116721701265925830155132264142742283294001589707864787012405943213404119056019767248830063561795881859861133225475226440778669219796000363700993800365618586534090055278009338085683400928935050079339354878794718829630509418239605013719652286315425501679172072558159972643172621667859406242995437705040600030465945478758984414424005354845660305153595541783513391622742931412397213 -0 1 104 0 @@ -440,13 +187,6 @@ 55518020932873470218319288289245721296726991639699521321270937184899723952128 112628490590563884833405386435939751658584809004247538619207709896844158959616 5922841801814876533914360761483372163277450765372489528717658348886181069591 -2564817866139487541320504390805327358442199437592476952716613284652304314970931783459808490723737608880437784464822337666800292869999879039669023801344 -398463165885851265042497914635418511071393473395199568610621293995767308754233006664812655610002899538162554806154059048581305437649155727562069976883240 -11845528388829065193137342380492024118612741433871500160171557205928409375950091328760923663375034610212896359622832576619866946421226527978810823517767195 -14358105553296630195074581259093482904061967322039003650287242246847189245898106579740731184467142158444184654938258232190794449000467281976153220954718208 -8724046093635123581045526611633144774030370511834937151107124782757791671626741053594651970417496109952491903631645243345303037829497694196648996824200842520327610130549622341880795147265298435073802163280558766387420771897374896142381275499545438532579692773311139765116038449092364593363996255453184 -7405751147045042170442233630583323728853684512846881489652126352481138580343808254155794109418214211938178940574968048906922983783473775456657957578956020062439863911134378708160968666080910153080712910213618483308281268671163181505833074812656056876069748103205570600234366976045578890131475420080402034328956554170169080621020401502037844882798216390950223171848402002782939936087102304599378409563146797567777945011228369651410924564026853389623899 -0 1 820 0 @@ -454,13 +194,6 @@ 30966933304654384056562480896427815565136977421206545694335698204395214733312 82119970857858981914834549178898483174623261423734314091990446749364630061056 17335345295685259772267515166522970642719156121663286480022840319361908909536 -2314109225631884097329071519390891278705119245506353961085436228554532183298397816728391508885600113143907388260489256179338412441709786163323932246016 -4631405091549513365618104032938964387036004178571962489969520427453823044584554995003585135178458975230639830757208179222570849484879646249622084312888560 -3444397905407459769678888603161852413323651620442902175963208412202586537665061311535470334927067187735566811052881866689633902610439151941964220310971721 -11022665256141102472940378463699540949238908279778600071282259749712264960911250408144499157327170064963756957223649027433072458668570655608803856874471424 -1149493853622624808951893133000311601994554292143458692563726487021442743023464156391272602913618081421849882373383362805133207036962919354651311719256865291542887462144185133870512659168195548443958858491083766172641138569350640961793151838633119997925593177565959971136032627767125937725101431586816 -33826235027620277221304225387441637043664748422971678909986538422912010422112157161893624219767292791117193745224367096503738217947106120516761159479154541434507081629430040858090956433405889392516115304242345520261752268880565405366762142190916629498630348949119250396008683103444433062400285561745138697466209715485695816216568719770239333912527091815214766386375891923409276947021071960719444492160160428059721106325731604292930332234337842204147864 -0 1 556 0 @@ -468,26 +201,6 @@ 26118405364148793884093212339004353321168506206731428575114534916913543249920 57371932048380839143645765917598495087491748880125189544237269309841806983168 21907868082798520198592834325003250611892002016702940923441999346792832444518 -1983010347367670533586158746720918426725859238638826101738778473039940830888567731427474683445100376144146431698278643920358008341796317600412673769472 -2606640266791684811701307747992020704987556721798189736831558708134786779427826595516656788456057404569214323026273791700577064277010116095681833143649967 -13236721874325271723025473459287198396620022329708721480674722710511848773677038674125983763343329458361710367424043866874114509274517527946107266648826241 -2194764262264585667059858125941452105865892742975859841108712998947329687982788884647082000066632025028061458492389933022294535208755309187928296471396352 -204309344949056669756457560943541502699162518130681389120968275752795085274348261696673034188427085066909553427932479215637901119300398120607913517490261871972031537818140203177045230095689669755307530773417745785587153318345703950240765166902545254968306769674012995910371703479321012180805203525632 -10264690826749513230358184346151757544435920255861917426522952736046646856221133004608608156420505462277842900802805838197750732768067254277504971522375036317591854497981434809048391519641178668320883274044427240323533445722232511793549340418570864089915044452302975506872587143937799291446332426997988486186420527441812688737993113263455373353444533552218632449194597995340604827994474495437980620590990737309478013598033891846127947111075468737667005 -0 -1 -340 -0 -998905004448329441454522467488976926 -4927413081688125725138099137632369118723706439675800220006419132836783063040 -84352496855087273591478468036086052663893064063467212113548648838828702826496 -107903726561082941806970174768933557491971859433891364382659859844852394460986 -2319608449060187999684790351453024136538626650066803987926996295704247719880909540662904401039557482146640056079214446055684288473572080013990468517888 -3229174536762564836328011009025477898799910197080321024421312234854337921760217907684033379377552188666880062823173769265434474194314757844200157057703739 -1423443399352876324872592588473564301454095472277230446652620290446968276830664095418889947537872334002573975742103104497418388304230155249816071500187318 -13271987893729173924722826693052254951121133786126776376721905614595108288958742926463506237918989779603882913708829786515628223071604050168421092211818496 -4601804950488826494167685270760036664893236871832882663322149997831635784436681349022970436277158840767511957327023782099178816414168280990846944956415328077143836700852459969097230280911772452313608645578171031885121285719728944681182534906015347671757933737842458574792144739909126764366189368967168 -857479341893762723161505496595417165049229108770456259194779683064981414515307526837194732925160817384742675728910002446344631831783238186297049084225178616281383135711434226661298337670136802627018979396403252157951565007991996142431686702381810961834168285921445713777780679851079387977357401452731948432492393075599084080144393344786427912661179463547435908489113931675491545959285551896625752610448451638448866450487107364387582471184159571074175 1 1 1 @@ -495,14 +208,6 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -1 -0 3 827 633825295391748780828659810303 @@ -510,13 +215,6 @@ 340282366920938463463374607431768211455 340282366920938463463374607431768211455 340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -340282366920938463463374607431768211455 -0 6 883 1151402479073526177054249189375 @@ -524,13 +222,6 @@ 46236487016914252810359942606653565611806735985113905556189104784313205915647 10141063897320778511376522974043618320650062159021091584566880470490557710335 78190442020038551706136595408815344419350554279639655464038299447602848702950 -5264101363851496851433282540836956541101368807777991293344941388857765825339723752116476539712642325105142882152577944513410405922445245546495 -4274984277410983807532089925150768740931153586735292491383528412859129258433112273099949231101888023707157602612028830310955239728286706980227996295680904 -4270974226494341897280469825731968602385022467387106892501039803249858350601697035152008485439522684257776791254316572547412071137653017182505839419643661 -13396349486729820333578617551105577176007659045388305976467765207187599750765003306881228272040491956095560694041316948995285357929407282941862450720407551 -7272107039633935551591400893562218992924676126105717460127870788013015797432989950658439810996946118473016444182279548084821341534588106843981486932573866517856077154029000374861836839944939375168692527383494491021504979898639557323084128794258468279454347871141949852954622679013053097034606228537343 -4024681230464577896473641062977638052721373802614679861781599094800123563495932827294337297078407941193782141971643023681636515761542479169594195464691208343312685562380387487284859733536618386758347477945214430213026727223935953464725954742778965827480842612641410510935813810716514672572547641952771526945317395473564193078364064275666028733643505934945383834412116242058173431754061071146756970189972698298803191543547137198977609076610984071659602 -0 9 257 148913685258606776538030407681 @@ -538,13 +229,6 @@ 15737081446634197346448238543290111090647984834849920547563580853437339795457 17796349368611048392083206935955698801625485975991150886750776582747396767745 87042183171820405426823900509602437553981065786933287231059322442248803404950 -1872579959911606123270219006911173139292436983412774739613566899721054729108647438934586909747652198625290890899088832075544795394544595455034418790401 -1412681115817651652595578657596182058840351787817337255523617847758399731969803154217604617416738018019082279140815098858103221944816565427541047989874575 -4658367006324170812599422256080523502806559591300942419231897265664273942632706886970881430455450954648568107656318501922464893981721336262565505150036230 -14176910549874618607407657930219555895908368234965503682114333452984200436110890119648814677868732070859714001297650338292337460853941658691514163789824001 -10406141366637179727319354575345523585198131445101199614041074944321283006099873985593501657875961054722659983805551437203724122242706464697758320434979188004227317962713115722036138880945569626619984608791769942492732939213456452058202944264921993463328233802720857330376187422666409410692321365721089 -10395612500766716889498607750936120296402196259538392550447369284462443521703220089793251095458371323061297217472250908800671528775762556075103359185483070524957305359923584052804148040373365959462663236012867000124244297047788081721144621971838346991977347509145949856725062202597193816565726641315796367190832625962761358471335171016260228986247896685407131636015822155281779300035844200755378496158753851995591046914832248761433986938772195242877368 -0 18 33 501502021891302937219905355777 @@ -552,13 +236,6 @@ 3229040287801688211109538153528907359157521678782897421936034456493449281537 43674379635609232592374808570316762057057239464140599073454048485319171375105 206574116687852983759940670284339037133974987477578735810964428283965343595925 -992419486452661222145984173974299929589195994084254138342964889584701966790230864615423021215758227245793655600475560820231442393114209491163228930049 -867054567978498531065761454390276935399048293801759280371014301861063097032842313817626802406894612171009202210526526325159367606967184116106222709354994 -1139630468367775490336631812613571548165746938068725127033848437473514644842035232747054391798198457303514508910901267746988126523368144746838663920634335 -23229321847788976756725283113649930370792069582610592470231250035730463613494249923319913356844479204498929051652932802538286625056745478043326957712572417 -9736393711512156676697476147793419950291123704462141453822865116456122510755024608271599163197384361427364997715319701954677607307667967970314752567786721165005692082957947082637259982017311319355343061387874272954404686630047193927081844593179586832512413662625777018863736941974537158057318938574849 -29060966502289446762773527309129862532230651461433207672335349512468314509838153919700009183613587271911577714742576064666717735555966747507902189346161650683338259890112722032957837515796161015553488353420265757652831337573527786397820733107579265093849101520705267722311390949184609843752198524487159831619663983822993580005359239978622465631388243890591655090541561296753761373713020979145034193471076120681878728773637249747647754915387598872616720 -0 6 515 140262897948655524553823354879 @@ -566,26 +243,6 @@ 51292049059523452610506083592610024599583816874803914322375719502751486443519 27936184963965071766976378876421641742859886164075202272073313001233759338495 13449010363647692703508349667378797433516756740069562881064298383864033242575 -3007865154522879628838942692472346158555510514358321404385880396123667658951604878264737502736736088022367734668256726008347601098598257350026528292863 -4592124389902639952157884879500633941880823326525745966966661569784155220592348399170518240885296517746840773500441608980855453698091666787607843899145829 -2534000532084385254011173048792691142730414486367806853286959714601853302234763393270798424710144792599095332446397093107565422159020315343985501774159892 -15542028513463832582045168836396386001625310864606581833373826691519685781220976702479707834361513658452848273358428791133185408252751328679278502490406911 -8412092699337531037787046468081884678528099171920466557150153840517555441701513747481625075399369031563363890720070512929533552898722630769019938157826781770070834212210476738149888508884995219178808489342005439633046794302879951435958690454691212867490392351796728559169919328744714016812403628441599 -33830106619343559855814362535589211924203444187711545573142435195593086511328847987971132905556265209639736610793615201190028737913698317064723958072416856829114676871668002147741395866264126547513200446705626505358831619201264825403452572963238108829829155602404009157481163421152595415563917960605621467418213148184629070795051181898610631600475141956877575705748780551030079535279390822434842453037166286438591706030638299501460332593582408355701860 -0 -18 -793 -197025322184063122457151668225 -0 -2920290130103280979299916267396345225782651892499153454132172827501589954561 -13539515947035890751742634672716012403055571371579065400912721307212126879745 -158307368218366335347174104263331952261761856873568291783365034272918926713725 -1815215034323212852396070290108011856137567892027865591453387561513196098766849400352437123459701948446227688759510102669983999161585665721657907478529 -1313998427018914497731975785557000192540482097274033470133500010806607846954570954898528158955314391602627353029912678650049483923494107529991028097123237 -3558766711272482011504448167665545486379425587311683496485361619290623375415884515332307272266520310480366471739749365076632262898225547952923293595733728 -12553285567146229581143238572266763310070996960196734618418238189114111487087176302379917708160855599798506766652438515952406574783180790667512374443900929 -7334817924922815993844247909475070087281744359403537502526299289084906210615638233675595384256475356219608076645306747447902878463733829119335042011404584250731670549991672963716637969622660364460577985065151746629898564582075539489021571565895740532432194811300868623563387061791622447110534725632001 -23782765486299170619653377638001085226491596574584464898704365460889585549109410835130873109130617681428671842761358877647827448636728589051462502446489865488918684639573926641287700719325755142839567735191800755724523772975690463187286534957742763295127666200814136161150077106827630178598134515070629372319788894871157470118252128383759870860296840401062420257746959094446951505893201604983152709936368275205715331071029074242829807922867113197544311 1 1 1 @@ -593,14 +250,6 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -1 -0 13 120 145483342680740634262446800896 @@ -608,13 +257,6 @@ 0 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -57896044618658097611351864738157061705262361561497619362091104892532012613632 -0 13 588 242981830122332196998498746368 @@ -622,13 +264,6 @@ 0 110892457497452005403581430237946183767136503117162566153549053970000476372992 189155222634588421211288058609537932434095476696578287565656039885444474631257 -2273620924019535126443377586964826655364563651525119527623848142652704686460888155148600115764101538394624015930243455367013584122475807191504328327168 -4718242244578560577933620411853546035676043730739668011742858611491785678155178214146108560032528947886096115390359535573786208426628238424552910518225609 -5354055707309912886614410393569876624773886934053676926684306993550773407750553762949175437211369217571333055727536737153756343047932603108461352921558471 -25365469084896632438831937795363726978720559453448504867481253590410035300967847867532559492662554029011867176416570131146842894254418120377083085899956224 -3757578315429890131235493992649120836389777957623924867570462633554550213501972098599500200214418806050260619389176706179192857127356531256489639401245300261047944289856878017480929565003165920312519588880225017152460044735034054827437950584392201188531715789576969371957511327370055692497232100065280 -15253647830407583141547363309274688061512324567554978156617633130357138545424717528865172974543531851717065650176201323923438841684204225724333600965120694028156933393649297273989140526164630013338776321111358526273453216724232977621477413581907629724731139256634361519074694441451017597636834753579301989604484256575167632226812528730857727215779131743352342648896678763239802119364145369163238668734832577049562494126042421431166789603595812731097644 -0 1 40 447233008701926529533965500416 @@ -636,13 +271,6 @@ 0 80370191198978495857548168233658974342470488197481929432131097469881528877056 57378722967569161858531872288267370459698099854972954033385237027489681458401 -1266685019038549670156131957936105569332778969355417709861995585153701875900859319531983550779488151228898464900331805671022343202096261388828403564544 -4007316844468480444786209097240877242135343232573279363036730296408578470321526904806238868824798952651885510964017728127623908601645102032546751410140438 -10809419853862469069424671860661466104583061712836069230246390212316112130066125544420392691125603322947467815628376833408555549515946984480656880021651380 -1850019664799561828446887689859810128523634383437118940053115370804552962470182093340221950762057683211340120378944062888849213207787569638787758996586496 -10601990121875444106767485014957569656736374682760746624229897705443065241696873816254196776531479775231519679842263077569364013222740741226981954932170832015958461515448934122357561377336766895492078707171525168572538566552146347786295929420700117193632141413315523494643262931844585426006586863648768 -28508439658852678107665155972792842206287661263432505699726272954607239927480675380840437519995918207158667265234219975518214394765767765060644972734142492559569055673270149098731414835043509095821925810223271993800625817447425850539568468486314744453634053786991467939161412382560926663037539162059349437789487898945599562092125838900291727653251158883415512092048307124528711465011479916269612248338449949978973514357464893125428777863416659679547856 -0 1 412 442771250107780063583096799232 @@ -650,13 +278,6 @@ 0 83509925808939041219467836468971382374645162274742749382395185649452566183936 130737775035935455315064283330339683168756409303633081183629254780389959201676 -1434569753988477104238938016621393717922537334575046291954564311951618243596601987643360144150294172150115473086916074540367171462792383909655650238464 -1628053801365026402929640374014765553703071179544257678606217838338537677419257865674757673512650450839264317003577960931228650240349967706184064403237564 -9528330235712431695508651348872596587940214388314172729001944199117139203073649460506789237728120154262303033791074115687461447137304611451019062450033166 -4143685306341548231504887338288660968707624803700705709343351955022110657856432837240377395875927501705908299984063250507069218496972459859740452129341440 -7458796787007837004712235977661789416985633116148918114280732607368491371782197880736806507445402383850766124164590251775004743970419719155659219708540227384445648790605201658248003617820791276119099869395011354078111731072541949883562883648840249249510616061917989297687935201755531527627290779320320 -32562067415072239193840246016716096268985518768069377976952382448190013331748839889139882498448289400400757853808819969655477710609459023410834554011819177127950022030097667847290699738778525902043243023637500887645421123275436342796803206335835309725086671594130477830499317959884237607103504253659374293236168368765551370942719124768927841271066850440350466143929412219292019549741670650796223584473716652795660385114766444013731211424652116447263871 -0 13 172 791101013288846030830655504384 @@ -664,26 +285,6 @@ 0 16620630689278877851873420518904814002737213549417357007588250730268341567488 135713742926877628027400301750580746786742856540376082400065882631878268256343 -2763703332326056666675771568612443973251095331788999459280007079557401109082037332230846287789955462113928953782310527076648915665904957779729505583104 -2824436745521083250434559952136747236272578919613634664272602203887075383079538439468738841849895882276490589513884561192461063598286468221544075155317742 -5573805721606072201024464091196637283572352485715830551875562715416314364897955988150179092473897788638830452265884540199145584775259028641318262487547968 -4057677748936070618844094810747404761610038515502652344029344965685330894561953958031306249055086692013728933315233447834639061360828462307224389794398208 -5784796441501303882265576458065577676796946906096587650440461985290957058829054847129274276669244130440701590711328886296578934710291199277222000695005904568910944144582690667672945892139302539970077461280831973659874645207539604298268246794000404198399473879519441764495134256354634643900506642055168 -27926326319599679689321531260972663838094871826824944182829437453915195129091090522882499755811750977000485175430688110045958476439969398119085050907218285133398254355136892348358892640344189516520338960373270419222146816179324538294913966113727777599048121837592524129719217066985421105982471108005619786655759673241565670064548335049859971927753583710716463045164399494432220069188699341199218886010208466355717064435978272444257082416306333129756637 -0 -1 -316 -71681696331238174643235848192 -237948749361170373273798232100232473131 -0 -83778207020986728476145484258908144082269934037053254715152909632561590829056 -221509419269785716227233899606918240392102327497753358712085651922766861983551 -79315321146264542418544101067771002872575912085812381774279752184308118738724006743714953988893825146071572131840361116250475308904572550776268783616 -3141911224089662508005439140547996848411545433412668670184330989833051246389721569721933639157984163331306326586989550527910321306108944965118472936437373 -7056836934790078890629897242686908388561326030807269602244791722619134700685270860402176255162872248124156286310896170748542196945067054699971451991857017 -19653627676393504480845906820110557077219860495796321885850081681411361274754697849285945541928921052518914208933686885858752894441356909201046802838585344 -9683163169799910671354293907568672381107851254294002957127298074004784481037839670632521780649121780401926430183897832969166328037150107405373952334255388250551814999528496252119738140300795402325170176550137471892883221550198049424126188627968546323114246254076277484385665176149283033551751023165440 -16624156320060803479105655673708019093724859687856669901597323414016554716036267842673966767033477560761233327486461318339447602081002795923903537066139452947433702150477385673218681847304679734427371239598965310386307842392299911576146706135987880533258592628104184356529185963203696378503916725011966153849031868468134727041450767305498104186987445591841485782186937410888737747186818628076918609180767095586934198055427262999789790553748249680495030 1 1 1 @@ -692,27 +293,12 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -0 -1 296 920477174324206192629261533184 9284550294641477953059815425 57896044618447473228882389021020048158893283581286713298429387432951596187648 0 115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -115792089237105570840234253759177109864155645142784332660520492325483608801280 -0 1 576 394649121464702711197113253888 @@ -720,13 +306,6 @@ 19171508671161797156614710182257630792593514679646789380628699765537557708800 0 83428280595193522049620352001877162940388365577102322638744416599597810157500 -2383427170914810336472146115059610133938440685431786051901133872674812685256214433004766571822808713024702089068992214313240618263661712821448505032704 -3543131743813569641335946273683240931826614024019546282265784836005828417893383322228810942263163410646159776819689834231870373605456177912242267705525812 -3201888256116239379504709172928241207634570507519243666267842079354934745091409880730742354222322722404797424377578771802961012486596039415971972097760189 -4721437724763666216912653616574178996088489462586407187533602132486864388960603129501403388719024042140502457650359696753171122610737975161314352895623168 -4837005771188282971935407089657043487019168586830902406943047384547231889109685650839979581515180335872804870881921663586570464571734302300526117404207560436370497430406529093043461008746914986949167798918225893839078999027089145630276892534029320307629830535688150128766532774699466359036038881476608 -14649538351459906058741226567249552783659862553950272384082762918585814063949755926925837749924987768515640556340283222177993507623584971708636450851372760248421615193323790004038285247571226256925988926564345592560305885533717028697892048480537531768156992921912334188996185887209116041579498773878589854193709529378983879403351880522010001304035516272695800246073052875655027404371065192473535905888797416623200692032732055359224565770757807776402248 -0 1 36 459149829216013907374855159808 @@ -734,13 +313,6 @@ 30121405346709427309695531890582421791203074728165296179965859962342252478464 0 42435402933391614285072618340065308663204835805291910450325661435301593697950 -2723474109035793261196285209480520006576094880312369272827686699655845402902440783445003022414244095338650103254192634946547862282922709256827062714368 -2366345409847035124374650448074879585773647708631341355179263252964806807879670158353217088899380315556678858307117619065167384939975455280949447515369567 -13191762144369989130760985435688757812828881793396707694471183793997116204175863881278765015080350072806582669305591779418584954819749146010893985699341570 -13301718048073450430547712527884367748161420561064642294015103641915503834019416126543999762601710015216018615418920000282926562454589067268249095837319168 -9391084627976509998795459430240744148278054341930566001679916095435726828423076214248815541128823696135595365039592549569884022180775653333743792501900544596968163878667412922650434328739761497861462359470427289461508215509253714046614049256486535514319610185904255475081934449011049104472856091164672 -7354519734624006876179435352514087233297298809165790925922795673494116116655759843604125047003991533731435264281192336103815636919140214933167210447579405287498010619153112075099093006295245714725499708200955637344617781547142646463544824911616543471784407538549422907647454757217835547791373749159887064306770673576013161274312701154428403688789455533688700894782342280314573076414570285083813175010660748552095076178542404200729953294305533949916369 -0 1 440 111480890522555005842506121216 @@ -748,13 +320,6 @@ 2219279707535425826019993588723715376924609733291444929791090369095624818688 0 125210688265252194710996471277583934881834379414003707914695928587186801398100 -2487150548049686483577986346486345896197470598544823109842683510353284256291612496904302366730404150860292761990843784069916754136788389949069787660288 -4665596396220733640168649174535027159196397070342267963244347648666006311146611981668674060621225920926771133113452576288300091774874699771692345174655000 -3321497911172409553001804903171022673679565313946048256955779288266740305599386551480119034076080803092083102364750364882135550956683614114559617436903767 -12793018574047350137248079672509016968931556367756809163171704828712247163091906244764359814474025125944855607579655662889196220595429789208504167192068096 -53376332098238942237058265874185808937843825750519948116793606680215516009579250363703665595580229234392378617881585484051555178971860102930997202131537779988926409286598509132127582039147943382149262722075187323524856262926753691304631056792968823860069761025941851259838112955696975940302445477888 -19923611385063419051384812211007230050060207617704483913568487020386612675099470773370717657374861044992939563075540978208277455783654511878538950291808744228334204522554009216806163343973548097843046243549174022328700851586804159313601461216565391487177684815873717679059019796761667669491458419882506144601791158476320022142436392910265642137030624038589331580844312683788761159106773836049440285100183481918534526738945630197824116914691687618255349 -0 1 192 973066898438133470773494415360 @@ -762,26 +327,6 @@ 53535005721204496876936515275724889845817409334527168350061458281042045566976 0 35340054082346922390131417025011886439703502295343037882213639103251549897900 -1009118888395535762047061721180456806194166614565541999396274651526674300640202434640874659775936931364083317600665242264448090018723165449003588386816 -2392526284157188505188392690013448960986950491375028571859495919060981215979514074503662055648827708202314679184721591212604079491336362235307206391833426 -4218798631160832202661168847672965043016773529025064083427701368151868437320716279368190139450621334670500868570495563594616568204374854957138784941027870 -483959849385694416988953239395437763233014877575377690428602005170645490229330810160206389562974522706669622381302406569004289640692782430642495811485696 -5378187878649244049653816422966231411527819255785030355895748698860605699359864142748498411935665392420582096163286983444186194198233107257177496094195107895074872712441771334893808547355079651652051885242856910759791626223884287793085982216148604993192657336251775590261767563683353789243163725004800 -32818464130850205246467682789169918339482637627874185171064672905340879331577799944668821853359894806536530578739275748702344346513314541480359830789085211784100573835252933274724858360731614753176374779056545876405547001284878778829435612577133895639650041742079621450894836820613872672377867785376695923853094317140137484881752383755066269670040095376107209776772131790659671001065420513961226520376690403010625950002651054751819424823637290081472387 -0 -1 -532 -1054096356549212854433844559872 -295167673194252499689312720648542539285 -18569052254320792886536065199102429830591425911674802887337142847422563614720 -0 -97896720708781798801687131335879227111506109430789223376551280139659913587350 -1634009508410887242647804687779058371050929112656850452045994095398157878806417902701340267267910135426243622542827304902620893278343438781078703177728 -862159323782353319562779470318789629705961090965297342320245925680889441369443314188948203254697918300615698372425403937959274851949640461887703447193841 -7173051967940195554257280536479042043827601659905799457098258573897554700956880589901442356513658795342086705483095145011273200575189131337241532322688171 -14778026829432832620717758207920676238440861869481283376192906681351851826811501922740289231253685732115671799215873523794595875524613727991318894568538112 -9743687940329798123999941212290764982687335446528161500746427614131976390988057307286128146303396660476408358788140586545951034783015956845304363388199684637129690259093248015713809461202981476094156748203762337562483089253099990690430154929727318541968412839173701447769414174975320032013797193416704 -11665082978646551184396197271822834154968679459301162080769250076458812934480608734582177152703187939426687223961976274547227366150916137584109379949067630208858792329939845114289322648585580755616610302258512584989884644997352747262852786631806253344305668062922039579812843505258327167494097412319071183014601014647063034669866001123270058546336028496149434886023941746932012392894414262845484462335477059377413559348424920746843432610014073597213636 1 1 1 @@ -789,14 +334,6 @@ 1 1 1 -1 -1 -1 -1 -1 -1 -1 -0 4 771 891784777631246170114448424959 @@ -804,13 +341,6 @@ 57895602960811796650871631801676582813791887579127636891104569893774562426879 115791647579680518644692972256970658065423327120836162316857392245886991466495 0 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -231583736816786089484927226016147767929578972263620494977377884571370600267775 -0 1 43 597446603600272666897934188543 @@ -818,13 +348,6 @@ 4960875119562861993119998040929006214931859756877807299872704131313015193599 83869314384839239184918994159181415456293389193220202757469792852202756243455 0 -446851339107039186419289111745794461503166996177271801631416983378126123568718875224988495884755883200400258616355472950696139342262717961597794385919 -2457416883750494183832570853589468397031071769924709837931117427688509339888648917495080941417107639148560803684251898538275596934697939251488325371868124 -4104295260045454815975181617904063417540583687524096503951973213007375671429493052370291608008405377354342405201451646421020861407202042797591936611216757 -5398900427668751217850873803494875937404578551752982184373461962988643267134263496913051856036153441820443871129747572123078186712219756428262779956232191 -1007218583726087024268446200406511915539475815058077584580036382202886749107233498655574150289262240696650047786995708501433958989054102047792490904760349592902261758650729430923763743863222004063022441814082480599888346140582423150899204609625387915667741403853025291774074147108688932055983390195711 -23380145599663018538794334849478795685367611191421527490464557496763254711125422173670092394177895709559935294769976819952372348766078401488089491379204849818544542158134496224979987816433965631446790943462305235568068590323956450149969681186862262029930095126068867520361231472357215498730835672433665458819876311608479695607535070166435960898021320714467950701155806239822554229659277947203115399804129178780683995750006285527204806890220566457893817 -0 16 417 51915870197464503363519381505 @@ -832,13 +355,6 @@ 49219110417420231511113764378238860427237875311237523872333835875498405658625 102059959947892163134217117691190804610012473033509494849327043219849901768705 0 -294741958829571476136926871256484717091819171292816858794352010629523393545452840612410539842221513608737007525936314033110034418127477704314176143361 -3610022075817249902604614007613923579547402226882542852635039392814912818785402413253274269359316403441885507203823787712636067696281764519975647585808036 -3482683400560148150354019097545843271463498486574340530929160498845628623564983594731900657921818042087045491261078134766035389271551015123919424955561779 -2250865723942111784039421608251851432625547218473942867505887413831061852377508665133755951631672797483190995230665622102487996363019684093932899173138433 -10365393947735305013406914790529970011789937562186538656086799243490315444313309044458058836146192026472268081854266767322163579707977712683519957790124192466318755078159491340837738702367012687896445047003782661660364048868352982928925323993821529472941240126796375997530714377580986794001906926616577 -14333822648693704865076879128906075720499136539069158690685854059407099164825884209184916036182302301395671457986593271682838667112004613576105840990149035878508820984562415792148035482874225110645395684214966452961820472792442602064243527154948068695736851229344379321130087114111462740896607157184206550890192589389891097286967351231550279425607394341507476319668354155045448922078367672145026743791767604387213710928364307934410387263608077250700922 -0 4 857 1131685075580794109740493832193 @@ -846,13 +362,6 @@ 49306867245429292665712135123169680084542437782148851479415184718925278478337 25169675183049498057756995668265957449819867477380947926503567596715595792385 0 -1542102799772537760963096697799266983934002048485565532539213661192226994429815251647197396526306187090160124800082409862575273365902118268755683311617 -2878686104109625229862354165402805665509620736230260577444969531934998053988812440085505116849926944621437581036715525742444317675163909046866434002617548 -1408524625048880495289336975458683532829516256219036238078109087870567897704916529748103852417398524574297919263661719753670147382638802928308999469587009 -4742693590966914277133482345622645931210627503968707620206733070482049794927860629080377711683265908227819055370520162972241526589942916768449868513411073 -5553130642134937791530098743023191297911732972994212582055485264717254209908250004950803382001574291176411334745038178232430168856024215688613524818989709760819986306959630308890022984882592785783047391490235914166320765169341522983194375620252621448545812049279764384555916944408353668680790336077825 -4723927638618295083690092755463316838498918330240796682728223697622545893312048720733281849001727094418300588431465926349278460120916795941753250274668142622894086165783902042659225253028435298371078758268910795425148305403592272806883261778790469890737429382002305486407398555872939312784693343967014010596526975636760014820772215746889139520167274303379900890377661917715485803657804374133841224806618394107058611468658108088260131560551896063029806 -0 1 339 813911142051622544908469927935 @@ -860,611 +369,3 @@ 36694329931173559945696159169023191810080707655034316545018050435414281420799 28634157081599137704071405870600522487246030369305940433755254306653996056575 0 -1843618193774705784137956843790595835260885788482623306691425639970821561161960610834735278405087149627169615102857943696661773073162375892056240291839 -1170950137596410394079556452052007744667922551742356085549311726107104621063174324321159198410238181081409377899289339696505183364108241398143346683397274 -6266577599180715272643179829794667116364415231701874317566806045550798989424764451453171897199722686363150830763178386494247478884029147366386550475745174 -19499454418662965629802092201099350207580257918576731805737028058666848388525076659636862212534884659279639848323707620894715396779028548909594207393415167 -7491310775427379205451275241696534198775207876533479087995103252323137907742560676206102526955127596768143236592364563919391365130622631807244861360530642258721353802216367646769792844931749654022069462592705831533949527241530587573297737411586728906086303832296331156380881819739166686878092144672767 -18796502162760160226250152204618694839807906286113092800003110777883789218842243583036064249900793594494008242546403509188567430371285061255161460873411492857908336448904619340775306266718509033743784612836222680866203517611201799111354771581380221437368528919952566186512228630174278700984373922250123310919722657324347467475261738175114760435522588005390001769791388961028828314032397203388180386644894795950381375883062194583758183135747713996158476 -0 -4 -729 -828471727968036044453779079169 -246763246873648168750114309847746005595 -14797796466515082470342263148884814370442076847061299435927018837432355258369 -53523753874056411494904927181451501266586517086289761739581598242912772030465 -0 -1610256322768663008681400364814073486033869865214932600830364116109232945229182624979010068028626424299039929917408136658184480247613110744087848288257 -4982989173773022649022397963184917180752190882657662748886552370901797910421968943370653256257967628629024664151919676967847090084950251857702290490980262 -12148110333218384648436139282566844904693423767379435822469549432550659540325752661673352721491851141598081552703324243494124595306618572675953315479573797 -11028869767950066853862903870251721369434866526464337153519928986032553183047292589177288689002878431824162808354999536746934113300550015294401283448897537 -5564677243506565432840796326485830517108613266274939211083439123715117854386689205611896780808790236784879267345611559615161743402643098893029929273758889773892627347825037932396714085133601074675261736569510119123888317868706628104410262093816075912392494216258946925258732634257705061191794611453953 -12832448199509312748037695466110344603691973686346158577275697531431038398255234604164046550781119126216534644040340178530673012471457078814611960997016443056894042854161746711315668268536386219382705407726308690881678952673969590544355499320160817266809347245168990155961021732027075310147074025336573553132150745598676058388830602694665869887746332618578258133919549090512076129869049818309689542631433818773293308811803158552451157660610127239822650 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -10 -348 -734763819450510610632565325824 -83076749736557242049732541826465792 -56086793224325083479877516880625996376700331315327416568653997679101469523968 -43066253535244233026187978142387001755402803069145978156050831917314998272 -201496559500976655734260440277137434576370058288390243702942488773257463333742 -0 -3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 -3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 -3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 -3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 -3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 -0 -13 -684 -887995200883511538239500451840 -185744035486811956755421374818265305947 -28022724762678085694347421423886262818477620187692930983847526359050708058112 -60066058720019429804858835809980860963604546002890479581904231770820593057792 -140726188198724864302983488206145216978022023086026367060204697866126599261742 -0 -1306435882293703054785864617754127645947981008635081515972982328252373992773175682602366698784049948578438144756464452476167658757197266011674411590215624 -3418924933199934873321329948743314146142040692630731923496865500679236033474734183436540120875605867521473258874285532970466381831296084581446997731696468 -3109273453047763295057753183837237869395959180214923717206774456268927599702732452171437824488600294111292564013762251960507352853270412970588497512497152 -286731836186446095857785724442739726555989697273304519023165182400415887707383423935925307951900182657313805119211164740403675553245412634677881978590896153075228565724249371402865963565486212287922871904886718220392004596796756145262329924195978312198219275306469037658944155791679821415216932978688 -23705763208580774588928458369265619438916460021945211232193047627926603512005878931377912938311419163243403002660952903410656586223538662133420783063393034282975381898012298576963467515440532649689328334345780681671723172171010972029952896075198416960048234210840439701334495379764884464832012212719290831505340271260696067947540265478850247171084561966330905870702345126530017405343636921534310353745046761481665427795564834777302251191884558790364186 -0 -16 -284 -923020903585570222185243475968 -134595118892137229728955299113857603251 -12517788472856075617475369492923779675790060603142796585343152963486180442112 -21278317616479394781203625492118767183546382422255138071596449473207327522816 -37333224946615587454531558429668776609410791968643457941551824417764439077616 -0 -4365216629959533172982077795378474518196312747569830926192625581814797043834797277039496659650371970445843961712911189437934023902885370155197127447599587 -7786275362280256985096504919805326940788214494037837259488750879599254096754641518066648702992692840392471672645638933505566197966897842107066681649920912 -8618362445903795498495298150872761763162723533326999016941555427533106887247180867507912332927251479902784257469217137485980295377407380260430728522629120 -7982146058423899625168899480055973629935142133954608148082398488598972256455265091746814757927002125120326401286119392678755814780700585901254416951099507381124434116044162971886485060919796269087997434118497014919733636378546760466317072097028651097132741041399433702808164954962506455701888258015232 -21989330961427482320873414443063015928257919942443821711178892798696487896352353009088507622971045148342817299121972243674879166058756712149437499808420544292407293376143293804754263654378017796839550542953209140796361828649433680420247205870246799908001987021274080200394165262473622337823240257874872815088714497275294574219657771744609557582141606487864476140423350129460552762119376149626806864803509401361323064126501267414575167852478576633701103 -0 -4 -192 -132781846299563114295034118144 -287795638097315923177133982791898021661 -41260134549646540530567879497450034797936197027784201139228793125077872803840 -26725487537631090553213382951117408090775065651640692466752663021330299355136 -17991000660342902270761827603753917202037974525700770708412111282505637002686 -0 -3944008675763809747015020665178678882677044257366818833894853057097872891661745300374363390097768393910140535804055885471681266094856681311889793405842943 -10432168002169925309120503644722046609224368185326214525537866102657473676610157919783033661419495704812662343601179229565468596161053474859566232729971168 -4434125550755468286273915949559378521845137875362780075693690876557539422008078027298618389135234122502995076657800647221775819541243724097410850717958144 -10544028428859860647631953921720386323000119376125885681800950423087768127297571058267839503395689317829039753434382369495774320720145371495400808557366564483951610047346873818659355869536197251947067485092374284236784198628790721882722429857933128554802811282519317048898934233902279839985805232701440 -18440345941730146769481994533733567141044993718475504938583318912857102648847047027910392382495051573769813528456979411954962447707741851707281536897396641672916772895898381890381674089051912642497004147872377088851984352979390381063683748636451983558056315085668918214320300476071304869797011014426609032047214117423653962127333957708782154126828418118548172708012943197384144043383315600410200355075913830695186216882152046505722142344944887793337854 -0 -13 -848 -582024649450436441833425862656 -96569028480694229617495306964621095513 -51864362273957721702450812674007399695894707256635407766080228745350205145088 -42338700632985114555032701713036006818320082283349136714641228033327395504128 -215954730055182411688222939177706107427072066045627310771072503279957579162468 -0 -564120810776501871547030068641973310984074415468950923614458445915309234305596816720344025395793468749961903973331424982658487492675732875715746581881639 -9512030017005233270085163286414408214444876161604376761868292912053847917535106665754020297449298958739630340441868032179720694634048588859831514895174004 -3424474661482523359099400350868558228999347406743051468541630110333927244078257761445483195343636488588952518919760460591527948463291377508337491634028544 -1908744027142267160255992222033230928186240062062564360139414061079951535468660083714712566829573866331135382316682210055579103865954047482673249785878901884126518352007886346248743951305036458287883359238321077240214116300549133893047140060961188058073853208070901174162050948796606119057608052572160 -533753182221943739411515817506559992144353474201345586358967700583566469936103300520749166184587887860573873190047587658861707366381179609208438444812890854907402119224883354291361848266886930865694292240182736475266290660159879661714355945901578730736360959787897025448543671196789177297617755152629881870393271660514425363164245734715462258579427757199028980848704112940977349320451917649697374845997311260177033885249436939940782382383929118269489 -0 -4 -524 -580845881975944426787514089472 -247672215531302623220114886854143351291 -37388457217608581848439794961125547405280755409544281555421884293853562798080 -6867524968084435742227914739535272191184841314026237436198416499210501226496 -37084585770552631634036071894836390875870489411136211932476363892010270509161 -0 -2060718003102261095469378358151405280518660285538331953442371394551388847723544748074563153067316177877347237081738459763835643097859427740490945401065896 -2427597878315108052588416153186371822454229878691660809974423528713640874637568365876246285814256304894224389434236414966957500210729605332124313726402355 -17899117585006203601483637166090154016991728785619486538375724587636009980913873117460186227173247676970981855052572465455831400785016798907992702502043648 -1871601166577895913665863813882743743306248246207644360499054669218177312807383799762174801630805340092267502315367248573627278277545825513989809282952455822056852517152157679111824332559476177533337546335447972701488371422446112963735366800940695179512495443184058856851596498196420939445759478071296 -10550306778399659975487897356875358924973318622498728253620155978576923389364488120390171602550388451242602890206431322088607185746985283921168954364764596976217073705682936664824865112089874261838527911965608302408800742105060068062502398384764473486663935558909957592004243003066730197686300227260257298269425658277997389598475973630768006422518890534069851801433726348188900604318019697404931564408067035791107685741964005839508900413176154475821036 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -1 -455 -12835319081690733822122917887 -127603331931914074262646774143133941767 -57894298449951398757252466847559442906950400042978305056517893187912714944511 -82474589191995733226059000413673369947276401483368126437014470136553367666687 -1725367873614246661397681099761093360336884063153660970896243052915304594387 -762145642166990121634319750876330910924084988636669303246807590962648009181396757661856053558136824594202566053704052044355748404436481867775 -0 -5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 -5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 -5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 -5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 -0 -1 -455 -346299262836863942390852878335 -124566106711135523024142034815609358702 -44045214583669272699005754870852537422943743579723467162109618579770773078015 -47191182087471614723727659086024420134442459808826251007744893899083683463167 -149345394318679384540349467866290540580664685942593858325103856164763257832712 -328659738499559851395369286572775271201389799649696769367887874387602713649950541005767198083760164244451135081042951771979928777420726556841593536511 -0 -6499574949616620637580116906143754514426259529884439117780273025054849187451370731789917263550769050214853609122367946205434263410894715910936878759479861 -10124369117566771149603816821574722189892029783289052707167197978669109873476852672835440349606345261291423564961708638702389275798144171277206026719330303 -5383941699543092305623443842804493263947292181555684893992973883142751498900796716464867906615276957493629319704781718428057228609756150862864742004037399095952297373496665788422781648005837085478113966408640459815231657886564133913536806437981143729147690610590905694337501640066370356251688307785727 -6310918068059471764026319883889981132676900864298663494645342741409042787564204104397616974568887642296873516370780274089671686771704841938229887196137460632598595783254274133337225772320128927921843666172747542030026661734330465262950674563868305274037519191385934219987327624738988091242143029337066541173427000341834616390107777280313836624864077607937735030229348205663463578720868333899592726387334113240438244508441849656170478117348105420506878 -0 -1 -1 -1081180894199368861240340250625 -276904095316794738679647588766540076161 -18514213011776190595773191080849496970028811091221965026218765069756819046401 -95073983698370028065196578355547349954385319767423967546472360718799690792961 -6693017956846532764960681557697229863590470801886832055562479247632768202596 -2629164625513944344764393375912545052754690348620826079674933659671918850737622014550902801880361819290452858809500518180554683024947040651570430607361 -0 -4137577240563885180314014646510639308253117303602681600936018963727274657401877961996913350454564200277844605264306113013779943962820037004955398417119598 -6012634743225204725211101132320048969685865768619552174466530181728480133292301029875548285114373185900664580122272341980596861811413330588763908353294337 -254535129586580270548521975414349752244526806343151862080007760571223205791187472902044998439332623334230660834529731711989369170257700618020245017747639011641677093780420045542350067272071826391827216607645254644193288995966198490603503031365625040118877912466523642200661116519635298806043651342337 -8385908846676081908370043980559351677127770716607791744592576475690297800091571658800512758412511961004663163941376701719082333294800426334317916965716031020176657167014768130949406498916053374967901129501825532754676652724685176412371614884225185706503174134155152063944407927152995929183429819648489312242513817944158673167844009257444561330167132349514611454316120198401977968656265677200605323359155355731762973826116236680898629609918324923846369 -0 -1 -1 -324956523760712896376838553601 -47627363697928134504927977366887218436 -33434307187530355896632894137563272179790850372650630159758741607677205413889 -104315921941200306811166882397908923183277873670404242656007610443530523115521 -205533708257112897495155981027938658151590718760836138711462112141640293797081 -1107909686739446306967869518645944435031236156727422752526394105581762893921951275569530192146029955926564787705997591876292833451590952315825059528705 -0 -308755345928398507077827126197262399264414124207949539753718673573534243084848112587571000480595914906260398850382596175138781946603416961836963870626141 -18244350893087399850665188670118991037975220133032205465990746245721929325028153136705422106519390226837480732385191993725441112016188775082810504002928641 -3665588193601842217160462892006519794441699353581412583510916962644156398320556835171594452576616053963810443333586339255795973680000246325868129939290031865642638045425971867009672427500503914468057445618838753197439907968265469989645596428647594500319536081932047598179754671610950943455199214174209 -22186396831654097227986496390728371980330693530332007779166541519242688898973938381447063194690736625552685027691280623961530978041318772892810396870809949339891780432739513792778708087762348742046586160063394433346940941101035727747372800903757578028991776450199349428475680885800121505072160076081825165777670772329510069207190667831629973354820426821121553497181841257104073871622072935426694421062659417600761519902665044177543487193516620418169098 -0 -1 -455 -1168225574662879022832991338495 -57044890746169261651982104206166026733 -24779217388362851886903530808112954986166879528618678581940026232185554993151 -55591006844159235471682881367005599231961414654778243528698592315005808410623 -196546087471840559446390920880856282064404926864490466841380522742929941658568 -1917639872072259012937469746034134309612115999398820982521714520910586889626920621215182691543587130631234794290116996439471618261125269461687047553023 -0 -560629320288680383605194363023384807151678143098424596613421718363041709472766750167486947243276747104145109416759625120625677741081131727837587049341019 -21759673470171209133072662941401074809641596506044027427359195245599749269615278218888544963788731822407161900052925229605030503595641862078189438914002943 -8222674955398877316557535473602868565827602242812253563419515952040766275770537334852962079852348771177051126858608391846792829268299315517383515972974712379197466243571886838842455021350337318953242740755305732748699335134286099636570483789761728214215928903659103496254292223405306563391980052676607 -6704878406080177707560203655054736070477248576489688306407842672251903096919006312415980371154994403260429964471609192482935456676801001230508899453034708688807610209409717279310365716437632450197121589568242633422750297260272378736694314947182768068352565076127017290514776717356480481674630872849763970700450069226388331363736946106411055783778057065098928098706626638969150760900186745176895660013716070551573583271188993227435662677589978033750659 -0 -1 -1 -87563840629716667648756940801 -32581458921182292884541920892394116196 -36836091762090661553341041736371299478161889753078991612037085885874369986561 -103386798190572160839245264014111757730316335866975469301775408799589041438721 -230979096632485379690874166782108500616204584679462971821585472432375012098081 -1175849592681947186381704220573745682736611171788630769140595898826048744669637879095677970676093415500222347357756142334095120061003014283574860840961 -0 -11889537611764019713474395414522017738805331131412830425961734413527746223621889642851856767739924676858324754442498238690013743634420772752231361918208575 -10100837533498068062116682421711269237464416549039194254318934545331492474511664814492105364025928254622293940722169331634657785497327849544082846163927041 -1369148440215267019286304149733761118056665924873961991411630969747965209899998790716499635578218937487656801015714762781120580385002698505340071100124982713842184248347860416733386896580942622009293934979960183456583184237569483817916647944103549712738217905254990813029611090034738596009778303991809 -14470891946382593133261871975556948917962250576470186541215002308627316792841475378647804951570288535703522370652296694295712464047904010907340184090003647914959531499893292863053894273874528256748420135416037596722727653113848255103464219786106388140414129037919023044763659100696777268559628822671794913188044005920185870352459166957980274030642096976079120265889000691672667107327976040012293388052690990946304488345186187456257606086924331607962389 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -20 -595 -182776107722364003135434784767 -281466386776064 -57894277771803943810359491595023458960167522338927730828258057680034478424063 -89555305827206481420887328961785203324625996138257453019240897699860153630719 -31072229483910585358509303280765563029411398133731077240605874038996845471709 -3273390607896141870013189358366943131609359382662427080975450085374873026606564249289725539410814263596351691407518053929870103702401568479817676881919 -3351951982484124983609172268969732236347481510662869536744042230485685559782341996467619926017805728755414692283401971053259449792684445385138897718083585 -0 -13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 -13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 -13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 -0 -20 -99 -959889322504300279480128110591 -226336563431145028687618637822844548759 -8191728281812111000214169178820381725838839982899041198234467802159092072447 -89010858809825214210137289255494412179471657721652615002925377757309556490239 -28296599574001589588954577695238704244097106391390255507549917926893049677184 -1143685232425095012373289446686042380253702819534317091382577237068099768813347351859388607019602275279637030972001139645555685678576527645905260642303 -2104386984118747727716517063913738816025890811467756992449715776590348174368338808503581044664946651173257522380822233775261192222343142632013731451133938 -0 -3245766926972643552330628549049705392854964955772154252338528686239084242071182385973867724746592501989847967320150395945141828002524173519974765401473023 -6907648306248975720047253807553315878303563975921476580151692887533957733952838913222178155862261045104101262891677093360305327510435202370854866877221225386828546336285443261625103246327521271905514699410432996107397381514692809796698965099058352936055010684764360915671953963860003695683345510825983 -26447750664679572972311511491346762878392092007822795854735091849389623944255827031514453721868656369736370805514656452589804235525013818434397127292257036933491312808959509859350482891134824058764033024690355796359079598096947363393151627873770672958867270537674600576785634138230894329775351387231396268146781903236645159728891454367132969379219264931998221585031609847512363429272555066238888068880222596086485264677276997340726172359858551867347999 -0 -1 -853 -801006859139436247401554247681 -142225711339612348039388698959539597716 -35410378673742450051313678883687618704562356389379983514233123876029687922689 -38091574202374902858714012832961735959144676797295175057041826999843956981761 -35509638606720435404002212308149594900713246317816589861892489724156349420746 -947006889763449443971526094184752460089916877997363377410340189611125125701316093754306776646584059092783200306323088027637258553889934093760610697217 -4220939006243733889354999574941943865608293932174863319944209124029612039884827143990223224550002012724043690083235647740267932838159837905350721905177008 -0 -9819440398814080363130785191409752685155104538075120057014007750225191492119731772827023591993721591147390320845851382883568011993500439254883415399333889 -9655632408759825233958611797456496067063588648590435065602226373676034823927066598142456746083088436655720971023229982832504728539123316354948596655920694029523232211427760301619988760938379731840724545418059474244039925314243108598463317618776112331037188490273232491842485947576029350960119525933057 -19168469482771522387361980195401090898697209536327388812153014901529211406007624393592650590928364242770484062532946351666565045957764391288622530585296240046291185627706970869937489824896647625260613504074528292679224168776865581606886288126591395731294608037126460284763239262254718080804765957557128258706900873267005249160304719047478911756155253168469506131790620297150118426293519712473869983955423743730285845904324583142963587786011293140146359 -0 -1 -673 -715561516884788010108823011329 -286119718739330631910267662147206086291 -4077367256260361378876724861054846658815066802262232907668922921382880215041 -100388196731105783095258894359755309057443209346921752384716203296701221437441 -161978619973690354040532742933073207830461397640286489633556474311275198068706 -295808498796001041580957434812431144336907268953236122391222657342664931238894722072411794573977944314328249736260072780418263762201867190982817087489 -97407145078903878701182151565338220720952838018650765330450334535905937357373611965592469739325221569980257894281512858606923275277875824669884901395310 -0 -25619912338425179981237074026942021799265536991310528535894660424287880718210785582129672576271686161615856398250702958965821900733894974363009685894725633 -7671522909468965446688811864997649775732139334764200965671339202409525004787427756456574114546598384573443159084990772200209956297641268137668960261240194749599773379609102037525886640588454985746187171015912121459949370747421414640087855414458925160365198194096646399383154836512890554710890718953473 -10293884923205428378666956554848182142244715690619212169171170546179865224723565444900771453248701102868483061985574173559709761183179067864659447677846955231286308377671525004854738789280605580119191885659203370511449399894078589757295087079227410959307116809855467581150399434097595488801159507371338585214103760300181569615667928415747705672332480417684601788700985353510796076482470500651763753290405004222433976439506565358025254851862958596926224 -0 -20 -319 -798574734973800499883498536959 -119319092661737199044961145581817753859 -41294191017998785012725086702072135678398504724859270409452353997253994610687 -110624822424825875387330825570332783320826449688572761060969648171618999992319 -60004897054289201390963390115257285329375358987352500183853788324442296431274 -2150478234121502140094205664847123566690038384648319032584399902322112031029827710253123600637285764878597164636106830261747369442317038978555055177727 -2286371016578508441121921294709678407693328940913329697268533575124016682365838296403222603898047913087019704067878310158113313849417316810388464204629572 -0 -25671226303654754146969894507457657987204391426702541645624778236755811429128127378887919394161592482970532540809070418766878887011243610093297304929828863 -4785525495332916713108346669310355883208597124913721653495570548939574646651963675833362058107793696545444101958156033302876198568608530737409310207901760770957083322440752303097212064072393248697788251227338207068162143919875155956848187111766304706403350196933167632508223394324726953817363397476351 -32094431582633234807734495384819130272063712020829901878525215417797644447839755174060744776726644205182311880852974878748451402374419467270518797046912443530456212016605470991508907045276371141670695248538943422952924891445929100158107096854447459717681547826391098044944416207597160685051923871604127853310380648807504003049978615375745963324507225789653536595005326797804437482047876186051782235982636836244442075633553513047827811973923415770476767 -0 -1 -337 -1188247491006021359695801876481 -11358522768134003317334293217035462861 -6973218261549576848638199934276587054115075947565903430900153448684127780865 -45591291715308727736165915509600830342618838112033396612024233841157189140481 -40977506359948200822020517638847374989428006593590887799032148830447784766831 -3158526125081113331509898514788313887509900397230108802808242305275074329114995683632326747175671847567894522724549111521860848666266947552987433664513 -4584447565436503172316825244033692918247702864479587471557460110462846155092582971475613387484731203139053010262859517492416070493565968167184179196803079 -0 -17855886664960195299137683256225599460539695469189441741138167148311674787837063586188982923974069115198316431121434733749422291458227574255634138536083457 -1374356246318253574025982110729726842105081842171225422931088363015788466146368528015009583509706677602458662747215994780981399824925913453782201779377138318045172999325810798864144189015648497899487658934661306497156780183553405477807924063800170898266248650878103340616913829333509130538752749338625 -1640563579891112614924709605958688587289742793630758509110339884654417246046905788570037457484399424416760895124676877531011891636277126802773558750473620855831931500866708684883937438953118514443126192930877064490752020898747438980089537975395182532494013272495476219349907646220024050095700438285617434068609057901263757996869152424637406600611987744170919997651080917069478242122542753946615128758176926986841759042912203967255896726167421198572976 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -3 -780 -899245128272588436190215012352 -79382824738944801807794176002 -57892510978869681736730162220291002611042557329170362915611609916721313349632 -63318549916452990938470040291368379201286383559458191806845672058759835287552 -174649700752953765434988902296252491183916410461948522823307150782111144039507 -3273390607896141870013189019906287111002076719299707330406074198757955051929170942113619750485120149822099821188584330248544763114365430245700361256960 -1675975991239013909235918173490637855139324507692685389812651662983087942796182042459207730713681429512584287523480954202975430917613169254383951955361797 -17917957937422433684459538244547554224973162370938960458267029029640947834979519339152474433150005542914 -0 -26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 -26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 -0 -6 -704 -1177162594896717752709689638912 -96077425054455585888525548032358255307 -32860001485564213363245573215878063920603649509172460851204817722599339458560 -60109254545096573330255392159285415923549233358667844961269905663499962417152 -3073211245680220492517146661351308979695018043393915095083610251485928253557 -1196437601768571072681596644798276004178149983088278508148600069149523733201731793704103372368213233390444497494452110276684749064047644093326087421952 -2038636880556966905914764363156480651959910168504797327228316486248128297682164213768446666903998086070536989636186162862522556977670168122610463846604180 -10761508670374291972420269797715021028414464448240558938464987728552613552119689435329519427607648808039987095579973579961133046464353196386286909020663497 -0 -40984697395123061397847385885955617731982529976694509690496120168455541366383914951564162858485528121548558319374726064139914899078481865279546572464299479360080901581918627814605543248487499283343493082927078480873799428963538897690536507270633025904660571444960128829640263091486837879144125038592 -8909946412269299572792850981460782799532037067275283441188867265579333027637974855653738811158117573684759311560589042257190296847643010765802475698723405320867966475350089536733110413273085947267298794710610764685212306019986582674496969299883756072077594732387268624852957690791194886450004295782387045096350267854332914068470074912878717285439467272539570799182006042059497909029848272463040589609458879066125823035788194404021371601097559221551987 -0 -9 -692 -76435178552732951009197817856 -231982479817395379926203139743231669376 -47577898445412852300055548317787946557302802230354890877227185969553614045184 -94970241355010768267008081913617218797759253919929280496382103858739366854656 -14056327310363451370485055691408505290446120500764073466549198485574965172326 -2766964662182057386500329725111256292868978381151632013212396637813257618816895179949288796855976654014890661438562190344471725761340854297277946134528 -1329225061763580875918533781650822376275620990297295670554223160059148641553029627129765204098380667668821227128123235735809087554397139852326517131173276 -11097141842847614394079602992178709247589894415852402133624794662338776078636709858667481909108996684238974927213647046033793578164937980468332310219323018 -0 -8071735877529897797164814472711670751575699750650911010717417970127274646674179517149969617423521215633934503699616678817716843715742637948946050252837432727686220974468561142882832356080149399758341834298569043889563654149450777405007560189562518343814488242871896319575202397519320214473602582446080 -6694616185800266287626591614740434614172450545677003882600376830829359762042179214842368391192674719407443643400544441630973206517018113283369936295245057174712933556994499956071283288989464799795553730151588182776157104143243273082778860642399792205046014812501849329466277700807982917596823152488508302015315461955865789728769054751228692423119905880893937895064193158759226982592756051890511086607781198053342618530824939847343739509034244875431247 -0 -18 -856 -672949534961130560651949768704 -232952537159279159427935901397589147661 -53562723566230157237791876909273765997707933576810908258367261806129122902016 -31550994824562540598335530352687292695019428977242991470692369974431355764736 -152032362650815553704368562568087238407459967027457421226225849525712097091101 -45958219062793756897818223297329408371898301258718170247988696901754793869347716750803095228248960915336985565984017868792052415880945925312017858560 -2138965005429346794405216904139045984058362385566693925431000008613749092589355018622253069902180893858672397449645385554064735573191661559383999731945459 -5599082768478558353474373621584847716101862099962719911376003810521845817678124356992801556560959828813284665370289254359505555309567567683413487963442538 -0 -8505562198751426520419753868937928657815376861050869644650730877638862873089958249260761602153572619531088220914388128107806730704564885365227693238095778773347289827488140170092404396918489146978219366997692666431664422833499810391011971777952027507988195640695475217721220156144534273026766902657024 -13258845752058319557761867621646364193350685009107763072613748715545508884518792435165640060432501692620709571169303323832489898753595064750109814688579187658973115795780901167999045757923357842908980476028181042805278133908688854546483149229843751393689435259677649157449342132761603805685178078740303455039238350459994854784015714248007648831119423734010949858462504093063563879993972734732657191983776886556653813278840564588343475007599515963220807 -0 -6 -528 -754710143931888045283579265024 -287963055808859601191421471911256637338 -31470892304589511166080140750820995558894235651868644947081847455352142954496 -20368885260017261654021615802767195047009744205269123887896635371822470135808 -142720835682631691219581295413272156653298972135487346569310533961626415868843 -634034310188921143352280112839185376851989590898296042925196037660929073594178058676330909116314511976492745895031863182439397264248057241967936929792 -3536260655104985228570598047629889621504635464480007413999695872026244668858612074261286775235489798011926649959578184502755418831731290347207977473778761 -2287281553939530956352194620419013279616295380484047525310562106105104280173822770723063903213369365468416110828105561770407010047970222328014275531881062 -0 -8975406365256287079502146141544330687925839285578604542063444104478512627003244297195048898182515489030820157009675126108192822666606148894492389023997343919294064572180355360315826219274413911422788253153439868196680254069763329891225781141566431534338291820281857844001159772664584722309392818503680 -7627895627796776336034103253504663513973127224674837000702424659700877395432210192501491531145025624704509245843631295415207650789564811514832835249177414395254574557066114110734069582082204595410051869299928733226428505155385671730599432801289079265733997957718465603964310879479766099831516659589939704922842510148318960095699074620514977940993795465684303075866898594805143270298319852548800656967084658804532267409910838781960922542128682794059262 -0 -18 -884 -269006938810274604690777833472 -101610588522779797032951766648409694306 -40658360805639445426216385690775372728200090304603522756100519340351932071936 -91802138973420634587973914099224098988335694649088995732701581040017689542656 -160395547580151362819010763928022387697275046750539372389069219756723503990401 -2233124152381198796145991717823834504772859747063952845191626176084833539989086207836671472551515196170555448158422751623837827519669626403644933931008 -1919252284176976160011289332010981490746074225906227007498726993112622893994450491566696784468278809972885041734059388168593055735985280406694325759910450 -2289668776080774022092664264319203559647600991451909561040327250000009538496148645073308529369889500343496260137733562205719817974360067449226154885838315 -0 -8759003555859924455289792006122150340086642892965675685066523367563039345030166298894450331668432839835781802150906003659255941165890838655350310430355795467012027286822624520715979773959322702857888683940335230551215550420172560712753155144372559458294216901317555971294843609695973013254603739758592 -10233986988627486160165893250925551838419499341074966949334890607408070394472982377098453235058445034249828511040640776640636214044010669184255119316736950277091273009417324454157384181382413000016000601683912644163946480527308355567900081185611244964219361614299468279593357197464317206904586553970296516293220670021691347612227687198102745489374326883191094857906024566921950771760071555266307078912566589261856641951389747392777294648176011723094938 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -11 -372 -21559839277448701880456708096 -5316932265549267143283400319839567616 -16282337714987120045892153486177165723161016453744476162789802658371874062336 -88537159989150876890408569427587371627685568624275408353614000822051296772096 -117153649598454680903779921606971322936867216714956963589387307178373077018966 -2451846285358576582757929577719947826359368522202829009982370031469538161149259226929244677345525601309596834316982200231651181236759995889790497062912 -3757219424385931343692363754866841943466352992489416825487678472853020775555494604110835156534238535884545156565469882173219151445924025758587329876446051 -1637494313049913248505508525988843145443777840250318553676797222770022673451141317105487157651955800518089884835975451904017985829916792949984404185120 -10058766516776922387083424546997939506014390161211981301999104219673036875504700741486695698194962976600388399803269774949866748354955056527082238634885120 -0 -10715086071862672019870723708373567867164049597134887969429342556289689092328893032953381579589338312602609246283412714238525362926688916032991604094856600340922050198587112063568778839323187143820237543594206457218073322356882436956454658807341118763364007714359232059366253413058442519879029375369216 -0 -8 -788 -946214455905379764424855781376 -249640706902979523796329170594729366801 -16258878864784814636110793294682776772576083739386883456710601266131116228608 -94078769493157252401658832572786963194593512892920809466055866983486739972096 -195490272915595318817582071325338439133008656712282569735706902622916446459266 -774359154233456237796402928872914317257521270747766957039349342659625972382672493574510375099070233552293990548180408226281598743426255631871050252288 -3324275818746059767372921081282057650219072022078335429667273973120625111543946446086475227802464005339069654858828935205186959839930518363496383948716964 -9690305591136628284730559742274731850602666195501871310082095979151178872403510613019650261986889225542227473459970356781573066183889915340294060566934540 -18854688550460679120040977419238299860098014817785306576788948091134630080082228033258246996685817245124205310980844728342008317740737273944965604408557568 -0 -21535908620540850229409686341283386471970416340429967737238370022240247758101364064839301635897318433287340370763594753912136240228661108354045783804012930997208048017799043921041828011421457343668782820520536104076035026053782745857307697762578688266768524636747474268145327146906132830376635108519593754580661809442020459403107922707419305832717345589771811762862349427813533987428011905051344117484841279401140909699065164456004599224024146858711124 -0 -16 -132 -980393085630777633795127377920 -43821595176334581224008514546980603456 -52058795012750249675444812857939886156709846064922449115753994933360369074176 -14561123691201700806224839696324937581522964314772521776090379875080644591616 -175349175863053101686937135303271674300289639455959650994302374762982917881921 -1131906497036762609639522228534153459919865408591834031873180959858521631664870050151451799898073343006753689509175537114042334594659610848703981551616 -1350536895369391632569184447114500324766670158350291610958967597949326028999359576936432279782089126385784555900383659506910365560510605065726285256239859 -9451728608924473583394143032579162808176109643324961089109032935808751128466005303662886867241622116000970585797391055402890609702666479416682290459195799 -9869891012844468185531924549366273911251756943322915384954636117410087675117010026464336911857990363996496352787552233421136612436976661888444063719358464 -0 -29160913186613439708872461352513122879764789952607298290885068203114782142216922372207081593038688735241042977627651978016800109665004648282579021506383793652512992091245080903136500261598244223396601485010319512598372184283395628393048826477026318554363070339145452721174808395510502917485184825084502201409114714736758473035605478534635042521922391709556430295750595675343883087393107990838077832220859144502660929828804609103025888309324882798051740 -0 -4 -484 -1089134261820156880321423343616 -145538748117878092352760460206159211126 -33511658511802278583722924194874647566922276789108093402830459143321542459392 -101058486350009815877613019026909063961257758922502987153303461721695947063296 -55893599922312747075336422508333078260508029486824190273117160196130533025956 -2458978570716352272715788097961829640376943254320968964331207836957962374258773872920562816268264474274565514907090130109741585328325854023827972947968 -2334497061062585013441347827924568919650652349786907365392347487262095082662967762597898425035389335443705851967166882197635071826354135997079594483994794 -4739636748710839604647340865523976068039985893121701111166740470358505579292913487988032483975449672818248784390230013345327930989784690681998862554218456 -9268358303535012104892996424126494308898855298485453509135477774190853103484671018397846744502851397110775756567946279667738536399988345534648240817831936 -0 -1823333014513972248453863033569237311230812126130506337878885326530740596368720446811271380284232373400475839583564476423453964756030828084801793759122506966503712459173121792772565318978814203256490836178101826827909880676810922045422401824859785223968311017274407457720180425066972434143458217681896098086428204645340725330308523442939629221459319570158112385542686278442818549344024940355939362383436777208099871277202253431959816109988249138938651 -0 -8 -268 -345705300287849490539146641408 -28619945476059463819047280294135199591 -50097187803714017428498902612256509194829161297911658170445563991107297083392 -85421690222206289410508936520273729553730897899163659208114955446435945906176 -23541147492225259737409530414900909030720627244427625246343510574225863591276 -811358695156145842831903450818927915525548089569942629196406351050494125902340038663677284364719310507462367292228961985914579995483031930887980711936 -2753993259413215653375383555168520262036721258923608032707398699340884867309124328134824761429544678847308130542242013461361725575679679273117130844404184 -6291784738152052628532475385001151529792773731941954632670769788526762258081592087250332058353673371670605911117825763975584603160350868362121314372190208 -8246304950196854775397532690840382052681504659869650088188493089155770401666344769741621508722408724512112431250395089366004560986597746949833784645648384 -0 -33536828490723711025794383275603096340930562958525566355063509107668073876964224976171882248532778409771216997252213433993697133630589947644361952834437975121876157813462137576683247086121046784363938117600983461647174331186404053947864440728674994199031341263900784628270176815603173354730641751334159968196129982738215961466145470666104403167324840397876006086216517663581877927694551780431366423367588590449610474198496508322115190229617947779491804 -0 -4 -744 -285597678780049650206757617664 -183060435302525962072268027628016111021 -7217761771929207302500684142267832220669089126781480397245769148255541657600 -79477460217247376097886641006546273302212937742057604494280155910320628432896 -158450537078399418888641617303234395161356907531049363529305739478391665140056 -560479410674256955928059381764241238133905670084218664847601259116454401923250286188028355182665809615792144602857372046658783886046707955042334277632 -3683866358503387723371342100656401419267927238139401708364406415400694153274197402996715954111156399475059634029565264927949827386724995677572872987734714 -12590844567997964881164942256818297297627752677819872355996517914899426206584352337319457485189429758905990389059981412286350729613199131538807367459067873 -14260854143752552717856629622964902246009611015390566846603377483401216738344769373127606724470825630558473764635392820940186579136492501381274523880390656 -0 -21800320263537007047472351208796015562335481192952840431265409041550951526374116630066499902549548119697525627775845229207308993284066362779188144732297218576386880741913758964084484707758910160792538754632482272801417299710417022721348611414238310143561872419421028837234898971823910500714741024986033307017463050796451118315775556231911389073082154651438223368297410117325974472883309213628390772734914681877034242596184674973753688803388293273496715 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -0 -303 -1157847834746177602004396802047 -339617671798359351079692875821060456446 -57867775067306645753843239588701162944294645608219998114893217643713234206719 -26369455828243150957066923597651481411694301395220676885210503666274163228671 -11817720390503827648781894443752171196964219125141796458180108788425643579396 -7804371375807015860240250407429415282553584425143433436919818048882206801446222314107580658597196283229772192970700820967091727381696957189718015 -941081632068259047813718693871170463934954812652267338340003979702879896717377687462914527089361639645292415086148993612559161291073345891219533759743345 -13407795142668967188561258511782701242040321017549139392778624385515507058390936234830335193232662892196414947249258255251754028773259240421675666352640010 -18030219496951436955703469321804144806589781292361309272091751131804808417784938468039344100394760314581363716192040882359255669821551713959394630176866303 -20764409093138106714694669222174000783080657450980639056024872831998438690744740872244449057340558976478438798965361453061982147397763104606367603575189606869434278459569124428885756214636676791959099839519692515219337740131125546138808227180751694999895383762073154332479036368513723304712662417407 -0 -0 -0 -131 -1049832718450901370153113485311 -123743968547971240881793449350717343096 -54247495121211160361188037929436149205783261053517263337868798039971357261823 -43780720696046181429968922798344646336098289195769104725971763934578188746751 -8569638876184228017621190554815028317573269823425357131497263831998166914171 -2590756693431741009163041429286398894656679441703939344261083891915266425352426310916864582943630782192228522635328133722758329149109900984640654540799 -1922792972978790663157142765037754247364399993465703829196794167418278912188407110331170404215500826901691954309618913442459626285713809675553469719932485 -2247688179853902828346517371756160939505222414700682406758025105256274372769418491926470116598950917484231339173818993910715883012571037685660436398094565 -14071886071206496987190907766460338856608548573141424962453698818757002916637223518158300237915282267942872621643500179521389478132153075114062917306155007 -6980263492707976602733081771294983285805560539203752519918453497642718603261557999924227728869489680883742630490486041372040492077056076650919876897423133050548479425912646008193088180932733170859088326636344779595580028567634175375390724080269085084386954408009560789015111093719791523327272483291135 -0 -0 -0 -213 -624277807757669988326564691969 -308806362863810512481109604679086238721 -7575495667463650924420531623779877444872078518414758729895107613392445112321 -71383655898197942633634404834290712896942744228408684751177316467115735121921 -47122958114890946067870921450228790803155389424276201823055498825762056188186 -1994424534807216528160042697004302546045534768650260352155667756798588514332350607215428085715884919952309860849179354235231346459029751145877699821569 -3146301561202581022604671318145679315132240673197187143392208577019128708207517211248787901932425426040980775091796171281106110880987357700982231152858994 -13344055815468537346229177929721616555294581393221545616480099523908865321613366395170905103332895603014771880154289842243792973144146321750132365948266313 -25653689183378345635977168873503678049300684399452321461457658485062084019322850001321503409853791883406838755199097647132019767454780407950907465283928065 -229130338950058715207075928314567718431940966481184952335048896861640341691504660128894140126073639123936931770837384336344695028165941321264091705246687393301105660309858229907321110227251032801854835879822879826073555284111211015122519313114936258162164556856278990251776549227306961333644609716225 -0 -0 -0 -141 -119107286127314199610661011457 -208956661746708815346102549108455455236 -9304183766217687257009318351289386378056338413009755635813258086246793609217 -37346116786925829034687685788004865887841441332555982208115369087891606077441 -142686669406791276574941284020696419378508583519717415488223479096553530067216 -1022103513376169960952043514852766564406369544025973264953283529967298973963692347373601150129718093616182401830320452020826518193269025639232195002369 -1255461492445777082599853012891109353852057873636592494368775587155748628015369099916821369435584805024717479183629939627196544920025710945751532635492024 -1189975803267431345957974690102770165991401096160981798863264688637086156816693253154715236752646520545321786646254224097289874096394507609482395432557936 -2038989167013368656643873390716729359930711113157962588962483025137830789336536213929010174321600155153011333126258568329562186707136497102974740273823745 -9084986068063143759355885696834360372551159629320665871137722600252611748073183150082604901064288041886108395689572588307893872058553059179847191635406482453723540265118257106957652545879445444515005992515527078762521603272600432053705760074646655367876806955197570127991703691485644599174058580377601 -0 -0 -0 -243 -699092340274526400217322881023 -38592925135126088279952503537704324536 -24069098860725904074101863281316659899407559169599337507189559069499782594559 -31845123066004062045091085308083188950704500797090491164647969353944050696191 -118305855347934305358536379357165472350660178373988900770159391774566491848801 -2008713282085666284652556551621962437401356361830493232520690122524894627206383197505895885671920146557265344301589773021846167435240002500658026512383 -323133594322353610393135271506551759249338578228327732110434346721529507354177413565941533352573023280770193553578703771044066939448141422832699655754215 -8866309339762256938205367118241359468285084241706741644373897192876383324845891938408677922953893394868024823096760328985859074426231649039808204582908518 -10592335116562605574859104705966049302824382333355134511227046941609708791279611163990078774097256277263081299114817404233848814642481057406588005371609087 -7409638199867804511590556491020804147437821443902201231464956650918710757587485835871076220513184441280932875327658339055507870288640330135470374231086564968802510793220658631244921907134557333508582119960035628956742572301380943132749810700571732870307187030378399921152414041403031737491047579647999 -0 -0 -0 -361 -1098223571363824020337471782913 -73118673265328369333869451006373159426 -12612570963041677221068251937087603519725683816332068400361871614991377891329 -44757643964492500248872741260097920363273353321461345189639693578247602176001 -3942245179751587580113754740041160627070588205547869974769586858647333898741 -2612294559420208791815554010100531022826670009294237097218906452805851976960451833971257091500484048552506300644536870798907627346813539746460119072769 -4886652767199484464651425905879582096234981128410546139257549524800652233964932550117395659883947428238070691107034177061699574595056075593731862734910922 -476948687153533538165001293464509838331769398407122530531483520520031422134660870238181672367938291384232556352408026637315514098467464396275313797141550 -4019828793218805646023303231154957746362032987800527539184202417766187717897646394634196457153911354739604912893653289014782783880263859608454097188945921 -4075360670358372722795335962773428342675661975784760871564112696474315403655585860035546105060954687834105799318439691150952278271480480434794674741133762365172004076850361918268011359368504306942773658004160938910939812513459072944161883845284706441576028699349927725653931250854074869857900046581761 -0 From de94ac25f151b7637923b2018de6654c975dc300 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 13:27:42 -0700 Subject: [PATCH 02/20] missing file --- .../bignum/test_data/modexp_outputs_full | 1130 +++++++++++++++++ 1 file changed, 1130 insertions(+) create mode 100644 evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full diff --git a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full new file mode 100644 index 00000000..cdfc2666 --- /dev/null +++ b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full @@ -0,0 +1,1130 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +0 +21 +21 +21 +21 +21 +21 +21 +21 +21 +21 +21 +0 +309 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +5842587018385982521381124421 +0 +169 +1232997389102826268860991065105 +18618193491623480687965778108529490131 +56424335153278151789523409664996995581162067431087086213061556134977632914449 +28522822713801268588036943398667804191745915805046109428618723188679866502161 +31706899640538131462557950751123123992423743151283050819612655945089903928361 +1626949887851522216050918195251855667936019233629512014857416262882459162506846482867598420124655122796334698879679058256496280388512107842122550266897 +3456644180256483296524124683106942480722843461305992677766332070622386105650335816178720659995652203171430416751945868032819203139048842456194585731900908 +6658621772694490037410881754126282754619191463278934006643576166056374826395321115677201742806056121601730868428249390651828408651815409287407418905560894 +2188719266686453452930405899199235044753192686954839466176162624683199938127424638750308949204554559166758220326224401920489333667474175603924673521175569 +97683072410076712392282066589062765759142693107292941896505293584188136243288109019576354936509509922977328660487195240361272139205510222433941017334790678007764542793184659980312059915447722823578668568011564108579332326431723751410142184277342914838944751536309663705322838157117861387318160798897161585596832140403965513049019443014736754070054609736667260175758805144888061962097304053358670835773333470540890735799904230791681702069723170059730994966345549884415945422800168211660316601223536176280443881579581601353735508758304931277498652094516655270514463040776026586550201010112790848764931894737145319055710919828903365167548960625995539691849361659426748054745341215957250295921172194577332300749566307355206009183548481079880848158140024332983 +0 +501 +163832143645086957897416441857 +130403518609156362105805396406315208861 +1950081577919450936472563652220396332042682835950151822696779432336405037057 +89705076639198166424843052158202309145112564081865083245095301525986942648321 +161580799869287829122678259656507339171378764462605635944908315838074450225541 +119111099232869461943255917709559971029471489246820147748389884283220680875449970114508127905572794881898139347855563980545398801715283004632963481601 +2340550614088062323035521333507933205420749928049240408457893198554975629380160875595843975025528241912895931129450956293623201875314056184463318790281141 +9658263392514739927662836103088426769134800307082054844647958520598804818351406352355729785509682250873421347556031006118797390529574721358615425274369903 +4647428455414528310735419222346137778331384012634538551014412602117023622880652353771726881116679285768237724443091476402706202263926819772616832419102721 +28906403319829335579152758638386875882157614960297137405961247837759673945253015729546983871627651295299575319061533798314387500195065807539803353638203395485986713693607566481778609628774446828616734151668234602307947424409538672904687959912738570330185363904523550454152635659490551290870515246999942195502104118152301334700089287366991317719093433052486678593858217226842307981271549071491620802771924028173932162208416803577135606285968124070284901637877651643821446019733885049153989665296997992788886918211374075831435931210077446773069558106221488521309239497226225767367827327143784702703425755307906283612559634838050993457902429094094933513319959004350518056515716806784625284507193189229626210411741030529099220711533547813203461920864443567261 +0 +361 +349605011617414033395053481789 +245857331472368514819046594566028058751 +16196520401421423385786338368215415982698439852342927927980513551465948892989 +25448670785549471741073803593965176921136178751681542787519830340854942519101 +208746275861806526568796522022506082930013066308764940459575687169043802837726 +1405046333573254154362728566205440659065789596162373947677922992002779706150301916091557545001891022758808422492046510466274149060187173986171371114301 +4109950494713993893142341968876859588899697995149574488387185284937507905151071268229544837244462536429462991654059099118254521939414590134998340719446475 +844468128021093833521017258842640197099986073495355910940365822372902152436005754957689228609364360833723273104884193579513808541852965164830299937335266 +4841490524461293458775865719630252706317774131797304941603107709106391551373400827563106022147424343461775948749633172375219539070706909069136692738510653 +2740789198296345318965111850612712124652802051718746728440158354114594129999474575422329095265931082725696402694153115277645383596764582263006721610854081043248870278564998781931116935500580780582792000279161514916826840858575525432768051097577477367255077045382464021310113198660432638949403898388170795721793065002216164669679010725866562559739695895046156552765387872883795328098201847555353205101813822718040399910552301303131582151997608627639676073359537022621281032462623358483949826772477933699237569645211796888270724678872987960765671548627563068593024266312400431519682768720409103443029801469657858538886532661680709787379202798150567139685716652711550210175722552439867825919976479511936022577306731016108116152385593537502616696990796522755 +0 +625 +268138222663085878899055263745 +24352877979184920020466043837322220276 +34834821705580047870320807590104282154881192418891909778995311440625022271489 +107743694625338367548278288079708411290661245510293131426406157730911501680641 +118236082284243482508848267847953427609046466568857110070954823921881387042791 +314573941438267599881423465112523804707482828315168316649965301003974020258305280672271797781262619454377248842022918324247905069090181693176119558145 +1855138457669725370795603609175257635850787505475418783821961151316324964106211402480574231460442281436102848418947738954752184731638654925034081955953702 +540244355168038810439245856412365092477075663815074675095751794574495975677637107674742162091364766891790053303512224504116561928038681836474597949011431 +22981118609480295020302390537085998300920429526471726567398293023445956296114258286587907654003543675558782486527003079440548040281611791112262372611325953 +73941510060571769808707847667790966361814661795164158907944820368767039175329325204318632328932777023413894322006801235569878477004331269927355367279719698148339549611862266243948248034957017596288151561242678219756200772050065651639668126957338646741620454044238313630119096517295028568676012861463546531042912418706583467447570262205402306052654170522693798233816940007926095553081467230774677628419097478417656740275827661249952779211901082402701984013817630510703444381158174601539927553051608704757704256329593150815404929742382319437401751432803111155121722314969548641096333978274402305457624550606359775467371439424755012388172195256850392440613960542485094267479774582498660391674109469751118744651961944474483070585106972705876377013009303003480 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +5 +0 +908 +908 +908 +908 +908 +908 +908 +908 +908 +908 +20 +0 +444539926163396060618371891200 +265738677898336061407141787570363252093 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 +4 +0 +458477653689271929750159360000 +25471671292789986475502298488957923576 +39622934661811821553763744630506213929196932096668444518123439737845028225024 +11662422067291787594026815204283885427659195788081136348012846295902003920896 +196850617542733211416217278410575369737876420896781853126317893743949824168141 +2683172422101341871005722746258376340307644953044191751444605309114182348157085796971409744620711498580309302182985308212586435414886374286350975238144 +3484767657771443762420853002633790658478025026595023030399445962591501743459655114168018705061836715787328457528577115561192630399480939905028160741471812 +826369288885297875981086985856579353870084500166446900173411432842694716669231467968748002518734902939451616083284004742033317955616293179658208664891021 +22202087655311450647135419149250531087927146350676835345655785380157598138557194753184373294689489916297473124960377821312544654416163136210039001929744384 +96326898017422549955901653473833317437779055242533369421502155472853312686359970920631618758332572373344127788925685357338018927325197920383756639905996985594464076611884108612383979058239243581333594431766225648327089235187237418565994427057194424144230986856523397430803984945243481297655005737624265563071611038633687040642892633295910225235789013409695764507857108219593405978524437916413344943216420760961385716325465327198936950858396311435969338610001054630999456127724084117584337225975391887983455600569619204999635614531187357888356383792407464654357840556181154590937696619387875087097799731553278646623958202450683045055334559548014107490770158063376348589984756721663474292053996814484159314973841417990207095034106982307493862880629121436691 +16 +0 +491348889049443876707510517760 +26309649457780133338343455840727251651 +12836249910756408599207651670402691470189457253048470571408310293697570799616 +89957821137359056393801843026144645477720961240687064113356371611922523488256 +186628143002875342454100646575613221588500043779267673627434610024013060416436 +57810819572866260801492155256759413876483749626656973452292976127618654522846001818070108358802224938885657621123322444739974859616822961140014252032 +3586935919752527353984027215088868451772937854013928716747601409083300019440067660008036473811750553056666280422401084064457379199486614970622678033275267 +11435172354316143741773241295887896087133672859698695578907055835282817586890921066517171600518967766241323412371609567006600523639894522363112407210324509 +15149040910228070805694652326182650730845401534077532391632591405118117144643051256922675471878552887101021773709591676502861584900921169634374950540279808 +56355766588100866282759682860797737644333456486609653821690145061731646301509427532577235211073754179875805682373375444169056701023240723500943049070332395713592503538088139163641332470621142182061028756763699330098279139021193717395765578924738553383866433961757002615115656618107086139201371155417227057833294387363725105804398704482830941592436648716775980247000000269741607274596027979588268573128057345637713854419746154790792746601966483920954150371581596833034052802813842628620625504186679387894821638490513018094217182975985101634425625016603667727602990826149251788162518904458942322862611953393619284289193102324110779630113399662848749417489714492032695738284419047277571615136307300694250850975078143754035182602823410211073763907416991824957 +20 +0 +995158961158262555374402928640 +134121906180378853498930390838142450437 +6919681730812989105961680682293875199438003339556752544938537021004054528000 +111415284413375575279069783743044849713138799010818236990829948938800785784832 +2671371225382503991550810752302543668307773911036096851249073522360117594907 +3196717805164369921128204528085730572110803813535280667544983013152498020676968653158980718912649444544541678773084521623843027455344890340658923962368 +1238216679956500444264616028232887647747940490327785007262817775307688862239704307927037312429375849475227131933476467593816834523153314124523020288669761 +11027839566584582470519059073521721670466350661122931561173065258823257321580571220589430064206794766082774897831215317085884716390531116370426677289293467 +2022634134337910980433929460688286697109516578140587883097911933500075648632085115589857581520940210394331242638360018211669767050461136520845948293742592 +104434002006843236008977680607322179909107225265723195172106448264775516650476878743833547793134822307341579260328191748266784852490161978530160695975684513538749150196514786995025112319430605048357152763823300841556582239612109067728895698905501385995876685519110292901541609662899550868216317616138105858298678470326863134702237726421551517029247749909571485746296095446086931717436380624490524897483943213105857255382008413019679737361439910325961856292382954474416887424544673025993513511888208735498436773448767939462642401895140762934543757089989225250342650950389055472793689331649383437755553290743552677603436417327718879340225284742201264894059121415641518774058619813992793525299939440882356982132407391369731777608785484350813033980885141899629 +16 +0 +1074929557660986703509960261632 +310308103079793704575757950092990989086 +45830377016999964195415645114843325971494172471228418297876829545637299093504 +101060401631390047762632218125084929475187708866471415222687033363449381912576 +130474939331530224408995396282441784260419370120207375947563617259552477561186 +2355941672152922857080918796873312219472407301725598088408859346047953344326591361786096096705419672944173727217808802505470853131296892573634755821568 +1316454184270635300204354290028403652975569924791362044247281669809677739990181839549155145392827806973474851174980544451539377747682379975465127356763282 +1438923259930704879657001108769207409876637192084506601145086731796010515496862959970405934371385188574753305943073462813023599491372378876317837370133527 +3751312292780009820304966556683277538490745683704566160236438372682961982986048670343223416367070064938538731816396930813426231559274819821553090255912960 +22245827804735705220117704141226501502064071390534072443304730331219236590933359461634355480686062688856652758824214234474569118470794815179202389882960630393289571816102623905452982847756909044174684278809183441442368980646940944033452129063556227674889674053321140347856710814670492783918404567115943752242132179948224781036963934893498091336265346815823342522106301789947400545161838051916557443788755305106534416055804785880604630383100935891307521128089394000417311935481221851817253939762456589711248274272603968362800596648622527005911004624214546005361950076957837412463355621056287213223178075347444917257993070579220268724782785908266671543562947422542040620358371842622681799613531211436766739540220187728136764807693542730662249246603715717954 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +160 +0 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1267650597867046177654064545792 +1 +312 +0 +305764342221524799935332959201681860527 +43179616752915754651548109831528453372307533305539601542967080491130306953216 +17577324162381258630474635337405333643146914114762554675606397827067886436352 +24302243256145833886805174285503224697924343810958724170274784478667392432942 +2455073261000987918671945239574537486815749129964150471432702836905807585811396531610253905941293957332101512899044268740293992626007607127083491262464 +1077242566599992264249169571444336551411248487528972966637628471569432402384081668659908518747150256909990581460430565820193233307152827275575539899170758 +13073126603118771003805243197447306343271660677454831683154753707889268850436361661628016500641989777790467968280342772010149753216162050495370020985042625 +20998284069276981893190892536141895412205721732777582241948778013718640245971369156599887283883776856426273476192138787335689583588114031186267728857006080 +145542850807497848835319178145854049254749355997392611232552085578142798867040512655869746128273722688794373277401694240068639939714289029241882420255560766785421263830961288462589671284715213700259981420839552784433954764136129895647349608900424001098087782010788194049925972037176206755004721388556031373292370905301046483673732115270915431015370122027913276559667416729060604786258013103534906022354439463657079061912817809459399519217831107039092600535346674227177324605058446151697792280617616240531975687128608716128611655864852795243359772002145334023510826244773813417705825695275150689101537745023681398310201413740361940992 +1 +104 +0 +308509185836607975341692036936651238716 +55518020932873470218319288289245721296726991639699521321270937184899723952128 +112628490590563884833405386435939751658584809004247538619207709896844158959616 +5922841801814876533914360761483372163277450765372489528717658348886181069591 +2564817866139487541320504390805327358442199437592476952716613284652304314970931783459808490723737608880437784464822337666800292869999879039669023801344 +398463165885851265042497914635418511071393473395199568610621293995767308754233006664812655610002899538162554806154059048581305437649155727562069976883240 +11845528388829065193137342380492024118612741433871500160171557205928409375950091328760923663375034610212896359622832576619866946421226527978810823517767195 +14358105553296630195074581259093482904061967322039003650287242246847189245898106579740731184467142158444184654938258232190794449000467281976153220954718208 +29752262246259984678162071014197346968143136331663455256981077869842278686037898830681337972402546323960946254640523419175397824351219353528741213076338024666791105522838263742864055702639833923153008293117724612975777700118712172163321970946497599246107858287141120189876164900071195554149879560929714317726886802213377669062443329404613286649769284209181705417929996296531401439508394294295981454293915959331276279328651326916467814126531151303158821906765519330853044852025868724455596200247310910196642038596122167329758444440621256743172719588202406984180471326374255698187674614229475956485349393277466831070800337767440086480706912261115764441177598645584859965475859908792264470117807584960743322003648528490225730990797216523246007325125660813792 +1 +820 +0 +92377192736350021881806334564236622586 +30966933304654384056562480896427815565136977421206545694335698204395214733312 +82119970857858981914834549178898483174623261423734314091990446749364630061056 +17335345295685259772267515166522970642719156121663286480022840319361908909536 +2314109225631884097329071519390891278705119245506353961085436228554532183298397816728391508885600113143907388260489256179338412441709786163323932246016 +4631405091549513365618104032938964387036004178571962489969520427453823044584554995003585135178458975230639830757208179222570849484879646249622084312888560 +3444397905407459769678888603161852413323651620442902175963208412202586537665061311535470334927067187735566811052881866689633902610439151941964220310971721 +11022665256141102472940378463699540949238908279778600071282259749712264960911250408144499157327170064963756957223649027433072458668570655608803856874471424 +81919800719046671517207878533082805186701437860813948669526605848765879544474579530529213258319904229463427416500034980139071493540508610379427202516273597241143095130860760643788268993138393873688928382393660799195777113637555095197708201349107045094113568679365641988474973555339779269195693828793499743438153464500880227617361433873295240468480091950267597172415617173026834985248894403081410665165176999289507171222751308781836602163165730218190683421881898534701677415079833299850716047375983171219380868596376070770512341426910609957412762987411547721228138660322763891960946563558118043129184649038871557137165767859126740489391397423454065954530520094206892394931511879782267862690117117821375879839535619206923499907870338087896184905875270865206 +1 +556 +0 +132190390248470898896680912765144782208 +26118405364148793884093212339004353321168506206731428575114534916913543249920 +57371932048380839143645765917598495087491748880125189544237269309841806983168 +21907868082798520198592834325003250611892002016702940923441999346792832444518 +1983010347367670533586158746720918426725859238638826101738778473039940830888567731427474683445100376144146431698278643920358008341796317600412673769472 +2606640266791684811701307747992020704987556721798189736831558708134786779427826595516656788456057404569214323026273791700577064277010116095681833143649967 +13236721874325271723025473459287198396620022329708721480674722710511848773677038674125983763343329458361710367424043866874114509274517527946107266648826241 +2194764262264585667059858125941452105865892742975859841108712998947329687982788884647082000066632025028061458492389933022294535208755309187928296471396352 +57355845567277631605466891338726588644089168231176157542837482832445739996777264257736709708719870652751122872815779613324883278513875916648714007640679582725318528875933814419008616453081735986389172535526171417933073790237448684456371375012177818371017323800403026152821936870963289658435094570449606483182790495084679923580056098533465388873546412605658044277945663984045593268127930808295095416816320488700035120640634800027458402856427447416869101366825313425698561772279044096387622248612510184764590511957351321992760940588152562393870554012339866893305722152910751088759230319843257735303362591220388959031206648585192806326375249281349826218061542078179530915004289316383242721047093262796736375481154941024161803411599260123590363345661492356322 +1 +340 +0 +998905004448329441454522467488976926 +4927413081688125725138099137632369118723706439675800220006419132836783063040 +84352496855087273591478468036086052663893064063467212113548648838828702826496 +107903726561082941806970174768933557491971859433891364382659859844852394460986 +2319608449060187999684790351453024136538626650066803987926996295704247719880909540662904401039557482146640056079214446055684288473572080013990468517888 +3229174536762564836328011009025477898799910197080321024421312234854337921760217907684033379377552188666880062823173769265434474194314757844200157057703739 +1423443399352876324872592588473564301454095472277230446652620290446968276830664095418889947537872334002573975742103104497418388304230155249816071500187318 +13271987893729173924722826693052254951121133786126776376721905614595108288958742926463506237918989779603882913708829786515628223071604050168421092211818496 +77905163329900867420366537018313477469905867162687873813393972295483850618977227791693088449798950674478036536807908041173896960311217710308282172582393944149677514321195523061240702828647496809204345189326973455270189572598303985175508953019401483296366422730919952610005994556655769831109807353377091098573022662139773340132455526518635857168244936106911312371715079630324434205701454925506932022716037033236074043005019646714876385572906267836713196559389143711572457627590778030188607449891771267696070680749135917564518323190360612364871790463549758918603258303428611971436568217794166218285910235112620619466021065907142038809788800937452474220801409964080345487147019001555645524503805537058212837105068645433031569147212247780129911832438913883087 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +3 +827 +633825295391748780828659810303 +0 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +340282366920938463463374607431768211455 +6 +883 +1151402479073526177054249189375 +0 +46236487016914252810359942606653565611806735985113905556189104784313205915647 +10141063897320778511376522974043618320650062159021091584566880470490557710335 +78190442020038551706136595408815344419350554279639655464038299447602848702950 +5264101363851496851433282540836956541101368807777991293344941388857765825339723752116476539712642325105142882152577944513410405922445245546495 +4274984277410983807532089925150768740931153586735292491383528412859129258433112273099949231101888023707157602612028830310955239728286706980227996295680904 +4270974226494341897280469825731968602385022467387106892501039803249858350601697035152008485439522684257776791254316572547412071137653017182505839419643661 +13396349486729820333578617551105577176007659045388305976467765207187599750765003306881228272040491956095560694041316948995285357929407282941862450720407551 +41335482013742092607340811393696289265383491659142322933176202133259802321593681034528755929862481933532393128757559300673957698811146130096420912757069006505560092013193058114993341087169760011081108233127450523524951040608820702691804101365559446397551316177148051517733484177074821304382338437764467306979862063585555745663882763752228397056876102734020204479560221614187264418308618629620880123146215622627304037187875802728513960072756165523453677069766105888884368223266356453595038697920292826607321992884044691584622439589759520114123421788741839649085676566641773228464920934169309554870587864775049223057007191810707214225188647666288834463204299431877132150564481249043414298411851323421333913909136986057992835748995108031438173716216778129698 +9 +257 +148913685258606776538030407681 +0 +15737081446634197346448238543290111090647984834849920547563580853437339795457 +17796349368611048392083206935955698801625485975991150886750776582747396767745 +87042183171820405426823900509602437553981065786933287231059322442248803404950 +1872579959911606123270219006911173139292436983412774739613566899721054729108647438934586909747652198625290890899088832075544795394544595455034418790401 +1412681115817651652595578657596182058840351787817337255523617847758399731969803154217604617416738018019082279140815098858103221944816565427541047989874575 +4658367006324170812599422256080523502806559591300942419231897265664273942632706886970881430455450954648568107656318501922464893981721336262565505150036230 +14176910549874618607407657930219555895908368234965503682114333452984200436110890119648814677868732070859714001297650338292337460853941658691514163789824001 +3981590997528577985614013626496163269309337001530158828834919698707508463533911554477117533902325017572915525754176662144767060171245958294730597431813358362095749926259432146429268064183442642625483652372876461555552111669528698715632169681920785094541248195816649255512882995742569140939871664873643710831289778166479150632763297994113176828816163829137609722485397222557029388537555905894840696252924686455620903377787500951900791439866463151002257292062493531521259668828212238177466630166755813378978387753495507655220937258672560809333463242552800990330533067696358587513958431815046133411714898659555238120452857813163223926948860131697571033149747044928872650853564255699945166792002731329998286732647104143558910495746437412765192212775849994225 +18 +33 +501502021891302937219905355777 +0 +3229040287801688211109538153528907359157521678782897421936034456493449281537 +43674379635609232592374808570316762057057239464140599073454048485319171375105 +206574116687852983759940670284339037133974987477578735810964428283965343595925 +992419486452661222145984173974299929589195994084254138342964889584701966790230864615423021215758227245793655600475560820231442393114209491163228930049 +867054567978498531065761454390276935399048293801759280371014301861063097032842313817626802406894612171009202210526526325159367606967184116106222709354994 +1139630468367775490336631812613571548165746938068725127033848437473514644842035232747054391798198457303514508910901267746988126523368144746838663920634335 +23229321847788976756725283113649930370792069582610592470231250035730463613494249923319913356844479204498929051652932802538286625056745478043326957712572417 +21487647700948725770264219795271945319749173192243211453565596987241176737462250667633618886948279562252171101905667946094773469883315171408531140186855386367646249336580544723963373739798434897480106621747141407500552065611752936446513575255452313224578647762353090456207919452697909630833138121540651400661437851470186602006938775128954463677340497236474210542169245851888174674678830034001396086853856173586859326673017624988194867397733165469207954391033672813066099060448147357170672504662139485543607498255164955555500404555706050039769127136110940772239631000421580210911841692191756394540966716847875044874206186693212588146722503861824552180465617343841495586000134019723162576895089813808176808430959645984761484461706924153776124666379090009872 +6 +515 +140262897948655524553823354879 +0 +51292049059523452610506083592610024599583816874803914322375719502751486443519 +27936184963965071766976378876421641742859886164075202272073313001233759338495 +13449010363647692703508349667378797433516756740069562881064298383864033242575 +3007865154522879628838942692472346158555510514358321404385880396123667658951604878264737502736736088022367734668256726008347601098598257350026528292863 +4592124389902639952157884879500633941880823326525745966966661569784155220592348399170518240885296517746840773500441608980855453698091666787607843899145829 +2534000532084385254011173048792691142730414486367806853286959714601853302234763393270798424710144792599095332446397093107565422159020315343985501774159892 +15542028513463832582045168836396386001625310864606581833373826691519685781220976702479707834361513658452848273358428791133185408252751328679278502490406911 +27855593116714084078162208384054695954058993655347035442442179921961577060832675553361363768691284076718916857364752494526844926555439953895434905171819600393919839632321686484452963250758696733364354962412703929346121448165936594763979749743986180482780225609168629837008693038338408977887230386816779307922171459072440924593974717415489081076605422061521481900028889163041175095249269917613188334409527500605896088131198525624936674252007051575485702484149862125584208439328630135980638729947396581292462742088861126756410817710170706018291317780771586734693798945816799442649044357722598789451512849026273977421119557083044897445609719917137143831367136164117890467710418451810181780268537911406332672074241783568820460769615890093335916694542757288864 +18 +793 +197025322184063122457151668225 +0 +2920290130103280979299916267396345225782651892499153454132172827501589954561 +13539515947035890751742634672716012403055571371579065400912721307212126879745 +158307368218366335347174104263331952261761856873568291783365034272918926713725 +1815215034323212852396070290108011856137567892027865591453387561513196098766849400352437123459701948446227688759510102669983999161585665721657907478529 +1313998427018914497731975785557000192540482097274033470133500010806607846954570954898528158955314391602627353029912678650049483923494107529991028097123237 +3558766711272482011504448167665545486379425587311683496485361619290623375415884515332307272266520310480366471739749365076632262898225547952923293595733728 +12553285567146229581143238572266763310070996960196734618418238189114111487087176302379917708160855599798506766652438515952406574783180790667512374443900929 +97159030126633829597136097971952095447819013982449285765934773565865340571860394947523612579798472319543447250648137552684505225800254817082318510333085200619841378709947507256156769600212492868513841001182586888796188714995803932972130045022421338995588284122277277252253773904930943448321203400640850726145956154506701740238971182204246652277481910635653257716342505752786715299131392950755696825083787096420904257094017949450230308096656371015076532528700124758206739955106033591193772505444903595304186731720399187581590976888363465586491099855056851754180558610125245962410906033444380950412894133308093881338615037037363848849681332843054706412988017518927595434433405772857527554569413308034400064517677000618708750917221012796646872214754875380955 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +13 +120 +145483342680740634262446800896 +170141183460469231436539398536531279872 +0 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 +13 +588 +242981830122332196998498746368 +141543884952374228579411301124356217882 +0 +110892457497452005403581430237946183767136503117162566153549053970000476372992 +189155222634588421211288058609537932434095476696578287565656039885444474631257 +2273620924019535126443377586964826655364563651525119527623848142652704686460888155148600115764101538394624015930243455367013584122475807191504328327168 +4718242244578560577933620411853546035676043730739668011742858611491785678155178214146108560032528947886096115390359535573786208426628238424552910518225609 +5354055707309912886614410393569876624773886934053676926684306993550773407750553762949175437211369217571333055727536737153756343047932603108461352921558471 +25365469084896632438831937795363726978720559453448504867481253590410035300967847867532559492662554029011867176416570131146842894254418120377083085899956224 +22619096124871383318112295146842889073303814371605345095383233795170631479551746348815087421524678717453965509455660287838427423847169211714828596281997684789004627847353198055765599865486506422329293807467645077941773514592600738421251976380577575882032324559233081705659227219112318455656983110210809943601933625629880644853490850095007658538362417036453726855372348519767721147063930317955475407601904264304792774876267561255494505090533363568576267962083615004621048135707122075251747344476975836746644988257090294675499533514516099932667526906076602510814454355743316358417647066752438499266782078096470209967559276168613499470451000597854188801912120661390116619348790746561379486566757130299748657105161796124617016203782579238850942498672523329752 +1 +40 +447233008701926529533965500416 +293158325512187360695470417449441151016 +0 +80370191198978495857548168233658974342470488197481929432131097469881528877056 +57378722967569161858531872288267370459698099854972954033385237027489681458401 +1266685019038549670156131957936105569332778969355417709861995585153701875900859319531983550779488151228898464900331805671022343202096261388828403564544 +4007316844468480444786209097240877242135343232573279363036730296408578470321526904806238868824798952651885510964017728127623908601645102032546751410140438 +10809419853862469069424671860661466104583061712836069230246390212316112130066125544420392691125603322947467815628376833408555549515946984480656880021651380 +1850019664799561828446887689859810128523634383437118940053115370804552962470182093340221950762057683211340120378944062888849213207787569638787758996586496 +79146062726645406094125245786551837498939308900395005168244204631903484415658270158844664157707310955348248763771814711063046788391067524759221525529104368326321326084563472124318731918256168278623002358270765227604826669835435958891438295342434903159075288156677246336154439150755947520052886328714167256538973433346444421333656676210187605803784393721586492840057545981989309171468153197884162328945042603749066570005966624779093957794076862811092779063304321109842324091731703363279951462666574672700671376196246065961538032986903599915099739318454751915689195199186259591620422212377311621369407484297784432106440200065147739080924962213019703357438002437916474914343797507018762537475763362516037464530375045287476905864731829154079915391149321968191 +1 +412 +442771250107780063583096799232 +154158747942568048877474815599350831266 +0 +83509925808939041219467836468971382374645162274742749382395185649452566183936 +130737775035935455315064283330339683168756409303633081183629254780389959201676 +1434569753988477104238938016621393717922537334575046291954564311951618243596601987643360144150294172150115473086916074540367171462792383909655650238464 +1628053801365026402929640374014765553703071179544257678606217838338537677419257865674757673512650450839264317003577960931228650240349967706184064403237564 +9528330235712431695508651348872596587940214388314172729001944199117139203073649460506789237728120154262303033791074115687461447137304611451019062450033166 +4143685306341548231504887338288660968707624803700705709343351955022110657856432837240377395875927501705908299984063250507069218496972459859740452129341440 +104562740839673051503481578895764239526663080510065863568700531455357666811369786434424695396331208203674279431043760278050410976183787457855892806406288752625718864322157193135769794697567013312432056383089033459465930753275824303748732667955926341050919959544909694846454721655872047011992815813101904694198241623012881202256275588144302323618881878753528314530907071840869821031266325498114515282538879043478421665955468305417347448163949274702442224107731910630000156878070681872216439482078511101544761151961351666834740966456291969981543493720485639008116953134509164476604089589320621991058625751690463775539274052816775322437146286935605947581551624753707514918261540969042840854540826516277183600699165171925650708475149449313485973818422281998521 +13 +172 +791101013288846030830655504384 +153476591093627709272587559525863637788 +0 +16620630689278877851873420518904814002737213549417357007588250730268341567488 +135713742926877628027400301750580746786742856540376082400065882631878268256343 +2763703332326056666675771568612443973251095331788999459280007079557401109082037332230846287789955462113928953782310527076648915665904957779729505583104 +2824436745521083250434559952136747236272578919613634664272602203887075383079538439468738841849895882276490589513884561192461063598286468221544075155317742 +5573805721606072201024464091196637283572352485715830551875562715416314364897955988150179092473897788638830452265884540199145584775259028641318262487547968 +4057677748936070618844094810747404761610038515502652344029344965685330894561953958031306249055086692013728933315233447834639061360828462307224389794398208 +88805558984185112795255952736925324601122785431405035576602411741507621170399545249153338740407851719428060900073010468408821802935493225406349141834719114871624992935268626480271242919309083181247592470787139392455723749357111206028829838073246684382343203181677082339668604262839742742487557831265162674992762636154408019739353159847808458505828285614006445789755453887253630401662086162458718810862782531906728058604853740136139465565601302099053412977760544006397324270863858056884622177695713355282096557500701906162213797940826417474604859594028449742637862923899962768141687417119968332378928546368809483394380922906923652815578553545438336575578328749210393869199030932921031494164347096808050678532449008199752921295412645439010521079989198707275 +1 +316 +71681696331238174643235848192 +237948749361170373273798232100232473131 +0 +83778207020986728476145484258908144082269934037053254715152909632561590829056 +221509419269785716227233899606918240392102327497753358712085651922766861983551 +79315321146264542418544101067771002872575912085812381774279752184308118738724006743714953988893825146071572131840361116250475308904572550776268783616 +3141911224089662508005439140547996848411545433412668670184330989833051246389721569721933639157984163331306326586989550527910321306108944965118472936437373 +7056836934790078890629897242686908388561326030807269602244791722619134700685270860402176255162872248124156286310896170748542196945067054699971451991857017 +19653627676393504480845906820110557077219860495796321885850081681411361274754697849285945541928921052518914208933686885858752894441356909201046802838585344 +80971491865621906872687361455266590261837769438953920156547938816925768812130351125693403692372531635187597207678371546119842393999946368251808241062815009537201922482343834280217543563385790528991891486955186752804442082611928288446541683061339642049117523243263526092524645999730641570341457586483133065003298380514028101577820902138870910908422214978896149068391330152027315094631190895000724733490201374419942438095933050937915756036226904754356983169613998368095692094533690592884544613225600675823643506613658403330578865342487542362468277076769889849827121184947189187765093232341824235548721589704690368245210012944395720194265051720532446465158583188993358700221084102969580809093675283436656573224838978616518282441341625699723104395311464856000 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +296 +920477174324206192629261533184 +9284550294641477953059815425 +57896044618447473228882389021020048158893283581286713298429387432951596187648 +0 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 +1 +576 +394649121464702711197113253888 +330655358119337089933926862882373999920 +19171508671161797156614710182257630792593514679646789380628699765537557708800 +0 +83428280595193522049620352001877162940388365577102322638744416599597810157500 +2383427170914810336472146115059610133938440685431786051901133872674812685256214433004766571822808713024702089068992214313240618263661712821448505032704 +3543131743813569641335946273683240931826614024019546282265784836005828417893383322228810942263163410646159776819689834231870373605456177912242267705525812 +3201888256116239379504709172928241207634570507519243666267842079354934745091409880730742354222322722404797424377578771802961012486596039415971972097760189 +4721437724763666216912653616574178996088489462586407187533602132486864388960603129501403388719024042140502457650359696753171122610737975161314352895623168 +55205153321423885338956400064028198664777869807781110728609963023113127397799487072435330520570509674227424013583745810499657598526035601000813992406801177785654880796763619086540215022787992132190574189038172275832590358776861644727492756946966750658508989064774358448920178937939967901885420472435626511097953664008511962779746263834925846263368943609296037000961913781533108186027361869767679638534133572973581741775890124715963547264348199334411727966106430979815522908566738854258635779614741558605346566456990906260060286149956197404097883016944875962774702247371289156385212377503180483598168547092790446295055664483192046839671126731689954934743379048870609922204145815922015896815781635235421742690146908458094281966246581404186172173133753100062 +1 +36 +459149829216013907374855159808 +212514946886893049623689635030161573600 +30121405346709427309695531890582421791203074728165296179965859962342252478464 +0 +42435402933391614285072618340065308663204835805291910450325661435301593697950 +2723474109035793261196285209480520006576094880312369272827686699655845402902440783445003022414244095338650103254192634946547862282922709256827062714368 +2366345409847035124374650448074879585773647708631341355179263252964806807879670158353217088899380315556678858307117619065167384939975455280949447515369567 +13191762144369989130760985435688757812828881793396707694471183793997116204175863881278765015080350072806582669305591779418584954819749146010893985699341570 +13301718048073450430547712527884367748161420561064642294015103641915503834019416126543999762601710015216018615418920000282926562454589067268249095837319168 +49769281410460079587160175170567172396868114308017996853886640420533796807286477273833673204546740576725320996039722521612053833334969359392750604880174269269691563903355785551869296573598748844759330739045893089809768955601413769089329821698243159057856348655739971360896746872957056067463031995674345800660461377513320831790263825314771253934221261090427339884556900829469063294537348024008289581118375314929945056302399670691682691431742185244922959167693536920751966429893443774313559460258906531208397758280206465867926105953925426176615769227172870551762287519389652134919720196926711638429327818529325606413699532013110569630521033485451153039357638432468810344302542925792453000718773720773888713451243298922307261297537275224785799452209942707359 +1 +440 +111480890522555005842506121216 +169821875159927040016519827500463371995 +2219279707535425826019993588723715376924609733291444929791090369095624818688 +0 +125210688265252194710996471277583934881834379414003707914695928587186801398100 +2487150548049686483577986346486345896197470598544823109842683510353284256291612496904302366730404150860292761990843784069916754136788389949069787660288 +4665596396220733640168649174535027159196397070342267963244347648666006311146611981668674060621225920926771133113452576288300091774874699771692345174655000 +3321497911172409553001804903171022673679565313946048256955779288266740305599386551480119034076080803092083102364750364882135550956683614114559617436903767 +12793018574047350137248079672509016968931556367756809163171704828712247163091906244764359814474025125944855607579655662889196220595429789208504167192068096 +76689588434293201835619981066989977477908413005779753088866172810964808473094991876212777269773122696199331130485933575282270332735785700928413943556601975066482786096313163465341993412070612418928408710357145493143294698834250060597291905064146156670188605739321658556756932045817073412966209066142063156039312180285153065411311548383943716222450921593288580859391382453317396476747621728712240646643660359972038663779394318168094323388866014840669339297737399151832669131468852916425987004536557248422915005390001651936105161265315235641833312850786365439390074831681304150075182778531434833937852580505677817092104426326851552435105848297197549099189512817962975477262222108336785184201422735915682453207631211836049078758133269146887032420460663443098 +1 +192 +973066898438133470773494415360 +61333559381831070683658258698802878545 +53535005721204496876936515275724889845817409334527168350061458281042045566976 +0 +35340054082346922390131417025011886439703502295343037882213639103251549897900 +1009118888395535762047061721180456806194166614565541999396274651526674300640202434640874659775936931364083317600665242264448090018723165449003588386816 +2392526284157188505188392690013448960986950491375028571859495919060981215979514074503662055648827708202314679184721591212604079491336362235307206391833426 +4218798631160832202661168847672965043016773529025064083427701368151868437320716279368190139450621334670500868570495563594616568204374854957138784941027870 +483959849385694416988953239395437763233014877575377690428602005170645490229330810160206389562974522706669622381302406569004289640692782430642495811485696 +29906028071054660047981472687456811942854117777380291648479644593101403451134729390839923856506792491608604686349173972820836411471398517144783561852166707443288031772609799795421520218704696005881653249444293587084344906925582382385833765007518021414057245272257857513286192778815704104660157569277882610070331479401870391133503202094059866779539881025059786712040384113834568677737413823801351493948758683189504972649013495383723128253737143261767592099355975063319441155485484883757202590696381356714651681163927857735028516556612765982416921120650980465407310503954116569362383619864223066588196928057154054625583850781499498748269693042624253500111241966728384180291380590649385478398288572110568982422258266678645735032469585491009643093205739458889 +1 +532 +1054096356549212854433844559872 +295167673194252499689312720648542539285 +18569052254320792886536065199102429830591425911674802887337142847422563614720 +0 +97896720708781798801687131335879227111506109430789223376551280139659913587350 +1634009508410887242647804687779058371050929112656850452045994095398157878806417902701340267267910135426243622542827304902620893278343438781078703177728 +862159323782353319562779470318789629705961090965297342320245925680889441369443314188948203254697918300615698372425403937959274851949640461887703447193841 +7173051967940195554257280536479042043827601659905799457098258573897554700956880589901442356513658795342086705483095145011273200575189131337241532322688171 +14778026829432832620717758207920676238440861869481283376192906681351851826811501922740289231253685732115671799215873523794595875524613727991318894568538112 +668067504300992717252313285562626189380629889111341091830534240703164407858722452235218413940670777439758195559237384098604159464100718268464060833022755680567822699161005143840662079622723282636344452411426226552839822155973011916925207170513568724737127970382747418516695456246080872159505564214904491958943630974686516554785906411149419613863756391212293819449403644890970105617508890739662736955041010715658738393820032566014396707892742492154887137823040904306377096304751108123753609280374579533467459444188258347076611992904793838673073224357117654214880814370422705211653066712982927068215108323247838043982832803519373681940171214501886315441940044454283398151994392726062247895395190990157884090912229945700120937761598924992761275839959911906 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +4 +771 +891784777631246170114448424959 +1327929446201306785262743695648620545 +57895602960811796650871631801676582813791887579127636891104569893774562426879 +115791647579680518644692972256970658065423327120836162316857392245886991466495 +0 +231583736816786089484927226016147767929578972263620494977377884571370600267775 +231583736816786089484927226016147767929578972263620494977377884571370600267775 +231583736816786089484927226016147767929578972263620494977377884571370600267775 +231583736816786089484927226016147767929578972263620494977377884571370600267775 +231583736816786089484927226016147767929578972263620494977377884571370600267775 +1 +43 +597446603600272666897934188543 +335986975837048587653674597853034419125 +4960875119562861993119998040929006214931859756877807299872704131313015193599 +83869314384839239184918994159181415456293389193220202757469792852202756243455 +0 +446851339107039186419289111745794461503166996177271801631416983378126123568718875224988495884755883200400258616355472950696139342262717961597794385919 +2457416883750494183832570853589468397031071769924709837931117427688509339888648917495080941417107639148560803684251898538275596934697939251488325371868124 +4104295260045454815975181617904063417540583687524096503951973213007375671429493052370291608008405377354342405201451646421020861407202042797591936611216757 +5398900427668751217850873803494875937404578551752982184373461962988643267134263496913051856036153441820443871129747572123078186712219756428262779956232191 +25531520392182917621337740014265445721361411239067575024230568347946075320398830026544382853557813619997106244783404600602273843615454111971321802832323954204758909584487837377147721299793435780761645822065614232271833405489542021999026595034251288100931732635677680664415277285956289483074905242080888390451447804532057853574474532668157069142722357346027408682960953231102254815893377964988502569695564237724002824307525923236722261247849213782126269361908681141220395046844058912660486234093554490328216557221498188571532941534379932605686821928769598267882437940244043304208109576414850186630091377631389750072498035265207407367166886810022150211578030876848768624043493097838663809519882479152575072930049411429000574417439368689782570260468950650236 +16 +417 +51915870197464503363519381505 +252258564697022016064972069604476995730 +49219110417420231511113764378238860427237875311237523872333835875498405658625 +102059959947892163134217117691190804610012473033509494849327043219849901768705 +0 +294741958829571476136926871256484717091819171292816858794352010629523393545452840612410539842221513608737007525936314033110034418127477704314176143361 +3610022075817249902604614007613923579547402226882542852635039392814912818785402413253274269359316403441885507203823787712636067696281764519975647585808036 +3482683400560148150354019097545843271463498486574340530929160498845628623564983594731900657921818042087045491261078134766035389271551015123919424955561779 +2250865723942111784039421608251851432625547218473942867505887413831061852377508665133755951631672797483190995230665622102487996363019684093932899173138433 +61866270620994051976113571314671260206546611944748188112014889348493817466332260528520301269300858711370883733353426316921882265660293584980654356196771813752830814863393751514205166225063928375833366427041736421075638724317146660425062918645164125281670322555157768033263209921880226626073745938238353561817422240921335470283332639617981801975929597376257248840471906471329807309263918434948865990118449297463830076205345681272015774701876996655192982429160114187749508187454482524462594626273643456933329535616251439094405771525770802013707141754927319091798774497135450785624609672740195526493570561159214371152346595992797266701839077640764323028946890797349356558919797888149709272434268684802587758176996374949295489035483716749157376093129107707252 +4 +857 +1131685075580794109740493832193 +5591051640426086522729162377581522820 +49306867245429292665712135123169680084542437782148851479415184718925278478337 +25169675183049498057756995668265957449819867477380947926503567596715595792385 +0 +1542102799772537760963096697799266983934002048485565532539213661192226994429815251647197396526306187090160124800082409862575273365902118268755683311617 +2878686104109625229862354165402805665509620736230260577444969531934998053988812440085505116849926944621437581036715525742444317675163909046866434002617548 +1408524625048880495289336975458683532829516256219036238078109087870567897704916529748103852417398524574297919263661719753670147382638802928308999469587009 +4742693590966914277133482345622645931210627503968707620206733070482049794927860629080377711683265908227819055370520162972241526589942916768449868513411073 +58802344163554310313574978287775834467784857956644339721250016762118519806951148053474140926585685356202298098751139250100138314744225604873028679176491267298420186420381554202221786287213544660030226767383015807559348245256142726358221133944933425749923349300912609238400148112724373683122191718105736524831375412200353861993290888486983540153608895939442657041312429531038809147094126680019476596400280871477208987834492667531073192842174453455717785469219469725823299580119557925326668809782964063680858296559261638980508105364447435571398293447278460758141749296222837597474374812107194809169603306500140846258516651419124556186781001627564581437597576492697808115604193821199848040052454181045801939393118553214307066690010428647360865710351313245979 +1 +339 +813911142051622544908469927935 +4998080979218566999874015281917916555 +36694329931173559945696159169023191810080707655034316545018050435414281420799 +28634157081599137704071405870600522487246030369305940433755254306653996056575 +0 +1843618193774705784137956843790595835260885788482623306691425639970821561161960610834735278405087149627169615102857943696661773073162375892056240291839 +1170950137596410394079556452052007744667922551742356085549311726107104621063174324321159198410238181081409377899289339696505183364108241398143346683397274 +6266577599180715272643179829794667116364415231701874317566806045550798989424764451453171897199722686363150830763178386494247478884029147366386550475745174 +19499454418662965629802092201099350207580257918576731805737028058666848388525076659636862212534884659279639848323707620894715396779028548909594207393415167 +95862489324824888829063620932019725852833888164695526035022601535004945584766410932268167578549527575073071629132935713944998316919046789310121293504364041124532277236430262940542378173881448492913176491387398844399993039996789279577857848174346427604815454297671230985915025331674992916594895826262876530913916171850617716151441278682147025748960251878981479156374083721491872710427295466322992846907609488745954314715805957270283666039983078879793824466444419938190163155697145898133079802602602353722225107790055421648837935756995174223043214034050566670542186485923300401095619229934254702680429337508022944449649248198288421089834753256140619932771553037115981281018587500510997229178929836152007445007528380951317241720020980457731242414544349924054 +4 +729 +828471727968036044453779079169 +246763246873648168750114309847746005595 +14797796466515082470342263148884814370442076847061299435927018837432355258369 +53523753874056411494904927181451501266586517086289761739581598242912772030465 +0 +1610256322768663008681400364814073486033869865214932600830364116109232945229182624979010068028626424299039929917408136658184480247613110744087848288257 +4982989173773022649022397963184917180752190882657662748886552370901797910421968943370653256257967628629024664151919676967847090084950251857702290490980262 +12148110333218384648436139282566844904693423767379435822469549432550659540325752661673352721491851141598081552703324243494124595306618572675953315479573797 +11028869767950066853862903870251721369434866526464337153519928986032553183047292589177288689002878431824162808354999536746934113300550015294401283448897537 +58606743903456547221900468885249772291576952030679996097498477009743844995676543590192758644724090079751688530760171473541897119764421794956010728429006280978957388951179210589666065046283855669298206903519798531165135083505723514843194432031489074993214637785036796024933827363001124388230620312743627491315719415609068813186688905104367027578284183684797889586512143811049534490660482523966026899262043286492254927272738622395074038650865166965903827122630152337781020302738480811674375797966826600289037875084256686503563207679731661728079362620463413234443568150076382266727348860029360573126873091558335717737879504275102852798676585481840766965787992022925191117334050737265596965836939913217442685101717248568268676635054625934454260099074919309949 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +10 +348 +734763819450510610632565325824 +83076749736557242049732541826465792 +56086793224325083479877516880625996376700331315327416568653997679101469523968 +43066253535244233026187978142387001755402803069145978156050831917314998272 +201496559500976655734260440277137434576370058288390243702942488773257463333742 +0 +3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +13 +684 +887995200883511538239500451840 +185744035486811956755421374818265305947 +28022724762678085694347421423886262818477620187692930983847526359050708058112 +60066058720019429804858835809980860963604546002890479581904231770820593057792 +140726188198724864302983488206145216978022023086026367060204697866126599261742 +0 +1306435882293703054785864617754127645947981008635081515972982328252373992773175682602366698784049948578438144756464452476167658757197266011674411590215624 +3418924933199934873321329948743314146142040692630731923496865500679236033474734183436540120875605867521473258874285532970466381831296084581446997731696468 +3109273453047763295057753183837237869395959180214923717206774456268927599702732452171437824488600294111292564013762251960507352853270412970588497512497152 +88977217200146840664835987057871414342758656226482702119455134566079289759461293111455137678060305324123924650245282618632813746520379483136564091907304118161505302770042826556669491003997788040634250764459343012372640895868893685896302853009657056166286847643764352254944479236872120415948809439964977244216102420715456410411660886545767779677699315376084841335414581647517102345454786883637029530098791042769144912151097744363218237972900918795095222036559877208914398001283356608105215340062508789546403610568009222203488753181052446817053481932306339868837058506301443562692349864882744221053904653187414752280043967264954580774211209597627575080937932571575024581567429077910187545227659810710158840134973106598283417650179109728601466223548158882854 +16 +284 +923020903585570222185243475968 +134595118892137229728955299113857603251 +12517788472856075617475369492923779675790060603142796585343152963486180442112 +21278317616479394781203625492118767183546382422255138071596449473207327522816 +37333224946615587454531558429668776609410791968643457941551824417764439077616 +0 +4365216629959533172982077795378474518196312747569830926192625581814797043834797277039496659650371970445843961712911189437934023902885370155197127447599587 +7786275362280256985096504919805326940788214494037837259488750879599254096754641518066648702992692840392471672645638933505566197966897842107066681649920912 +8618362445903795498495298150872761763162723533326999016941555427533106887247180867507912332927251479902784257469217137485980295377407380260430728522629120 +16490134315404647213406475029434823318168374910390512831510506183043332120558830896890815596494806986512558339133075794403795234456629635255196109630302274063596701645127268499059076587952023859015770347837308708846781657401257233464407323703928750607092699546669184153773323322475159132438875535982524264435538020967649556545078439217499131244698211417633902347244248116513105556404055186363737550878189887290194234432316841541132142640860294449814887861397238054043043687805797703480541139181008458487452494632886183551197864883932104816574402149990710531327784104683031823148067071502782716164931902527187266922087618072262539701943603716347752849105290562996477056326299873601871677329339992648973891648562337687129654590330095250352862403755335743881 +4 +192 +132781846299563114295034118144 +287795638097315923177133982791898021661 +41260134549646540530567879497450034797936197027784201139228793125077872803840 +26725487537631090553213382951117408090775065651640692466752663021330299355136 +17991000660342902270761827603753917202037974525700770708412111282505637002686 +0 +3944008675763809747015020665178678882677044257366818833894853057097872891661745300374363390097768393910140535804055885471681266094856681311889793405842943 +10432168002169925309120503644722046609224368185326214525537866102657473676610157919783033661419495704812662343601179229565468596161053474859566232729971168 +4434125550755468286273915949559378521845137875362780075693690876557539422008078027298618389135234122502995076657800647221775819541243724097410850717958144 +58879788797133574843674131226486041883043037064364921634336146348882294403645081889149704029388967907656933395787481771948052519303852184993397307363710467889468536203573018705713826463259584860520796926335149895942517048054871254750870976735849529300524514232108704637780155141118411244754977929687460596842209901839253348640752544938339746749766226819465849574267355287548308057135150017728253762852882959593249872280268600100063435528304362920475150321014853691982290820505367135397257267603891072223573315334630909168764996403800044441159417477437125537149248656998496445381127256913909869799043466504230175983072915172182868528863530322908212009681173652253736821737022441593015806151561237138209580283454584751470614981673001307089147844396118914642 +13 +848 +582024649450436441833425862656 +96569028480694229617495306964621095513 +51864362273957721702450812674007399695894707256635407766080228745350205145088 +42338700632985114555032701713036006818320082283349136714641228033327395504128 +215954730055182411688222939177706107427072066045627310771072503279957579162468 +0 +564120810776501871547030068641973310984074415468950923614458445915309234305596816720344025395793468749961903973331424982658487492675732875715746581881639 +9512030017005233270085163286414408214444876161604376761868292912053847917535106665754020297449298958739630340441868032179720694634048588859831514895174004 +3424474661482523359099400350868558228999347406743051468541630110333927244078257761445483195343636488588952518919760460591527948463291377508337491634028544 +65118227872255208530978095704531485836531791966226954070036062366093202114962831327319660285109455888197133761203512225226041875764396311381690994387083960684631953535071227406811143021754477627057151829718556492631789876514561153094036662960783881750912022065256283109433376637350129397107611734206091378876306623078656111427158121771687232263391493393488514266430172677971487821825458132598600699519022946978758903380204148370574856240951611086240298576710022096482000928787252944656591755022573584348378606935374979005737085171301709078465765360521191167661768604901337941395774664950252681168911559209068972333611778924289152526326746867827632109174629937032521660350755374538076710856028955052886565380305045312456930204360072005577652223645437113583 +4 +524 +580845881975944426787514089472 +247672215531302623220114886854143351291 +37388457217608581848439794961125547405280755409544281555421884293853562798080 +6867524968084435742227914739535272191184841314026237436198416499210501226496 +37084585770552631634036071894836390875870489411136211932476363892010270509161 +0 +2060718003102261095469378358151405280518660285538331953442371394551388847723544748074563153067316177877347237081738459763835643097859427740490945401065896 +2427597878315108052588416153186371822454229878691660809974423528713640874637568365876246285814256304894224389434236414966957500210729605332124313726402355 +17899117585006203601483637166090154016991728785619486538375724587636009980913873117460186227173247676970981855052572465455831400785016798907992702502043648 +82719099636401478752972883295793152872271583273831508899385879961946763312818213867448814790012207589877958696910786352022004017128491458398678502380092727265352370894849648327689817089369872665581355167087649797725569274446713910131583973239774555897530741710201488112735698863245376499177657901145733481399797327393996328870113233422246097739699922081427164348371229969681257982602491765348673669982560870277531296394337103334897894312101299211803382899983684502590889160634216771237753936528683049440831694982760288677341061831863338447913878280666371538325483664952174202444434304882598014748667048569192505645286173327534029793348718165869908522264528261983539603039105723499993523931967046987164591154463040088382996154836338979631948658199465914336 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +455 +12835319081690733822122917887 +127603331931914074262646774143133941767 +57894298449951398757252466847559442906950400042978305056517893187912714944511 +82474589191995733226059000413673369947276401483368126437014470136553367666687 +1725367873614246661397681099761093360336884063153660970896243052915304594387 +762145642166990121634319750876330910924084988636669303246807590962648009181396757661856053558136824594202566053704052044355748404436481867775 +0 +5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 +5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 +5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 +1 +455 +346299262836863942390852878335 +124566106711135523024142034815609358702 +44045214583669272699005754870852537422943743579723467162109618579770773078015 +47191182087471614723727659086024420134442459808826251007744893899083683463167 +149345394318679384540349467866290540580664685942593858325103856164763257832712 +328659738499559851395369286572775271201389799649696769367887874387602713649950541005767198083760164244451135081042951771979928777420726556841593536511 +0 +6499574949616620637580116906143754514426259529884439117780273025054849187451370731789917263550769050214853609122367946205434263410894715910936878759479861 +10124369117566771149603816821574722189892029783289052707167197978669109873476852672835440349606345261291423564961708638702389275798144171277206026719330303 +8705415614578401703439377544034032850201217707644163347213448385251820480402064059350202110481875528833463043667310923822604441385001445446052708783815053349633963516466471509187688789589316773369344615677792826626309051716580310906633140773315576308672949910323971834475319446949557690005611853568373950288360968175908668687766510861164934214529777553732432896865185158370237274446566279159090124925721960076023134644068706631984582242437068272120041502784115042808783006043527616116382358734970451299287076148174547739692786708052816344409042256904123745725458827196208845706437968200534005237308917033335162989529814740197634204603683936920599194317277256865413864485841368194284658974110212415023489145311654329202564690552488285659475304098262048261 +1 +1 +1081180894199368861240340250625 +276904095316794738679647588766540076161 +18514213011776190595773191080849496970028811091221965026218765069756819046401 +95073983698370028065196578355547349954385319767423967546472360718799690792961 +6693017956846532764960681557697229863590470801886832055562479247632768202596 +2629164625513944344764393375912545052754690348620826079674933659671918850737622014550902801880361819290452858809500518180554683024947040651570430607361 +0 +4137577240563885180314014646510639308253117303602681600936018963727274657401877961996913350454564200277844605264306113013779943962820037004955398417119598 +6012634743225204725211101132320048969685865768619552174466530181728480133292301029875548285114373185900664580122272341980596861811413330588763908353294337 +81795937119532106335414628142007540909977658537640179159437059236630425650411885370326187121444740803210715500330984022270379288757433204420162387457613244457267982829771730115530977365339900995108866087275312353663936184818179575223977540191631985263739097531812210312755996680822466849659356805615283270271559218883156442720960075373128962323225954201545893321230436240679191047181572859564297275606464598132233617134504193123508950148217886663754637227759657863229014333138561206386634029631981247244317340373651674534396150486840052283462761691683271761813123839124550828306071030249616370906042368728428188678275642758172811081689374710468896615837529258853907516810148933427557064757233181559122827774230157455801620060265635590458075393637334298735 +1 +1 +324956523760712896376838553601 +47627363697928134504927977366887218436 +33434307187530355896632894137563272179790850372650630159758741607677205413889 +104315921941200306811166882397908923183277873670404242656007610443530523115521 +205533708257112897495155981027938658151590718760836138711462112141640293797081 +1107909686739446306967869518645944435031236156727422752526394105581762893921951275569530192146029955926564787705997591876292833451590952315825059528705 +0 +308755345928398507077827126197262399264414124207949539753718673573534243084848112587571000480595914906260398850382596175138781946603416961836963870626141 +18244350893087399850665188670118991037975220133032205465990746245721929325028153136705422106519390226837480732385191993725441112016188775082810504002928641 +35497041025578847034501100086073209466536561136508516335013344270660017935868859278315896598293856322904030275411384771746298914220919105038326604256986745062645190294804526675489256642809751675533646043594633436860337913053703417141370429474001608393015936441508400591810630621128843720442719169952498841878428043616134170692538798672482845808628733736912222222835494868718990850193361338659654698100822633175501310238243228627468180773090337145705479830831741295755757245726438863169234409611568762132507269416198114830241213504234567974880642291566086992270545520441074370195803131662817790381334873417850159055327338002481911259609118913167424481776413764325684911684692540815623011260021939894562955348430481298027007410284302139530405351967536881873 +1 +455 +1168225574662879022832991338495 +57044890746169261651982104206166026733 +24779217388362851886903530808112954986166879528618678581940026232185554993151 +55591006844159235471682881367005599231961414654778243528698592315005808410623 +196546087471840559446390920880856282064404926864490466841380522742929941658568 +1917639872072259012937469746034134309612115999398820982521714520910586889626920621215182691543587130631234794290116996439471618261125269461687047553023 +0 +560629320288680383605194363023384807151678143098424596613421718363041709472766750167486947243276747104145109416759625120625677741081131727837587049341019 +21759673470171209133072662941401074809641596506044027427359195245599749269615278218888544963788731822407161900052925229605030503595641862078189438914002943 +48914350145218439705906568672200367796969287350938182949379654192199011505216869338061795066404508514409711613257148436276038759959294510097071327557269961224657233124533675566196627680457707248004848068687893159393201712113146474154643723873117223111183020680896585619246094543573264302805376451620772423606446526420628061991035935289820171452375284762441434380410449759463426756883286554269235628531755002958821353224373032342079546971516226498682559814377619662262209744231352611522198524332131765194581996840783766846255253469180547953962698030763012753169497800349425558331288444588408837283091960297057338691424102975776370837552120268251157155308653220431283001956686251393146283998549094172293087591626540060360218133822122308383440495234963309922 +1 +1 +87563840629716667648756940801 +32581458921182292884541920892394116196 +36836091762090661553341041736371299478161889753078991612037085885874369986561 +103386798190572160839245264014111757730316335866975469301775408799589041438721 +230979096632485379690874166782108500616204584679462971821585472432375012098081 +1175849592681947186381704220573745682736611171788630769140595898826048744669637879095677970676093415500222347357756142334095120061003014283574860840961 +0 +11889537611764019713474395414522017738805331131412830425961734413527746223621889642851856767739924676858324754442498238690013743634420772752231361918208575 +10100837533498068062116682421711269237464416549039194254318934545331492474511664814492105364025928254622293940722169331634657785497327849544082846163927041 +45253272398683486503135647480546932526735137482648983772602319829758278426282326548221674861255116095426333792573217354680883747412470857180423146853304197991995369543158047208601197540622717356875667661749000843836978338755449525157032244963760117525923053553081941890120196549770412880975555360904557764314756189571080933525608936448614857337235318443148692573094194685794107280259285183133505236685396056175003692596478944431702441646328891039761273277929456060982061303570556186099371719749726908630462163994404796714299891926613959427971511569286158738862769695640206622518511417148726413303897685871409215510922897034154940725003238330414715650272829271341547072549019581775308154038128433212364492506931128167734571430916037205627421756245756464875 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +20 +595 +182776107722364003135434784767 +281466386776064 +57894277771803943810359491595023458960167522338927730828258057680034478424063 +89555305827206481420887328961785203324625996138257453019240897699860153630719 +31072229483910585358509303280765563029411398133731077240605874038996845471709 +3273390607896141870013189358366943131609359382662427080975450085374873026606564249289725539410814263596351691407518053929870103702401568479817676881919 +3351951982484124983609172268969732236347481510662869536744042230485685559782341996467619926017805728755414692283401971053259449792684445385138897718083585 +0 +13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 +13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 +20 +99 +959889322504300279480128110591 +226336563431145028687618637822844548759 +8191728281812111000214169178820381725838839982899041198234467802159092072447 +89010858809825214210137289255494412179471657721652615002925377757309556490239 +28296599574001589588954577695238704244097106391390255507549917926893049677184 +1143685232425095012373289446686042380253702819534317091382577237068099768813347351859388607019602275279637030972001139645555685678576527645905260642303 +2104386984118747727716517063913738816025890811467756992449715776590348174368338808503581044664946651173257522380822233775261192222343142632013731451133938 +0 +3245766926972643552330628549049705392854964955772154252338528686239084242071182385973867724746592501989847967320150395945141828002524173519974765401473023 +61080681645991414549067490692081334402081972397971028746517907412877430173442766887268502928938956689855686968723305555144818285896267263657710942751602205704048358528758460732296756008804811854842722305639692261245463676201421427021692640796896111199503032898911798682259054437677204216339229172434824743700358776298226543549612665706139787699818996505261338813388342911091730404851273471048067169751352130853775192270827166068955332150833437792442149070397683322292273034999892709561157211011989290641892339659870906874678677504859699231125692278719325534934035201975234131443854930601918538057100277806802757327886696961876993004881817336740781448664573364169350407114702705902813993358826145855515225329878902273560866951736476611475090737818033988659 +1 +853 +801006859139436247401554247681 +142225711339612348039388698959539597716 +35410378673742450051313678883687618704562356389379983514233123876029687922689 +38091574202374902858714012832961735959144676797295175057041826999843956981761 +35509638606720435404002212308149594900713246317816589861892489724156349420746 +947006889763449443971526094184752460089916877997363377410340189611125125701316093754306776646584059092783200306323088027637258553889934093760610697217 +4220939006243733889354999574941943865608293932174863319944209124029612039884827143990223224550002012724043690083235647740267932838159837905350721905177008 +0 +9819440398814080363130785191409752685155104538075120057014007750225191492119731772827023591993721591147390320845851382883568011993500439254883415399333889 +7122048118945560119316699160720553961978433028250832356632987064632178469601289924334761716843864521194405971422994256309344299128243345780357318179573891332027174794596349900514436964878897341044541747221511411801379936266000034393130953351626231473024446300205114809692182751681382918793815319254538702558176147904801708426647532177700676433087822991182959261814482654296867542907531806086418523075444098944989035965323104111587337986738030358187241743843490343789019348630402171936696201446676114242834126722172863968855674947640604324144163958745324958813957622562236693952102477460729523924597596293556438095619187584135738107568196111010905928607888154445077963655076780117251537706889532737407608309004227600954352302398749172691718423958455958196 +1 +673 +715561516884788010108823011329 +286119718739330631910267662147206086291 +4077367256260361378876724861054846658815066802262232907668922921382880215041 +100388196731105783095258894359755309057443209346921752384716203296701221437441 +161978619973690354040532742933073207830461397640286489633556474311275198068706 +295808498796001041580957434812431144336907268953236122391222657342664931238894722072411794573977944314328249736260072780418263762201867190982817087489 +97407145078903878701182151565338220720952838018650765330450334535905937357373611965592469739325221569980257894281512858606923275277875824669884901395310 +0 +25619912338425179981237074026942021799265536991310528535894660424287880718210785582129672576271686161615856398250702958965821900733894974363009685894725633 +76010139396677895110827272325655170735073429812754244224065567827072674955856932119584786811151993167167501426583952464280371863780796745748456052461411101229527995926637941814484628183648009917423519376707821313085607510789924117200421530001135073989351921094438000753380349110659634417761484664096117454662720822651059990956245758663429700410864387600527899115840834751012921946678422566816724884299415039620785142784776219585718273085355667734156330825330852527721204878050664943807379704377280623463834377082200575952282427801903821552563762553924876437863681217229193327327952063777869515698432495570884538697893963662646742169138455099039661938773403989337857498529351848559385557226317341038460105140266809753792447714025965171823132637111727103356 +20 +319 +798574734973800499883498536959 +119319092661737199044961145581817753859 +41294191017998785012725086702072135678398504724859270409452353997253994610687 +110624822424825875387330825570332783320826449688572761060969648171618999992319 +60004897054289201390963390115257285329375358987352500183853788324442296431274 +2150478234121502140094205664847123566690038384648319032584399902322112031029827710253123600637285764878597164636106830261747369442317038978555055177727 +2286371016578508441121921294709678407693328940913329697268533575124016682365838296403222603898047913087019704067878310158113313849417316810388464204629572 +0 +25671226303654754146969894507457657987204391426702541645624778236755811429128127378887919394161592482970532540809070418766878887011243610093297304929828863 +15866606951591235556409191617213573399155927811878903607694869739495905400678992644637518436029559246426846377785378587987926252791949664825152889115083598102400393140235120405417417997457110081090628306335598171967679981092666003385383325972859314383907768209172868582249740126281615082843573939589158718380155501844256488600077946738820515383460955868182422292129795992585952215505240163432033184622635932548576865649973348050288000788639331974785273445844199983043022304855363518084651671719146933165057669295305321544071196137536533399138481915468269791078767728614599543591551954017339053729475630770769438637529489889077938682440068899125495245061566733534687037786573509633820482442842532515449103712758325050642085385733732747184720870296336579935 +1 +337 +1188247491006021359695801876481 +11358522768134003317334293217035462861 +6973218261549576848638199934276587054115075947565903430900153448684127780865 +45591291715308727736165915509600830342618838112033396612024233841157189140481 +40977506359948200822020517638847374989428006593590887799032148830447784766831 +3158526125081113331509898514788313887509900397230108802808242305275074329114995683632326747175671847567894522724549111521860848666266947552987433664513 +4584447565436503172316825244033692918247702864479587471557460110462846155092582971475613387484731203139053010262859517492416070493565968167184179196803079 +0 +17855886664960195299137683256225599460539695469189441741138167148311674787837063586188982923974069115198316431121434733749422291458227574255634138536083457 +59384566358794087713519036985941921971727779065663226676982961995154491198864950156674000316581952280716214848408093230901933126757201868871641534753628308280252753935126431103884375360812240262365325812639199087538091382144152792974414950141108853217718455335529345676161916298239217369740781198083301965528295312953779809502130360588408271070396938846868179567129569754220713703452395001463867093290041999114172263915537606735392097717571719562218093690326215509153961064259037323365352677591556046507171442020475354888438981613944670146542909526903328992226020955963740333419878396193097750885594896614110979159252979239707405514132990634945047790196417564984004506593382912262142143958951256493283696186469568641746587438284051577412867450570462631877 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +3 +780 +899245128272588436190215012352 +79382824738944801807794176002 +57892510978869681736730162220291002611042557329170362915611609916721313349632 +63318549916452990938470040291368379201286383559458191806845672058759835287552 +174649700752953765434988902296252491183916410461948522823307150782111144039507 +3273390607896141870013189019906287111002076719299707330406074198757955051929170942113619750485120149822099821188584330248544763114365430245700361256960 +1675975991239013909235918173490637855139324507692685389812651662983087942796182042459207730713681429512584287523480954202975430917613169254383951955361797 +17917957937422433684459538244547554224973162370938960458267029029640947834979519339152474433150005542914 +0 +26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 +6 +704 +1177162594896717752709689638912 +96077425054455585888525548032358255307 +32860001485564213363245573215878063920603649509172460851204817722599339458560 +60109254545096573330255392159285415923549233358667844961269905663499962417152 +3073211245680220492517146661351308979695018043393915095083610251485928253557 +1196437601768571072681596644798276004178149983088278508148600069149523733201731793704103372368213233390444497494452110276684749064047644093326087421952 +2038636880556966905914764363156480651959910168504797327228316486248128297682164213768446666903998086070536989636186162862522556977670168122610463846604180 +10761508670374291972420269797715021028414464448240558938464987728552613552119689435329519427607648808039987095579973579961133046464353196386286909020663497 +0 +45482587854271028902770817885284143581635498662368194698025977352933743933799189109901017793688745577594623527694595604810313504358764575860083386515476807174987923177735804405284473755066934183256004639352108484702274953900333192385269530392210757684450187112003674444177836992150333249054702130799610355040881331216089333384447820718988928025554074304355567887574813315506152856851669230184726480128481499268920312416866515808041382410378316215204974756173877802603170296930710582089613410137158337317994538564658188439011523423780823240606329841082961200433291793972091062343918003068165989458033428353216141929996068678255654039247693104366764606274764078658617636217424991507187568278244109935035828898609479518101929066828346725868624049272030586043 +9 +692 +76435178552732951009197817856 +231982479817395379926203139743231669376 +47577898445412852300055548317787946557302802230354890877227185969553614045184 +94970241355010768267008081913617218797759253919929280496382103858739366854656 +14056327310363451370485055691408505290446120500764073466549198485574965172326 +2766964662182057386500329725111256292868978381151632013212396637813257618816895179949288796855976654014890661438562190344471725761340854297277946134528 +1329225061763580875918533781650822376275620990297295670554223160059148641553029627129765204098380667668821227128123235735809087554397139852326517131173276 +11097141842847614394079602992178709247589894415852402133624794662338776078636709858667481909108996684238974927213647046033793578164937980468332310219323018 +0 +82530710943173231626463573325692779692754436886030672265032417122005977153566763311330845411954261860082611069743371135724846952083541297125118407037493050030091643369219829324270394014943329835515994201433775828649245506299733766913929800609741182391963525575197020867022940715414622480667671660318214941584751533775381692208931704572538156619567358516005504845014729061861609309938184807822494453768234138312147725645217994821103263459723465254832283850235782838705125412229606677970164359134170387049947834936747341490606705964743350233898238752785281953469479577105057231853639552966381327604682311651351459053909013509504660605533181768496353010464853798444299853619689055126369510353550151910971027759949464857702231495761241052789668272665559715128 +18 +856 +672949534961130560651949768704 +232952537159279159427935901397589147661 +53562723566230157237791876909273765997707933576810908258367261806129122902016 +31550994824562540598335530352687292695019428977242991470692369974431355764736 +152032362650815553704368562568087238407459967027457421226225849525712097091101 +45958219062793756897818223297329408371898301258718170247988696901754793869347716750803095228248960915336985565984017868792052415880945925312017858560 +2138965005429346794405216904139045984058362385566693925431000008613749092589355018622253069902180893858672397449645385554064735573191661559383999731945459 +5599082768478558353474373621584847716101862099962719911376003810521845817678124356992801556560959828813284665370289254359505555309567567683413487963442538 +0 +63614981716344260887316728944952136895331320691835789808211797760982858050080814744379959772662822086419621105477221657320538493043796273684769585579096177584643239556846663373469269063761585283623405673614268918152004727231417941803827358580201799024176999958175343719377925756364804719730190086604948077995925104080216677975705027083541462053344530267616661507574271008674113036010390145990008479521027421278966059966909296208780699736375119231619806996569871604678886482503296539830582107517385273769007336972457140938425032039801259553207518991916993266714618667514018606860146526253248470582661374014064895598863780107120671021812437399331942125813127174533956650265112004346544310754279846222746362678824781169770678080461547337584499680665583752196 +6 +528 +754710143931888045283579265024 +287963055808859601191421471911256637338 +31470892304589511166080140750820995558894235651868644947081847455352142954496 +20368885260017261654021615802767195047009744205269123887896635371822470135808 +142720835682631691219581295413272156653298972135487346569310533961626415868843 +634034310188921143352280112839185376851989590898296042925196037660929073594178058676330909116314511976492745895031863182439397264248057241967936929792 +3536260655104985228570598047629889621504635464480007413999695872026244668858612074261286775235489798011926649959578184502755418831731290347207977473778761 +2287281553939530956352194620419013279616295380484047525310562106105104280173822770723063903213369365468416110828105561770407010047970222328014275531881062 +0 +22560001863719192796895130044111283738945520048063603412446058847866470382227887350538096696720355715425217113703294078745750123427892008604381522584757059875738910777798922847776950659894269775989622503322713905674484029827036908225927648295253243636588948262687038057955837034631518628503896505484117164018589407950736774304265477087982799532022258738048312405013767357154695940386662807565228396300124620904083969296874790373985742813478204314013287258685560279464175856469039885349100694798098733709413909852948085783605761402713861540847716211278993698573479199785557338834966149172681110440896385904747269474735536523234021906650038473170693630524524884902017976797497627898992391869701702535398358340570017537063259494194026845815788634086073391689 +18 +884 +269006938810274604690777833472 +101610588522779797032951766648409694306 +40658360805639445426216385690775372728200090304603522756100519340351932071936 +91802138973420634587973914099224098988335694649088995732701581040017689542656 +160395547580151362819010763928022387697275046750539372389069219756723503990401 +2233124152381198796145991717823834504772859747063952845191626176084833539989086207836671472551515196170555448158422751623837827519669626403644933931008 +1919252284176976160011289332010981490746074225906227007498726993112622893994450491566696784468278809972885041734059388168593055735985280406694325759910450 +2289668776080774022092664264319203559647600991451909561040327250000009538496148645073308529369889500343496260137733562205719817974360067449226154885838315 +0 +55792270959626079454245536536891746354044061015047378864251802708509060407086151697970260732559323247238038340248514574684316824272134174004243988966879849631208907971654413572741650607421546193766202020807183501106070183571003940038655481350482617321765238930755363311752183755302123466676483484756339745336948317667293942084049543762250035888819856859289316485878098427573790906104117375103618312469721978524651381801363881731773586408529411807824733791291961745654550372410248174655751091811290480475297754529147070427342112584772701229214077688828222555110528095105674230455201005627397295191268703416963965223576018402787685948928073019794376927754477549000044207277554142643898938434676637583745436658573054848623282334124500748223256654681856011928 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +0 +779 +300715359548629347440791650303 +102952137211174581797368872328305713571 +52989367194921747398140644829530345164714725742745665979711712562604515786751 +34267987018218655411120483587274031568161823306818289698531027458242297987071 +168690968894183742936235831942688571047904497745923725955091877321747654220396 +259272780705810127344776889495570747917460389058617673573215932643800064644515134025583656203243524957642341470219228728851192153452047875057398054911 +62973227282342561941616951866480478041444268264203341049496779575658669539851333029867803366812194344709884276320875145423969400548183329981228998122706 +5965254129721766112779853674459000262932441534062571314641843535702756946703539112611658066814730814361962056449893208202027591294575821893529344046075171 +16638238834641956112960131003736280741738593054766265118601106882033202096218023706427311810640257941823837170462099179068909971646758601676945280397737983 +0 +0 +215 +619250515473902100851732774911 +103650056966466853129126116701268879096 +34228731807048729756933359825505148611254558132425294549833192748910286733311 +88441005919192315584276015684605463479718022380851139569025347884689603428351 +88328258705344571218903867513172716845271068769336469141311035976146790772196 +2649226107791138846724729561524834046756305416350380340956873321870849588917913724217345591524067810279058938311198508544218597293890693510835606650879 +914987870040111141558011898563137014135077957828448748324538340111654574081904823494871258138489611929723478447052852109662650428138394060112195312822830 +8239613276355979167525268263572050851426590695698386039898717453191554916258990950199747288218580220361509451657894228815633791196406573967297930635387177 +8060703179875501734452397315645371132943842065312906287724986321339402104890394902953798729083389116031469222656762579407462366908520135082538921787129855 +0 +0 +133 +1142291584765711146581424603137 +224218142599483019744159109472856123376 +32923443490593568626210425601747684080669113293730909738370866772661994782721 +68880568352305824968409003492650515594964772213132854422080812645499650703361 +12652723729344688954900910126958714289422530030413497425805120886970447592711 +1103206492849224833236955795854604182628160722596764506866311880804509653626451170571700664891519212350617705716677022019024494549705682338329365839873 +3425258808981181408986114435885160216075175156275798387598170377894554593328920485321584208872367865125844049077566765910972308481949916335367518159311436 +4860741751304940812135261709809577128133600853167171692749010934360905221876127788131663351390876534092256218317140333827184421686005266886422175125693628 +8743749066401491218980507448428993195994925213193153534362044455477958023767821426016797793119641242022272990879238224077152409380573039679533424287154177 +0 +0 +77 From bf5dc256106dce340e039c7b0eb52bcf6274d10a Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 13:40:59 -0700 Subject: [PATCH 03/20] undo debug commenting --- evm/src/cpu/kernel/interpreter.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/evm/src/cpu/kernel/interpreter.rs b/evm/src/cpu/kernel/interpreter.rs index a6fe2184..4f47c91f 100644 --- a/evm/src/cpu/kernel/interpreter.rs +++ b/evm/src/cpu/kernel/interpreter.rs @@ -400,14 +400,14 @@ impl<'a> Interpreter<'a> { _ => bail!("Unrecognized opcode {}.", opcode), }; - // if self - // .debug_offsets - // .contains(&self.generation_state.registers.program_counter) - // { - // println!("At {}, stack={:?}", self.offset_name(), self.stack()); - // } else if let Some(label) = self.offset_label() { - // println!("At {label}"); - // } + if self + .debug_offsets + .contains(&self.generation_state.registers.program_counter) + { + println!("At {}, stack={:?}", self.offset_name(), self.stack()); + } else if let Some(label) = self.offset_label() { + println!("At {label}"); + } Ok(()) } From 3e437a0c4c63d2099af7374973f1add2fcb62498 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 13:41:24 -0700 Subject: [PATCH 04/20] oops remove more debug stuff --- evm/src/cpu/kernel/tests/bignum/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/evm/src/cpu/kernel/tests/bignum/mod.rs b/evm/src/cpu/kernel/tests/bignum/mod.rs index 08b9774c..3764ffa5 100644 --- a/evm/src/cpu/kernel/tests/bignum/mod.rs +++ b/evm/src/cpu/kernel/tests/bignum/mod.rs @@ -510,9 +510,7 @@ fn test_modexp_bignum_all() -> Result<()> { let exp_bit_sizes = vec![2, 9, 11, 16]; for bit_size in &BIT_SIZES_TO_TEST[3..7] { - dbg!(bit_size); for exp_bit_size in &exp_bit_sizes { - dbg!(exp_bit_size); let b = gen_bignum(*bit_size); let e = gen_bignum(*exp_bit_size); let m = gen_bignum(*bit_size); @@ -542,7 +540,6 @@ fn test_modexp_bignum_all() -> Result<()> { } // For m, skip 0 and 1. for m in &inputs[2..9] { - dbg!(b, e, m); let output = modexp_outputs_iter.next().unwrap(); test_modexp_bignum(b.clone(), e.clone(), m.clone(), output)?; } From cb23bfcade444faf4bac15dd26053ea1da742a35 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 14:55:19 -0700 Subject: [PATCH 05/20] check for special cases and align with yellow paper --- evm/src/cpu/kernel/aggregator.rs | 1 + evm/src/cpu/kernel/asm/bignum/isone.asm | 35 +++ evm/src/cpu/kernel/asm/bignum/modexp.asm | 64 ++++- evm/src/cpu/kernel/tests/bignum/mod.rs | 15 +- .../tests/bignum/test_data/modexp_outputs | 115 +++++++++ .../bignum/test_data/modexp_outputs_full | 242 ++++++++++++++++++ 6 files changed, 456 insertions(+), 16 deletions(-) create mode 100644 evm/src/cpu/kernel/asm/bignum/isone.asm diff --git a/evm/src/cpu/kernel/aggregator.rs b/evm/src/cpu/kernel/aggregator.rs index c529f5cf..63e63aae 100644 --- a/evm/src/cpu/kernel/aggregator.rs +++ b/evm/src/cpu/kernel/aggregator.rs @@ -16,6 +16,7 @@ pub(crate) fn combined_kernel() -> Kernel { include_str!("asm/bignum/add.asm"), include_str!("asm/bignum/addmul.asm"), include_str!("asm/bignum/cmp.asm"), + include_str!("asm/bignum/isone.asm"), include_str!("asm/bignum/iszero.asm"), include_str!("asm/bignum/modexp.asm"), include_str!("asm/bignum/modmul.asm"), diff --git a/evm/src/cpu/kernel/asm/bignum/isone.asm b/evm/src/cpu/kernel/asm/bignum/isone.asm new file mode 100644 index 00000000..69b2bfad --- /dev/null +++ b/evm/src/cpu/kernel/asm/bignum/isone.asm @@ -0,0 +1,35 @@ +// Arithmetic on little-endian integers represented with 128-bit limbs. +// All integers must be under a given length bound, and are padded with leading zeroes. + +global isone_bignum: + // stack: len, start_loc, retdest + DUP1 + // stack: len, len, start_loc, retdest + ISZERO + %jumpi(eqzero) + // stack: len, start_loc, retdest + DUP2 + // stack: start_loc, len, start_loc, retdest + %mload_kernel_general + // stack: start_val, len, start_loc, retdest + %eq_const(1) + %jumpi(starts_with_one) + // Does not start with one, so not equal to one. + // stack: len, start_loc, retdest + %stack (vals: 2, retdest) -> (retdest, 0) + JUMP +eqzero: + // Is zero, so not equal to one. + // stack: cur_loc, end_loc, retdest + %stack (vals: 2, retdest) -> (retdest, 0) + // stack: retdest, 0 + JUMP +starts_with_one: + // Starts with one, so check that the remaining limbs are zero. + // stack: len, start_loc, retdest + %decrement + SWAP1 + %increment + SWAP1 + // stack: len-1, start_loc+1, retdest + %jump(iszero_bignum) diff --git a/evm/src/cpu/kernel/asm/bignum/modexp.asm b/evm/src/cpu/kernel/asm/bignum/modexp.asm index a994b12b..eab7e347 100644 --- a/evm/src/cpu/kernel/asm/bignum/modexp.asm +++ b/evm/src/cpu/kernel/asm/bignum/modexp.asm @@ -8,10 +8,54 @@ // All of scratch_2..scratch_5 must have size 2 * length and be initialized with zeroes. // Also, scratch_2..scratch_5 must be CONSECUTIVE in memory. global modexp_bignum: - // stack: len, b_loc, e_loc, m_loc, out_loc, s1 (=scratch_1), s2, s3, s4, s5, retdest - DUP1 - ISZERO - %jumpi(len_zero) + // Special input cases: + + // (1) Modulus is zero (also covers len=0 case). + PUSH modulus_zero_return + // stack: modulus_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP5 + // stack: m_loc, modulus_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP3 + // stack: len, m_loc, modulus_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jump(iszero_bignum) +modulus_zero_return: + // stack: m==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jumpi(modulus_zero_or_one) + + // (2) Modulus is one. + PUSH modulus_one_return + // stack: modulus_one_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP5 + // stack: m_loc, modulus_one_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP3 + // stack: len, m_loc, modulus_one_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jump(isone_bignum) +modulus_one_return: + // stack: m==1, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jumpi(modulus_zero_or_one) + + // (3) Both b and e are zero. + PUSH b_zero_return + // stack: b_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP3 + // stack: b_loc, b_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP3 + // stack: len, b_loc, b_zero_return, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jump(iszero_bignum) +b_zero_return: + // stack: b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + PUSH e_zero_return + // stack: e_zero_return, b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP5 + // stack: e_loc, e_zero_return, b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + DUP4 + // stack: len, e_loc, e_zero_return, b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + %jump(iszero_bignum) +e_zero_return: + // stack: e==0, b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + MUL // logical and + %jumpi(b_and_e_zero) + // We store the repeated-squares accumulator x_i in scratch_1, starting with x_0 := b. DUP1 @@ -128,8 +172,18 @@ modexp_iszero_return: // stack: e != 0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest %jumpi(modexp_loop) // end of modexp_loop -len_zero: +modulus_zero_or_one: + // If modulus is zero or one, return 0. // stack: len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest %pop10 // stack: retdest JUMP +b_and_e_zero: + // If base and exponent are zero (and modulus > 1), return 1. + // stack: len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest + PUSH 1 + DUP6 + %mstore_kernel_general + %pop10 + // stack: retdest + JUMP \ No newline at end of file diff --git a/evm/src/cpu/kernel/tests/bignum/mod.rs b/evm/src/cpu/kernel/tests/bignum/mod.rs index 3764ffa5..86fee346 100644 --- a/evm/src/cpu/kernel/tests/bignum/mod.rs +++ b/evm/src/cpu/kernel/tests/bignum/mod.rs @@ -283,7 +283,7 @@ fn test_modexp_bignum(b: BigUint, e: BigUint, m: BigUint, expected_output: BigUi let scratch_3 = 7 * len; // size 2*len let scratch_4 = 9 * len; // size 2*len let scratch_5 = 11 * len; // size 2*len - let (new_memory, _new_stack) = run_test( + let (mut new_memory, _new_stack) = run_test( "modexp_bignum", memory, vec![ @@ -299,6 +299,7 @@ fn test_modexp_bignum(b: BigUint, e: BigUint, m: BigUint, expected_output: BigUi scratch_5.into(), ], )?; + new_memory.resize(new_memory.len().max(output_start_loc + output_len), 0.into()); let output = mem_vec_to_biguint(&new_memory[output_start_loc..output_start_loc + output_len]); assert_eq!(output, expected_output); @@ -535,11 +536,7 @@ fn test_modexp_bignum_all() -> Result<()> { for b in &inputs[..9] { // Include only smaller exponents, to keep tests from becoming too slow. for e in &inputs[..6] { - if b.is_zero() && e.is_zero() { - continue; - } - // For m, skip 0 and 1. - for m in &inputs[2..9] { + for m in &inputs[..9] { let output = modexp_outputs_iter.next().unwrap(); test_modexp_bignum(b.clone(), e.clone(), m.clone(), output)?; } @@ -581,11 +578,7 @@ fn test_modexp_bignum_all_full() -> Result<()> { for b in &inputs { // Include only smaller exponents, to keep tests from becoming too slow. for e in &inputs[..7] { - if b.is_zero() && e.is_zero() { - continue; - } - // For m, skip 0 and 1. - for m in &inputs[2..] { + for m in &inputs { let output = modexp_outputs_iter.next().unwrap(); test_modexp_bignum(b.clone(), e.clone(), m.clone(), output)?; } diff --git a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs index 071cb222..e744abfe 100644 --- a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs +++ b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs @@ -1,5 +1,26 @@ 0 0 +1 +1 +1 +1 +1 +1 +1 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 0 0 0 @@ -40,6 +61,8 @@ 1 1 1 +0 +0 1 1 1 @@ -47,6 +70,8 @@ 1 1 1 +0 +0 1 1 1 @@ -54,6 +79,8 @@ 1 1 1 +0 +0 1 1 1 @@ -61,6 +88,8 @@ 1 1 1 +0 +0 1 1 1 @@ -68,6 +97,8 @@ 1 1 1 +0 +0 1 1 1 @@ -75,6 +106,8 @@ 1 1 1 +0 +0 1 1 1 @@ -83,6 +116,8 @@ 1 1 0 +0 +0 21 21 21 @@ -90,6 +125,8 @@ 21 21 0 +0 +0 309 5842587018385982521381124421 5842587018385982521381124421 @@ -97,6 +134,8 @@ 5842587018385982521381124421 5842587018385982521381124421 0 +0 +0 169 1232997389102826268860991065105 18618193491623480687965778108529490131 @@ -104,6 +143,8 @@ 28522822713801268588036943398667804191745915805046109428618723188679866502161 31706899640538131462557950751123123992423743151283050819612655945089903928361 0 +0 +0 501 163832143645086957897416441857 130403518609156362105805396406315208861 @@ -111,12 +152,16 @@ 89705076639198166424843052158202309145112564081865083245095301525986942648321 161580799869287829122678259656507339171378764462605635944908315838074450225541 0 +0 +0 361 349605011617414033395053481789 245857331472368514819046594566028058751 16196520401421423385786338368215415982698439852342927927980513551465948892989 25448670785549471741073803593965176921136178751681542787519830340854942519101 208746275861806526568796522022506082930013066308764940459575687169043802837726 +0 +0 1 1 1 @@ -124,6 +169,8 @@ 1 1 1 +0 +0 5 0 908 @@ -131,6 +178,8 @@ 908 908 908 +0 +0 20 0 444539926163396060618371891200 @@ -138,6 +187,8 @@ 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 +0 +0 4 0 458477653689271929750159360000 @@ -145,6 +196,8 @@ 39622934661811821553763744630506213929196932096668444518123439737845028225024 11662422067291787594026815204283885427659195788081136348012846295902003920896 196850617542733211416217278410575369737876420896781853126317893743949824168141 +0 +0 16 0 491348889049443876707510517760 @@ -152,6 +205,8 @@ 12836249910756408599207651670402691470189457253048470571408310293697570799616 89957821137359056393801843026144645477720961240687064113356371611922523488256 186628143002875342454100646575613221588500043779267673627434610024013060416436 +0 +0 20 0 995158961158262555374402928640 @@ -159,6 +214,8 @@ 6919681730812989105961680682293875199438003339556752544938537021004054528000 111415284413375575279069783743044849713138799010818236990829948938800785784832 2671371225382503991550810752302543668307773911036096851249073522360117594907 +0 +0 1 1 1 @@ -166,6 +223,8 @@ 1 1 1 +0 +0 1 160 0 @@ -173,6 +232,8 @@ 1267650597867046177654064545792 1267650597867046177654064545792 1267650597867046177654064545792 +0 +0 1 312 0 @@ -180,6 +241,8 @@ 43179616752915754651548109831528453372307533305539601542967080491130306953216 17577324162381258630474635337405333643146914114762554675606397827067886436352 24302243256145833886805174285503224697924343810958724170274784478667392432942 +0 +0 1 104 0 @@ -187,6 +250,8 @@ 55518020932873470218319288289245721296726991639699521321270937184899723952128 112628490590563884833405386435939751658584809004247538619207709896844158959616 5922841801814876533914360761483372163277450765372489528717658348886181069591 +0 +0 1 820 0 @@ -194,6 +259,8 @@ 30966933304654384056562480896427815565136977421206545694335698204395214733312 82119970857858981914834549178898483174623261423734314091990446749364630061056 17335345295685259772267515166522970642719156121663286480022840319361908909536 +0 +0 1 556 0 @@ -201,6 +268,8 @@ 26118405364148793884093212339004353321168506206731428575114534916913543249920 57371932048380839143645765917598495087491748880125189544237269309841806983168 21907868082798520198592834325003250611892002016702940923441999346792832444518 +0 +0 1 1 1 @@ -208,6 +277,8 @@ 1 1 1 +0 +0 3 827 633825295391748780828659810303 @@ -215,6 +286,8 @@ 340282366920938463463374607431768211455 340282366920938463463374607431768211455 340282366920938463463374607431768211455 +0 +0 6 883 1151402479073526177054249189375 @@ -222,6 +295,8 @@ 46236487016914252810359942606653565611806735985113905556189104784313205915647 10141063897320778511376522974043618320650062159021091584566880470490557710335 78190442020038551706136595408815344419350554279639655464038299447602848702950 +0 +0 9 257 148913685258606776538030407681 @@ -229,6 +304,8 @@ 15737081446634197346448238543290111090647984834849920547563580853437339795457 17796349368611048392083206935955698801625485975991150886750776582747396767745 87042183171820405426823900509602437553981065786933287231059322442248803404950 +0 +0 18 33 501502021891302937219905355777 @@ -236,6 +313,8 @@ 3229040287801688211109538153528907359157521678782897421936034456493449281537 43674379635609232592374808570316762057057239464140599073454048485319171375105 206574116687852983759940670284339037133974987477578735810964428283965343595925 +0 +0 6 515 140262897948655524553823354879 @@ -243,6 +322,8 @@ 51292049059523452610506083592610024599583816874803914322375719502751486443519 27936184963965071766976378876421641742859886164075202272073313001233759338495 13449010363647692703508349667378797433516756740069562881064298383864033242575 +0 +0 1 1 1 @@ -250,6 +331,8 @@ 1 1 1 +0 +0 13 120 145483342680740634262446800896 @@ -257,6 +340,8 @@ 0 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 +0 +0 13 588 242981830122332196998498746368 @@ -264,6 +349,8 @@ 0 110892457497452005403581430237946183767136503117162566153549053970000476372992 189155222634588421211288058609537932434095476696578287565656039885444474631257 +0 +0 1 40 447233008701926529533965500416 @@ -271,6 +358,8 @@ 0 80370191198978495857548168233658974342470488197481929432131097469881528877056 57378722967569161858531872288267370459698099854972954033385237027489681458401 +0 +0 1 412 442771250107780063583096799232 @@ -278,6 +367,8 @@ 0 83509925808939041219467836468971382374645162274742749382395185649452566183936 130737775035935455315064283330339683168756409303633081183629254780389959201676 +0 +0 13 172 791101013288846030830655504384 @@ -285,6 +376,8 @@ 0 16620630689278877851873420518904814002737213549417357007588250730268341567488 135713742926877628027400301750580746786742856540376082400065882631878268256343 +0 +0 1 1 1 @@ -292,6 +385,8 @@ 1 1 1 +0 +0 1 296 920477174324206192629261533184 @@ -299,6 +394,8 @@ 57896044618447473228882389021020048158893283581286713298429387432951596187648 0 115792089237105570840234253759177109864155645142784332660520492325483608801280 +0 +0 1 576 394649121464702711197113253888 @@ -306,6 +403,8 @@ 19171508671161797156614710182257630792593514679646789380628699765537557708800 0 83428280595193522049620352001877162940388365577102322638744416599597810157500 +0 +0 1 36 459149829216013907374855159808 @@ -313,6 +412,8 @@ 30121405346709427309695531890582421791203074728165296179965859962342252478464 0 42435402933391614285072618340065308663204835805291910450325661435301593697950 +0 +0 1 440 111480890522555005842506121216 @@ -320,6 +421,8 @@ 2219279707535425826019993588723715376924609733291444929791090369095624818688 0 125210688265252194710996471277583934881834379414003707914695928587186801398100 +0 +0 1 192 973066898438133470773494415360 @@ -327,6 +430,8 @@ 53535005721204496876936515275724889845817409334527168350061458281042045566976 0 35340054082346922390131417025011886439703502295343037882213639103251549897900 +0 +0 1 1 1 @@ -334,6 +439,8 @@ 1 1 1 +0 +0 4 771 891784777631246170114448424959 @@ -341,6 +448,8 @@ 57895602960811796650871631801676582813791887579127636891104569893774562426879 115791647579680518644692972256970658065423327120836162316857392245886991466495 0 +0 +0 1 43 597446603600272666897934188543 @@ -348,6 +457,8 @@ 4960875119562861993119998040929006214931859756877807299872704131313015193599 83869314384839239184918994159181415456293389193220202757469792852202756243455 0 +0 +0 16 417 51915870197464503363519381505 @@ -355,6 +466,8 @@ 49219110417420231511113764378238860427237875311237523872333835875498405658625 102059959947892163134217117691190804610012473033509494849327043219849901768705 0 +0 +0 4 857 1131685075580794109740493832193 @@ -362,6 +475,8 @@ 49306867245429292665712135123169680084542437782148851479415184718925278478337 25169675183049498057756995668265957449819867477380947926503567596715595792385 0 +0 +0 1 339 813911142051622544908469927935 diff --git a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full index cdfc2666..4040fccb 100644 --- a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full +++ b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full @@ -1,5 +1,33 @@ 0 0 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 0 0 0 @@ -82,6 +110,8 @@ 1 1 1 +0 +0 1 1 1 @@ -94,6 +124,8 @@ 1 1 1 +0 +0 1 1 1 @@ -106,6 +138,8 @@ 1 1 1 +0 +0 1 1 1 @@ -118,6 +152,8 @@ 1 1 1 +0 +0 1 1 1 @@ -130,6 +166,8 @@ 1 1 1 +0 +0 1 1 1 @@ -142,6 +180,8 @@ 1 1 1 +0 +0 1 1 1 @@ -154,6 +194,8 @@ 1 1 1 +0 +0 1 1 1 @@ -167,6 +209,8 @@ 1 1 0 +0 +0 21 21 21 @@ -179,6 +223,8 @@ 21 21 0 +0 +0 309 5842587018385982521381124421 5842587018385982521381124421 @@ -191,6 +237,8 @@ 5842587018385982521381124421 5842587018385982521381124421 0 +0 +0 169 1232997389102826268860991065105 18618193491623480687965778108529490131 @@ -203,6 +251,8 @@ 2188719266686453452930405899199235044753192686954839466176162624683199938127424638750308949204554559166758220326224401920489333667474175603924673521175569 97683072410076712392282066589062765759142693107292941896505293584188136243288109019576354936509509922977328660487195240361272139205510222433941017334790678007764542793184659980312059915447722823578668568011564108579332326431723751410142184277342914838944751536309663705322838157117861387318160798897161585596832140403965513049019443014736754070054609736667260175758805144888061962097304053358670835773333470540890735799904230791681702069723170059730994966345549884415945422800168211660316601223536176280443881579581601353735508758304931277498652094516655270514463040776026586550201010112790848764931894737145319055710919828903365167548960625995539691849361659426748054745341215957250295921172194577332300749566307355206009183548481079880848158140024332983 0 +0 +0 501 163832143645086957897416441857 130403518609156362105805396406315208861 @@ -215,6 +265,8 @@ 4647428455414528310735419222346137778331384012634538551014412602117023622880652353771726881116679285768237724443091476402706202263926819772616832419102721 28906403319829335579152758638386875882157614960297137405961247837759673945253015729546983871627651295299575319061533798314387500195065807539803353638203395485986713693607566481778609628774446828616734151668234602307947424409538672904687959912738570330185363904523550454152635659490551290870515246999942195502104118152301334700089287366991317719093433052486678593858217226842307981271549071491620802771924028173932162208416803577135606285968124070284901637877651643821446019733885049153989665296997992788886918211374075831435931210077446773069558106221488521309239497226225767367827327143784702703425755307906283612559634838050993457902429094094933513319959004350518056515716806784625284507193189229626210411741030529099220711533547813203461920864443567261 0 +0 +0 361 349605011617414033395053481789 245857331472368514819046594566028058751 @@ -227,6 +279,8 @@ 4841490524461293458775865719630252706317774131797304941603107709106391551373400827563106022147424343461775948749633172375219539070706909069136692738510653 2740789198296345318965111850612712124652802051718746728440158354114594129999474575422329095265931082725696402694153115277645383596764582263006721610854081043248870278564998781931116935500580780582792000279161514916826840858575525432768051097577477367255077045382464021310113198660432638949403898388170795721793065002216164669679010725866562559739695895046156552765387872883795328098201847555353205101813822718040399910552301303131582151997608627639676073359537022621281032462623358483949826772477933699237569645211796888270724678872987960765671548627563068593024266312400431519682768720409103443029801469657858538886532661680709787379202798150567139685716652711550210175722552439867825919976479511936022577306731016108116152385593537502616696990796522755 0 +0 +0 625 268138222663085878899055263745 24352877979184920020466043837322220276 @@ -238,6 +292,8 @@ 540244355168038810439245856412365092477075663815074675095751794574495975677637107674742162091364766891790053303512224504116561928038681836474597949011431 22981118609480295020302390537085998300920429526471726567398293023445956296114258286587907654003543675558782486527003079440548040281611791112262372611325953 73941510060571769808707847667790966361814661795164158907944820368767039175329325204318632328932777023413894322006801235569878477004331269927355367279719698148339549611862266243948248034957017596288151561242678219756200772050065651639668126957338646741620454044238313630119096517295028568676012861463546531042912418706583467447570262205402306052654170522693798233816940007926095553081467230774677628419097478417656740275827661249952779211901082402701984013817630510703444381158174601539927553051608704757704256329593150815404929742382319437401751432803111155121722314969548641096333978274402305457624550606359775467371439424755012388172195256850392440613960542485094267479774582498660391674109469751118744651961944474483070585106972705876377013009303003480 +0 +0 1 1 1 @@ -250,6 +306,8 @@ 1 1 1 +0 +0 5 0 908 @@ -262,6 +320,8 @@ 908 908 908 +0 +0 20 0 444539926163396060618371891200 @@ -274,6 +334,8 @@ 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 +0 +0 4 0 458477653689271929750159360000 @@ -286,6 +348,8 @@ 826369288885297875981086985856579353870084500166446900173411432842694716669231467968748002518734902939451616083284004742033317955616293179658208664891021 22202087655311450647135419149250531087927146350676835345655785380157598138557194753184373294689489916297473124960377821312544654416163136210039001929744384 96326898017422549955901653473833317437779055242533369421502155472853312686359970920631618758332572373344127788925685357338018927325197920383756639905996985594464076611884108612383979058239243581333594431766225648327089235187237418565994427057194424144230986856523397430803984945243481297655005737624265563071611038633687040642892633295910225235789013409695764507857108219593405978524437916413344943216420760961385716325465327198936950858396311435969338610001054630999456127724084117584337225975391887983455600569619204999635614531187357888356383792407464654357840556181154590937696619387875087097799731553278646623958202450683045055334559548014107490770158063376348589984756721663474292053996814484159314973841417990207095034106982307493862880629121436691 +0 +0 16 0 491348889049443876707510517760 @@ -298,6 +362,8 @@ 11435172354316143741773241295887896087133672859698695578907055835282817586890921066517171600518967766241323412371609567006600523639894522363112407210324509 15149040910228070805694652326182650730845401534077532391632591405118117144643051256922675471878552887101021773709591676502861584900921169634374950540279808 56355766588100866282759682860797737644333456486609653821690145061731646301509427532577235211073754179875805682373375444169056701023240723500943049070332395713592503538088139163641332470621142182061028756763699330098279139021193717395765578924738553383866433961757002615115656618107086139201371155417227057833294387363725105804398704482830941592436648716775980247000000269741607274596027979588268573128057345637713854419746154790792746601966483920954150371581596833034052802813842628620625504186679387894821638490513018094217182975985101634425625016603667727602990826149251788162518904458942322862611953393619284289193102324110779630113399662848749417489714492032695738284419047277571615136307300694250850975078143754035182602823410211073763907416991824957 +0 +0 20 0 995158961158262555374402928640 @@ -310,6 +376,8 @@ 11027839566584582470519059073521721670466350661122931561173065258823257321580571220589430064206794766082774897831215317085884716390531116370426677289293467 2022634134337910980433929460688286697109516578140587883097911933500075648632085115589857581520940210394331242638360018211669767050461136520845948293742592 104434002006843236008977680607322179909107225265723195172106448264775516650476878743833547793134822307341579260328191748266784852490161978530160695975684513538749150196514786995025112319430605048357152763823300841556582239612109067728895698905501385995876685519110292901541609662899550868216317616138105858298678470326863134702237726421551517029247749909571485746296095446086931717436380624490524897483943213105857255382008413019679737361439910325961856292382954474416887424544673025993513511888208735498436773448767939462642401895140762934543757089989225250342650950389055472793689331649383437755553290743552677603436417327718879340225284742201264894059121415641518774058619813992793525299939440882356982132407391369731777608785484350813033980885141899629 +0 +0 16 0 1074929557660986703509960261632 @@ -322,6 +390,8 @@ 1438923259930704879657001108769207409876637192084506601145086731796010515496862959970405934371385188574753305943073462813023599491372378876317837370133527 3751312292780009820304966556683277538490745683704566160236438372682961982986048670343223416367070064938538731816396930813426231559274819821553090255912960 22245827804735705220117704141226501502064071390534072443304730331219236590933359461634355480686062688856652758824214234474569118470794815179202389882960630393289571816102623905452982847756909044174684278809183441442368980646940944033452129063556227674889674053321140347856710814670492783918404567115943752242132179948224781036963934893498091336265346815823342522106301789947400545161838051916557443788755305106534416055804785880604630383100935891307521128089394000417311935481221851817253939762456589711248274272603968362800596648622527005911004624214546005361950076957837412463355621056287213223178075347444917257993070579220268724782785908266671543562947422542040620358371842622681799613531211436766739540220187728136764807693542730662249246603715717954 +0 +0 1 1 1 @@ -334,6 +404,8 @@ 1 1 1 +0 +0 1 160 0 @@ -346,6 +418,8 @@ 1267650597867046177654064545792 1267650597867046177654064545792 1267650597867046177654064545792 +0 +0 1 312 0 @@ -358,6 +432,8 @@ 13073126603118771003805243197447306343271660677454831683154753707889268850436361661628016500641989777790467968280342772010149753216162050495370020985042625 20998284069276981893190892536141895412205721732777582241948778013718640245971369156599887283883776856426273476192138787335689583588114031186267728857006080 145542850807497848835319178145854049254749355997392611232552085578142798867040512655869746128273722688794373277401694240068639939714289029241882420255560766785421263830961288462589671284715213700259981420839552784433954764136129895647349608900424001098087782010788194049925972037176206755004721388556031373292370905301046483673732115270915431015370122027913276559667416729060604786258013103534906022354439463657079061912817809459399519217831107039092600535346674227177324605058446151697792280617616240531975687128608716128611655864852795243359772002145334023510826244773813417705825695275150689101537745023681398310201413740361940992 +0 +0 1 104 0 @@ -370,6 +446,8 @@ 11845528388829065193137342380492024118612741433871500160171557205928409375950091328760923663375034610212896359622832576619866946421226527978810823517767195 14358105553296630195074581259093482904061967322039003650287242246847189245898106579740731184467142158444184654938258232190794449000467281976153220954718208 29752262246259984678162071014197346968143136331663455256981077869842278686037898830681337972402546323960946254640523419175397824351219353528741213076338024666791105522838263742864055702639833923153008293117724612975777700118712172163321970946497599246107858287141120189876164900071195554149879560929714317726886802213377669062443329404613286649769284209181705417929996296531401439508394294295981454293915959331276279328651326916467814126531151303158821906765519330853044852025868724455596200247310910196642038596122167329758444440621256743172719588202406984180471326374255698187674614229475956485349393277466831070800337767440086480706912261115764441177598645584859965475859908792264470117807584960743322003648528490225730990797216523246007325125660813792 +0 +0 1 820 0 @@ -382,6 +460,8 @@ 3444397905407459769678888603161852413323651620442902175963208412202586537665061311535470334927067187735566811052881866689633902610439151941964220310971721 11022665256141102472940378463699540949238908279778600071282259749712264960911250408144499157327170064963756957223649027433072458668570655608803856874471424 81919800719046671517207878533082805186701437860813948669526605848765879544474579530529213258319904229463427416500034980139071493540508610379427202516273597241143095130860760643788268993138393873688928382393660799195777113637555095197708201349107045094113568679365641988474973555339779269195693828793499743438153464500880227617361433873295240468480091950267597172415617173026834985248894403081410665165176999289507171222751308781836602163165730218190683421881898534701677415079833299850716047375983171219380868596376070770512341426910609957412762987411547721228138660322763891960946563558118043129184649038871557137165767859126740489391397423454065954530520094206892394931511879782267862690117117821375879839535619206923499907870338087896184905875270865206 +0 +0 1 556 0 @@ -394,6 +474,8 @@ 13236721874325271723025473459287198396620022329708721480674722710511848773677038674125983763343329458361710367424043866874114509274517527946107266648826241 2194764262264585667059858125941452105865892742975859841108712998947329687982788884647082000066632025028061458492389933022294535208755309187928296471396352 57355845567277631605466891338726588644089168231176157542837482832445739996777264257736709708719870652751122872815779613324883278513875916648714007640679582725318528875933814419008616453081735986389172535526171417933073790237448684456371375012177818371017323800403026152821936870963289658435094570449606483182790495084679923580056098533465388873546412605658044277945663984045593268127930808295095416816320488700035120640634800027458402856427447416869101366825313425698561772279044096387622248612510184764590511957351321992760940588152562393870554012339866893305722152910751088759230319843257735303362591220388959031206648585192806326375249281349826218061542078179530915004289316383242721047093262796736375481154941024161803411599260123590363345661492356322 +0 +0 1 340 0 @@ -406,6 +488,8 @@ 1423443399352876324872592588473564301454095472277230446652620290446968276830664095418889947537872334002573975742103104497418388304230155249816071500187318 13271987893729173924722826693052254951121133786126776376721905614595108288958742926463506237918989779603882913708829786515628223071604050168421092211818496 77905163329900867420366537018313477469905867162687873813393972295483850618977227791693088449798950674478036536807908041173896960311217710308282172582393944149677514321195523061240702828647496809204345189326973455270189572598303985175508953019401483296366422730919952610005994556655769831109807353377091098573022662139773340132455526518635857168244936106911312371715079630324434205701454925506932022716037033236074043005019646714876385572906267836713196559389143711572457627590778030188607449891771267696070680749135917564518323190360612364871790463549758918603258303428611971436568217794166218285910235112620619466021065907142038809788800937452474220801409964080345487147019001555645524503805537058212837105068645433031569147212247780129911832438913883087 +0 +0 1 1 1 @@ -418,6 +502,8 @@ 1 1 1 +0 +0 3 827 633825295391748780828659810303 @@ -430,6 +516,8 @@ 340282366920938463463374607431768211455 340282366920938463463374607431768211455 340282366920938463463374607431768211455 +0 +0 6 883 1151402479073526177054249189375 @@ -442,6 +530,8 @@ 4270974226494341897280469825731968602385022467387106892501039803249858350601697035152008485439522684257776791254316572547412071137653017182505839419643661 13396349486729820333578617551105577176007659045388305976467765207187599750765003306881228272040491956095560694041316948995285357929407282941862450720407551 41335482013742092607340811393696289265383491659142322933176202133259802321593681034528755929862481933532393128757559300673957698811146130096420912757069006505560092013193058114993341087169760011081108233127450523524951040608820702691804101365559446397551316177148051517733484177074821304382338437764467306979862063585555745663882763752228397056876102734020204479560221614187264418308618629620880123146215622627304037187875802728513960072756165523453677069766105888884368223266356453595038697920292826607321992884044691584622439589759520114123421788741839649085676566641773228464920934169309554870587864775049223057007191810707214225188647666288834463204299431877132150564481249043414298411851323421333913909136986057992835748995108031438173716216778129698 +0 +0 9 257 148913685258606776538030407681 @@ -454,6 +544,8 @@ 4658367006324170812599422256080523502806559591300942419231897265664273942632706886970881430455450954648568107656318501922464893981721336262565505150036230 14176910549874618607407657930219555895908368234965503682114333452984200436110890119648814677868732070859714001297650338292337460853941658691514163789824001 3981590997528577985614013626496163269309337001530158828834919698707508463533911554477117533902325017572915525754176662144767060171245958294730597431813358362095749926259432146429268064183442642625483652372876461555552111669528698715632169681920785094541248195816649255512882995742569140939871664873643710831289778166479150632763297994113176828816163829137609722485397222557029388537555905894840696252924686455620903377787500951900791439866463151002257292062493531521259668828212238177466630166755813378978387753495507655220937258672560809333463242552800990330533067696358587513958431815046133411714898659555238120452857813163223926948860131697571033149747044928872650853564255699945166792002731329998286732647104143558910495746437412765192212775849994225 +0 +0 18 33 501502021891302937219905355777 @@ -466,6 +558,8 @@ 1139630468367775490336631812613571548165746938068725127033848437473514644842035232747054391798198457303514508910901267746988126523368144746838663920634335 23229321847788976756725283113649930370792069582610592470231250035730463613494249923319913356844479204498929051652932802538286625056745478043326957712572417 21487647700948725770264219795271945319749173192243211453565596987241176737462250667633618886948279562252171101905667946094773469883315171408531140186855386367646249336580544723963373739798434897480106621747141407500552065611752936446513575255452313224578647762353090456207919452697909630833138121540651400661437851470186602006938775128954463677340497236474210542169245851888174674678830034001396086853856173586859326673017624988194867397733165469207954391033672813066099060448147357170672504662139485543607498255164955555500404555706050039769127136110940772239631000421580210911841692191756394540966716847875044874206186693212588146722503861824552180465617343841495586000134019723162576895089813808176808430959645984761484461706924153776124666379090009872 +0 +0 6 515 140262897948655524553823354879 @@ -478,6 +572,8 @@ 2534000532084385254011173048792691142730414486367806853286959714601853302234763393270798424710144792599095332446397093107565422159020315343985501774159892 15542028513463832582045168836396386001625310864606581833373826691519685781220976702479707834361513658452848273358428791133185408252751328679278502490406911 27855593116714084078162208384054695954058993655347035442442179921961577060832675553361363768691284076718916857364752494526844926555439953895434905171819600393919839632321686484452963250758696733364354962412703929346121448165936594763979749743986180482780225609168629837008693038338408977887230386816779307922171459072440924593974717415489081076605422061521481900028889163041175095249269917613188334409527500605896088131198525624936674252007051575485702484149862125584208439328630135980638729947396581292462742088861126756410817710170706018291317780771586734693798945816799442649044357722598789451512849026273977421119557083044897445609719917137143831367136164117890467710418451810181780268537911406332672074241783568820460769615890093335916694542757288864 +0 +0 18 793 197025322184063122457151668225 @@ -490,6 +586,8 @@ 3558766711272482011504448167665545486379425587311683496485361619290623375415884515332307272266520310480366471739749365076632262898225547952923293595733728 12553285567146229581143238572266763310070996960196734618418238189114111487087176302379917708160855599798506766652438515952406574783180790667512374443900929 97159030126633829597136097971952095447819013982449285765934773565865340571860394947523612579798472319543447250648137552684505225800254817082318510333085200619841378709947507256156769600212492868513841001182586888796188714995803932972130045022421338995588284122277277252253773904930943448321203400640850726145956154506701740238971182204246652277481910635653257716342505752786715299131392950755696825083787096420904257094017949450230308096656371015076532528700124758206739955106033591193772505444903595304186731720399187581590976888363465586491099855056851754180558610125245962410906033444380950412894133308093881338615037037363848849681332843054706412988017518927595434433405772857527554569413308034400064517677000618708750917221012796646872214754875380955 +0 +0 1 1 1 @@ -502,6 +600,8 @@ 1 1 1 +0 +0 13 120 145483342680740634262446800896 @@ -514,6 +614,8 @@ 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 +0 +0 13 588 242981830122332196998498746368 @@ -526,6 +628,8 @@ 5354055707309912886614410393569876624773886934053676926684306993550773407750553762949175437211369217571333055727536737153756343047932603108461352921558471 25365469084896632438831937795363726978720559453448504867481253590410035300967847867532559492662554029011867176416570131146842894254418120377083085899956224 22619096124871383318112295146842889073303814371605345095383233795170631479551746348815087421524678717453965509455660287838427423847169211714828596281997684789004627847353198055765599865486506422329293807467645077941773514592600738421251976380577575882032324559233081705659227219112318455656983110210809943601933625629880644853490850095007658538362417036453726855372348519767721147063930317955475407601904264304792774876267561255494505090533363568576267962083615004621048135707122075251747344476975836746644988257090294675499533514516099932667526906076602510814454355743316358417647066752438499266782078096470209967559276168613499470451000597854188801912120661390116619348790746561379486566757130299748657105161796124617016203782579238850942498672523329752 +0 +0 1 40 447233008701926529533965500416 @@ -538,6 +642,8 @@ 10809419853862469069424671860661466104583061712836069230246390212316112130066125544420392691125603322947467815628376833408555549515946984480656880021651380 1850019664799561828446887689859810128523634383437118940053115370804552962470182093340221950762057683211340120378944062888849213207787569638787758996586496 79146062726645406094125245786551837498939308900395005168244204631903484415658270158844664157707310955348248763771814711063046788391067524759221525529104368326321326084563472124318731918256168278623002358270765227604826669835435958891438295342434903159075288156677246336154439150755947520052886328714167256538973433346444421333656676210187605803784393721586492840057545981989309171468153197884162328945042603749066570005966624779093957794076862811092779063304321109842324091731703363279951462666574672700671376196246065961538032986903599915099739318454751915689195199186259591620422212377311621369407484297784432106440200065147739080924962213019703357438002437916474914343797507018762537475763362516037464530375045287476905864731829154079915391149321968191 +0 +0 1 412 442771250107780063583096799232 @@ -550,6 +656,8 @@ 9528330235712431695508651348872596587940214388314172729001944199117139203073649460506789237728120154262303033791074115687461447137304611451019062450033166 4143685306341548231504887338288660968707624803700705709343351955022110657856432837240377395875927501705908299984063250507069218496972459859740452129341440 104562740839673051503481578895764239526663080510065863568700531455357666811369786434424695396331208203674279431043760278050410976183787457855892806406288752625718864322157193135769794697567013312432056383089033459465930753275824303748732667955926341050919959544909694846454721655872047011992815813101904694198241623012881202256275588144302323618881878753528314530907071840869821031266325498114515282538879043478421665955468305417347448163949274702442224107731910630000156878070681872216439482078511101544761151961351666834740966456291969981543493720485639008116953134509164476604089589320621991058625751690463775539274052816775322437146286935605947581551624753707514918261540969042840854540826516277183600699165171925650708475149449313485973818422281998521 +0 +0 13 172 791101013288846030830655504384 @@ -562,6 +670,8 @@ 5573805721606072201024464091196637283572352485715830551875562715416314364897955988150179092473897788638830452265884540199145584775259028641318262487547968 4057677748936070618844094810747404761610038515502652344029344965685330894561953958031306249055086692013728933315233447834639061360828462307224389794398208 88805558984185112795255952736925324601122785431405035576602411741507621170399545249153338740407851719428060900073010468408821802935493225406349141834719114871624992935268626480271242919309083181247592470787139392455723749357111206028829838073246684382343203181677082339668604262839742742487557831265162674992762636154408019739353159847808458505828285614006445789755453887253630401662086162458718810862782531906728058604853740136139465565601302099053412977760544006397324270863858056884622177695713355282096557500701906162213797940826417474604859594028449742637862923899962768141687417119968332378928546368809483394380922906923652815578553545438336575578328749210393869199030932921031494164347096808050678532449008199752921295412645439010521079989198707275 +0 +0 1 316 71681696331238174643235848192 @@ -574,6 +684,8 @@ 7056836934790078890629897242686908388561326030807269602244791722619134700685270860402176255162872248124156286310896170748542196945067054699971451991857017 19653627676393504480845906820110557077219860495796321885850081681411361274754697849285945541928921052518914208933686885858752894441356909201046802838585344 80971491865621906872687361455266590261837769438953920156547938816925768812130351125693403692372531635187597207678371546119842393999946368251808241062815009537201922482343834280217543563385790528991891486955186752804442082611928288446541683061339642049117523243263526092524645999730641570341457586483133065003298380514028101577820902138870910908422214978896149068391330152027315094631190895000724733490201374419942438095933050937915756036226904754356983169613998368095692094533690592884544613225600675823643506613658403330578865342487542362468277076769889849827121184947189187765093232341824235548721589704690368245210012944395720194265051720532446465158583188993358700221084102969580809093675283436656573224838978616518282441341625699723104395311464856000 +0 +0 1 1 1 @@ -586,6 +698,8 @@ 1 1 1 +0 +0 1 296 920477174324206192629261533184 @@ -598,6 +712,8 @@ 115792089237105570840234253759177109864155645142784332660520492325483608801280 115792089237105570840234253759177109864155645142784332660520492325483608801280 115792089237105570840234253759177109864155645142784332660520492325483608801280 +0 +0 1 576 394649121464702711197113253888 @@ -610,6 +726,8 @@ 3201888256116239379504709172928241207634570507519243666267842079354934745091409880730742354222322722404797424377578771802961012486596039415971972097760189 4721437724763666216912653616574178996088489462586407187533602132486864388960603129501403388719024042140502457650359696753171122610737975161314352895623168 55205153321423885338956400064028198664777869807781110728609963023113127397799487072435330520570509674227424013583745810499657598526035601000813992406801177785654880796763619086540215022787992132190574189038172275832590358776861644727492756946966750658508989064774358448920178937939967901885420472435626511097953664008511962779746263834925846263368943609296037000961913781533108186027361869767679638534133572973581741775890124715963547264348199334411727966106430979815522908566738854258635779614741558605346566456990906260060286149956197404097883016944875962774702247371289156385212377503180483598168547092790446295055664483192046839671126731689954934743379048870609922204145815922015896815781635235421742690146908458094281966246581404186172173133753100062 +0 +0 1 36 459149829216013907374855159808 @@ -622,6 +740,8 @@ 13191762144369989130760985435688757812828881793396707694471183793997116204175863881278765015080350072806582669305591779418584954819749146010893985699341570 13301718048073450430547712527884367748161420561064642294015103641915503834019416126543999762601710015216018615418920000282926562454589067268249095837319168 49769281410460079587160175170567172396868114308017996853886640420533796807286477273833673204546740576725320996039722521612053833334969359392750604880174269269691563903355785551869296573598748844759330739045893089809768955601413769089329821698243159057856348655739971360896746872957056067463031995674345800660461377513320831790263825314771253934221261090427339884556900829469063294537348024008289581118375314929945056302399670691682691431742185244922959167693536920751966429893443774313559460258906531208397758280206465867926105953925426176615769227172870551762287519389652134919720196926711638429327818529325606413699532013110569630521033485451153039357638432468810344302542925792453000718773720773888713451243298922307261297537275224785799452209942707359 +0 +0 1 440 111480890522555005842506121216 @@ -634,6 +754,8 @@ 3321497911172409553001804903171022673679565313946048256955779288266740305599386551480119034076080803092083102364750364882135550956683614114559617436903767 12793018574047350137248079672509016968931556367756809163171704828712247163091906244764359814474025125944855607579655662889196220595429789208504167192068096 76689588434293201835619981066989977477908413005779753088866172810964808473094991876212777269773122696199331130485933575282270332735785700928413943556601975066482786096313163465341993412070612418928408710357145493143294698834250060597291905064146156670188605739321658556756932045817073412966209066142063156039312180285153065411311548383943716222450921593288580859391382453317396476747621728712240646643660359972038663779394318168094323388866014840669339297737399151832669131468852916425987004536557248422915005390001651936105161265315235641833312850786365439390074831681304150075182778531434833937852580505677817092104426326851552435105848297197549099189512817962975477262222108336785184201422735915682453207631211836049078758133269146887032420460663443098 +0 +0 1 192 973066898438133470773494415360 @@ -646,6 +768,8 @@ 4218798631160832202661168847672965043016773529025064083427701368151868437320716279368190139450621334670500868570495563594616568204374854957138784941027870 483959849385694416988953239395437763233014877575377690428602005170645490229330810160206389562974522706669622381302406569004289640692782430642495811485696 29906028071054660047981472687456811942854117777380291648479644593101403451134729390839923856506792491608604686349173972820836411471398517144783561852166707443288031772609799795421520218704696005881653249444293587084344906925582382385833765007518021414057245272257857513286192778815704104660157569277882610070331479401870391133503202094059866779539881025059786712040384113834568677737413823801351493948758683189504972649013495383723128253737143261767592099355975063319441155485484883757202590696381356714651681163927857735028516556612765982416921120650980465407310503954116569362383619864223066588196928057154054625583850781499498748269693042624253500111241966728384180291380590649385478398288572110568982422258266678645735032469585491009643093205739458889 +0 +0 1 532 1054096356549212854433844559872 @@ -658,6 +782,8 @@ 7173051967940195554257280536479042043827601659905799457098258573897554700956880589901442356513658795342086705483095145011273200575189131337241532322688171 14778026829432832620717758207920676238440861869481283376192906681351851826811501922740289231253685732115671799215873523794595875524613727991318894568538112 668067504300992717252313285562626189380629889111341091830534240703164407858722452235218413940670777439758195559237384098604159464100718268464060833022755680567822699161005143840662079622723282636344452411426226552839822155973011916925207170513568724737127970382747418516695456246080872159505564214904491958943630974686516554785906411149419613863756391212293819449403644890970105617508890739662736955041010715658738393820032566014396707892742492154887137823040904306377096304751108123753609280374579533467459444188258347076611992904793838673073224357117654214880814370422705211653066712982927068215108323247838043982832803519373681940171214501886315441940044454283398151994392726062247895395190990157884090912229945700120937761598924992761275839959911906 +0 +0 1 1 1 @@ -670,6 +796,8 @@ 1 1 1 +0 +0 4 771 891784777631246170114448424959 @@ -682,6 +810,8 @@ 231583736816786089484927226016147767929578972263620494977377884571370600267775 231583736816786089484927226016147767929578972263620494977377884571370600267775 231583736816786089484927226016147767929578972263620494977377884571370600267775 +0 +0 1 43 597446603600272666897934188543 @@ -694,6 +824,8 @@ 4104295260045454815975181617904063417540583687524096503951973213007375671429493052370291608008405377354342405201451646421020861407202042797591936611216757 5398900427668751217850873803494875937404578551752982184373461962988643267134263496913051856036153441820443871129747572123078186712219756428262779956232191 25531520392182917621337740014265445721361411239067575024230568347946075320398830026544382853557813619997106244783404600602273843615454111971321802832323954204758909584487837377147721299793435780761645822065614232271833405489542021999026595034251288100931732635677680664415277285956289483074905242080888390451447804532057853574474532668157069142722357346027408682960953231102254815893377964988502569695564237724002824307525923236722261247849213782126269361908681141220395046844058912660486234093554490328216557221498188571532941534379932605686821928769598267882437940244043304208109576414850186630091377631389750072498035265207407367166886810022150211578030876848768624043493097838663809519882479152575072930049411429000574417439368689782570260468950650236 +0 +0 16 417 51915870197464503363519381505 @@ -706,6 +838,8 @@ 3482683400560148150354019097545843271463498486574340530929160498845628623564983594731900657921818042087045491261078134766035389271551015123919424955561779 2250865723942111784039421608251851432625547218473942867505887413831061852377508665133755951631672797483190995230665622102487996363019684093932899173138433 61866270620994051976113571314671260206546611944748188112014889348493817466332260528520301269300858711370883733353426316921882265660293584980654356196771813752830814863393751514205166225063928375833366427041736421075638724317146660425062918645164125281670322555157768033263209921880226626073745938238353561817422240921335470283332639617981801975929597376257248840471906471329807309263918434948865990118449297463830076205345681272015774701876996655192982429160114187749508187454482524462594626273643456933329535616251439094405771525770802013707141754927319091798774497135450785624609672740195526493570561159214371152346595992797266701839077640764323028946890797349356558919797888149709272434268684802587758176996374949295489035483716749157376093129107707252 +0 +0 4 857 1131685075580794109740493832193 @@ -718,6 +852,8 @@ 1408524625048880495289336975458683532829516256219036238078109087870567897704916529748103852417398524574297919263661719753670147382638802928308999469587009 4742693590966914277133482345622645931210627503968707620206733070482049794927860629080377711683265908227819055370520162972241526589942916768449868513411073 58802344163554310313574978287775834467784857956644339721250016762118519806951148053474140926585685356202298098751139250100138314744225604873028679176491267298420186420381554202221786287213544660030226767383015807559348245256142726358221133944933425749923349300912609238400148112724373683122191718105736524831375412200353861993290888486983540153608895939442657041312429531038809147094126680019476596400280871477208987834492667531073192842174453455717785469219469725823299580119557925326668809782964063680858296559261638980508105364447435571398293447278460758141749296222837597474374812107194809169603306500140846258516651419124556186781001627564581437597576492697808115604193821199848040052454181045801939393118553214307066690010428647360865710351313245979 +0 +0 1 339 813911142051622544908469927935 @@ -730,6 +866,8 @@ 6266577599180715272643179829794667116364415231701874317566806045550798989424764451453171897199722686363150830763178386494247478884029147366386550475745174 19499454418662965629802092201099350207580257918576731805737028058666848388525076659636862212534884659279639848323707620894715396779028548909594207393415167 95862489324824888829063620932019725852833888164695526035022601535004945584766410932268167578549527575073071629132935713944998316919046789310121293504364041124532277236430262940542378173881448492913176491387398844399993039996789279577857848174346427604815454297671230985915025331674992916594895826262876530913916171850617716151441278682147025748960251878981479156374083721491872710427295466322992846907609488745954314715805957270283666039983078879793824466444419938190163155697145898133079802602602353722225107790055421648837935756995174223043214034050566670542186485923300401095619229934254702680429337508022944449649248198288421089834753256140619932771553037115981281018587500510997229178929836152007445007528380951317241720020980457731242414544349924054 +0 +0 4 729 828471727968036044453779079169 @@ -742,6 +880,8 @@ 12148110333218384648436139282566844904693423767379435822469549432550659540325752661673352721491851141598081552703324243494124595306618572675953315479573797 11028869767950066853862903870251721369434866526464337153519928986032553183047292589177288689002878431824162808354999536746934113300550015294401283448897537 58606743903456547221900468885249772291576952030679996097498477009743844995676543590192758644724090079751688530760171473541897119764421794956010728429006280978957388951179210589666065046283855669298206903519798531165135083505723514843194432031489074993214637785036796024933827363001124388230620312743627491315719415609068813186688905104367027578284183684797889586512143811049534490660482523966026899262043286492254927272738622395074038650865166965903827122630152337781020302738480811674375797966826600289037875084256686503563207679731661728079362620463413234443568150076382266727348860029360573126873091558335717737879504275102852798676585481840766965787992022925191117334050737265596965836939913217442685101717248568268676635054625934454260099074919309949 +0 +0 1 1 1 @@ -754,6 +894,8 @@ 1 1 1 +0 +0 10 348 734763819450510610632565325824 @@ -766,6 +908,8 @@ 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +0 +0 13 684 887995200883511538239500451840 @@ -778,6 +922,8 @@ 3418924933199934873321329948743314146142040692630731923496865500679236033474734183436540120875605867521473258874285532970466381831296084581446997731696468 3109273453047763295057753183837237869395959180214923717206774456268927599702732452171437824488600294111292564013762251960507352853270412970588497512497152 88977217200146840664835987057871414342758656226482702119455134566079289759461293111455137678060305324123924650245282618632813746520379483136564091907304118161505302770042826556669491003997788040634250764459343012372640895868893685896302853009657056166286847643764352254944479236872120415948809439964977244216102420715456410411660886545767779677699315376084841335414581647517102345454786883637029530098791042769144912151097744363218237972900918795095222036559877208914398001283356608105215340062508789546403610568009222203488753181052446817053481932306339868837058506301443562692349864882744221053904653187414752280043967264954580774211209597627575080937932571575024581567429077910187545227659810710158840134973106598283417650179109728601466223548158882854 +0 +0 16 284 923020903585570222185243475968 @@ -790,6 +936,8 @@ 7786275362280256985096504919805326940788214494037837259488750879599254096754641518066648702992692840392471672645638933505566197966897842107066681649920912 8618362445903795498495298150872761763162723533326999016941555427533106887247180867507912332927251479902784257469217137485980295377407380260430728522629120 16490134315404647213406475029434823318168374910390512831510506183043332120558830896890815596494806986512558339133075794403795234456629635255196109630302274063596701645127268499059076587952023859015770347837308708846781657401257233464407323703928750607092699546669184153773323322475159132438875535982524264435538020967649556545078439217499131244698211417633902347244248116513105556404055186363737550878189887290194234432316841541132142640860294449814887861397238054043043687805797703480541139181008458487452494632886183551197864883932104816574402149990710531327784104683031823148067071502782716164931902527187266922087618072262539701943603716347752849105290562996477056326299873601871677329339992648973891648562337687129654590330095250352862403755335743881 +0 +0 4 192 132781846299563114295034118144 @@ -802,6 +950,8 @@ 10432168002169925309120503644722046609224368185326214525537866102657473676610157919783033661419495704812662343601179229565468596161053474859566232729971168 4434125550755468286273915949559378521845137875362780075693690876557539422008078027298618389135234122502995076657800647221775819541243724097410850717958144 58879788797133574843674131226486041883043037064364921634336146348882294403645081889149704029388967907656933395787481771948052519303852184993397307363710467889468536203573018705713826463259584860520796926335149895942517048054871254750870976735849529300524514232108704637780155141118411244754977929687460596842209901839253348640752544938339746749766226819465849574267355287548308057135150017728253762852882959593249872280268600100063435528304362920475150321014853691982290820505367135397257267603891072223573315334630909168764996403800044441159417477437125537149248656998496445381127256913909869799043466504230175983072915172182868528863530322908212009681173652253736821737022441593015806151561237138209580283454584751470614981673001307089147844396118914642 +0 +0 13 848 582024649450436441833425862656 @@ -814,6 +964,8 @@ 9512030017005233270085163286414408214444876161604376761868292912053847917535106665754020297449298958739630340441868032179720694634048588859831514895174004 3424474661482523359099400350868558228999347406743051468541630110333927244078257761445483195343636488588952518919760460591527948463291377508337491634028544 65118227872255208530978095704531485836531791966226954070036062366093202114962831327319660285109455888197133761203512225226041875764396311381690994387083960684631953535071227406811143021754477627057151829718556492631789876514561153094036662960783881750912022065256283109433376637350129397107611734206091378876306623078656111427158121771687232263391493393488514266430172677971487821825458132598600699519022946978758903380204148370574856240951611086240298576710022096482000928787252944656591755022573584348378606935374979005737085171301709078465765360521191167661768604901337941395774664950252681168911559209068972333611778924289152526326746867827632109174629937032521660350755374538076710856028955052886565380305045312456930204360072005577652223645437113583 +0 +0 4 524 580845881975944426787514089472 @@ -826,6 +978,8 @@ 2427597878315108052588416153186371822454229878691660809974423528713640874637568365876246285814256304894224389434236414966957500210729605332124313726402355 17899117585006203601483637166090154016991728785619486538375724587636009980913873117460186227173247676970981855052572465455831400785016798907992702502043648 82719099636401478752972883295793152872271583273831508899385879961946763312818213867448814790012207589877958696910786352022004017128491458398678502380092727265352370894849648327689817089369872665581355167087649797725569274446713910131583973239774555897530741710201488112735698863245376499177657901145733481399797327393996328870113233422246097739699922081427164348371229969681257982602491765348673669982560870277531296394337103334897894312101299211803382899983684502590889160634216771237753936528683049440831694982760288677341061831863338447913878280666371538325483664952174202444434304882598014748667048569192505645286173327534029793348718165869908522264528261983539603039105723499993523931967046987164591154463040088382996154836338979631948658199465914336 +0 +0 1 1 1 @@ -838,6 +992,8 @@ 1 1 1 +0 +0 1 455 12835319081690733822122917887 @@ -850,6 +1006,8 @@ 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 +0 +0 1 455 346299262836863942390852878335 @@ -862,6 +1020,8 @@ 6499574949616620637580116906143754514426259529884439117780273025054849187451370731789917263550769050214853609122367946205434263410894715910936878759479861 10124369117566771149603816821574722189892029783289052707167197978669109873476852672835440349606345261291423564961708638702389275798144171277206026719330303 8705415614578401703439377544034032850201217707644163347213448385251820480402064059350202110481875528833463043667310923822604441385001445446052708783815053349633963516466471509187688789589316773369344615677792826626309051716580310906633140773315576308672949910323971834475319446949557690005611853568373950288360968175908668687766510861164934214529777553732432896865185158370237274446566279159090124925721960076023134644068706631984582242437068272120041502784115042808783006043527616116382358734970451299287076148174547739692786708052816344409042256904123745725458827196208845706437968200534005237308917033335162989529814740197634204603683936920599194317277256865413864485841368194284658974110212415023489145311654329202564690552488285659475304098262048261 +0 +0 1 1 1081180894199368861240340250625 @@ -874,6 +1034,8 @@ 4137577240563885180314014646510639308253117303602681600936018963727274657401877961996913350454564200277844605264306113013779943962820037004955398417119598 6012634743225204725211101132320048969685865768619552174466530181728480133292301029875548285114373185900664580122272341980596861811413330588763908353294337 81795937119532106335414628142007540909977658537640179159437059236630425650411885370326187121444740803210715500330984022270379288757433204420162387457613244457267982829771730115530977365339900995108866087275312353663936184818179575223977540191631985263739097531812210312755996680822466849659356805615283270271559218883156442720960075373128962323225954201545893321230436240679191047181572859564297275606464598132233617134504193123508950148217886663754637227759657863229014333138561206386634029631981247244317340373651674534396150486840052283462761691683271761813123839124550828306071030249616370906042368728428188678275642758172811081689374710468896615837529258853907516810148933427557064757233181559122827774230157455801620060265635590458075393637334298735 +0 +0 1 1 324956523760712896376838553601 @@ -886,6 +1048,8 @@ 308755345928398507077827126197262399264414124207949539753718673573534243084848112587571000480595914906260398850382596175138781946603416961836963870626141 18244350893087399850665188670118991037975220133032205465990746245721929325028153136705422106519390226837480732385191993725441112016188775082810504002928641 35497041025578847034501100086073209466536561136508516335013344270660017935868859278315896598293856322904030275411384771746298914220919105038326604256986745062645190294804526675489256642809751675533646043594633436860337913053703417141370429474001608393015936441508400591810630621128843720442719169952498841878428043616134170692538798672482845808628733736912222222835494868718990850193361338659654698100822633175501310238243228627468180773090337145705479830831741295755757245726438863169234409611568762132507269416198114830241213504234567974880642291566086992270545520441074370195803131662817790381334873417850159055327338002481911259609118913167424481776413764325684911684692540815623011260021939894562955348430481298027007410284302139530405351967536881873 +0 +0 1 455 1168225574662879022832991338495 @@ -898,6 +1062,8 @@ 560629320288680383605194363023384807151678143098424596613421718363041709472766750167486947243276747104145109416759625120625677741081131727837587049341019 21759673470171209133072662941401074809641596506044027427359195245599749269615278218888544963788731822407161900052925229605030503595641862078189438914002943 48914350145218439705906568672200367796969287350938182949379654192199011505216869338061795066404508514409711613257148436276038759959294510097071327557269961224657233124533675566196627680457707248004848068687893159393201712113146474154643723873117223111183020680896585619246094543573264302805376451620772423606446526420628061991035935289820171452375284762441434380410449759463426756883286554269235628531755002958821353224373032342079546971516226498682559814377619662262209744231352611522198524332131765194581996840783766846255253469180547953962698030763012753169497800349425558331288444588408837283091960297057338691424102975776370837552120268251157155308653220431283001956686251393146283998549094172293087591626540060360218133822122308383440495234963309922 +0 +0 1 1 87563840629716667648756940801 @@ -910,6 +1076,8 @@ 11889537611764019713474395414522017738805331131412830425961734413527746223621889642851856767739924676858324754442498238690013743634420772752231361918208575 10100837533498068062116682421711269237464416549039194254318934545331492474511664814492105364025928254622293940722169331634657785497327849544082846163927041 45253272398683486503135647480546932526735137482648983772602319829758278426282326548221674861255116095426333792573217354680883747412470857180423146853304197991995369543158047208601197540622717356875667661749000843836978338755449525157032244963760117525923053553081941890120196549770412880975555360904557764314756189571080933525608936448614857337235318443148692573094194685794107280259285183133505236685396056175003692596478944431702441646328891039761273277929456060982061303570556186099371719749726908630462163994404796714299891926613959427971511569286158738862769695640206622518511417148726413303897685871409215510922897034154940725003238330414715650272829271341547072549019581775308154038128433212364492506931128167734571430916037205627421756245756464875 +0 +0 1 1 1 @@ -922,6 +1090,8 @@ 1 1 1 +0 +0 20 595 182776107722364003135434784767 @@ -934,6 +1104,8 @@ 0 13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 +0 +0 20 99 959889322504300279480128110591 @@ -946,6 +1118,8 @@ 0 3245766926972643552330628549049705392854964955772154252338528686239084242071182385973867724746592501989847967320150395945141828002524173519974765401473023 61080681645991414549067490692081334402081972397971028746517907412877430173442766887268502928938956689855686968723305555144818285896267263657710942751602205704048358528758460732296756008804811854842722305639692261245463676201421427021692640796896111199503032898911798682259054437677204216339229172434824743700358776298226543549612665706139787699818996505261338813388342911091730404851273471048067169751352130853775192270827166068955332150833437792442149070397683322292273034999892709561157211011989290641892339659870906874678677504859699231125692278719325534934035201975234131443854930601918538057100277806802757327886696961876993004881817336740781448664573364169350407114702705902813993358826145855515225329878902273560866951736476611475090737818033988659 +0 +0 1 853 801006859139436247401554247681 @@ -958,6 +1132,8 @@ 0 9819440398814080363130785191409752685155104538075120057014007750225191492119731772827023591993721591147390320845851382883568011993500439254883415399333889 7122048118945560119316699160720553961978433028250832356632987064632178469601289924334761716843864521194405971422994256309344299128243345780357318179573891332027174794596349900514436964878897341044541747221511411801379936266000034393130953351626231473024446300205114809692182751681382918793815319254538702558176147904801708426647532177700676433087822991182959261814482654296867542907531806086418523075444098944989035965323104111587337986738030358187241743843490343789019348630402171936696201446676114242834126722172863968855674947640604324144163958745324958813957622562236693952102477460729523924597596293556438095619187584135738107568196111010905928607888154445077963655076780117251537706889532737407608309004227600954352302398749172691718423958455958196 +0 +0 1 673 715561516884788010108823011329 @@ -970,6 +1146,8 @@ 0 25619912338425179981237074026942021799265536991310528535894660424287880718210785582129672576271686161615856398250702958965821900733894974363009685894725633 76010139396677895110827272325655170735073429812754244224065567827072674955856932119584786811151993167167501426583952464280371863780796745748456052461411101229527995926637941814484628183648009917423519376707821313085607510789924117200421530001135073989351921094438000753380349110659634417761484664096117454662720822651059990956245758663429700410864387600527899115840834751012921946678422566816724884299415039620785142784776219585718273085355667734156330825330852527721204878050664943807379704377280623463834377082200575952282427801903821552563762553924876437863681217229193327327952063777869515698432495570884538697893963662646742169138455099039661938773403989337857498529351848559385557226317341038460105140266809753792447714025965171823132637111727103356 +0 +0 20 319 798574734973800499883498536959 @@ -982,6 +1160,8 @@ 0 25671226303654754146969894507457657987204391426702541645624778236755811429128127378887919394161592482970532540809070418766878887011243610093297304929828863 15866606951591235556409191617213573399155927811878903607694869739495905400678992644637518436029559246426846377785378587987926252791949664825152889115083598102400393140235120405417417997457110081090628306335598171967679981092666003385383325972859314383907768209172868582249740126281615082843573939589158718380155501844256488600077946738820515383460955868182422292129795992585952215505240163432033184622635932548576865649973348050288000788639331974785273445844199983043022304855363518084651671719146933165057669295305321544071196137536533399138481915468269791078767728614599543591551954017339053729475630770769438637529489889077938682440068899125495245061566733534687037786573509633820482442842532515449103712758325050642085385733732747184720870296336579935 +0 +0 1 337 1188247491006021359695801876481 @@ -994,6 +1174,8 @@ 0 17855886664960195299137683256225599460539695469189441741138167148311674787837063586188982923974069115198316431121434733749422291458227574255634138536083457 59384566358794087713519036985941921971727779065663226676982961995154491198864950156674000316581952280716214848408093230901933126757201868871641534753628308280252753935126431103884375360812240262365325812639199087538091382144152792974414950141108853217718455335529345676161916298239217369740781198083301965528295312953779809502130360588408271070396938846868179567129569754220713703452395001463867093290041999114172263915537606735392097717571719562218093690326215509153961064259037323365352677591556046507171442020475354888438981613944670146542909526903328992226020955963740333419878396193097750885594896614110979159252979239707405514132990634945047790196417564984004506593382912262142143958951256493283696186469568641746587438284051577412867450570462631877 +0 +0 1 1 1 @@ -1006,6 +1188,8 @@ 1 1 1 +0 +0 3 780 899245128272588436190215012352 @@ -1018,6 +1202,8 @@ 17917957937422433684459538244547554224973162370938960458267029029640947834979519339152474433150005542914 0 26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 +0 +0 6 704 1177162594896717752709689638912 @@ -1030,6 +1216,8 @@ 10761508670374291972420269797715021028414464448240558938464987728552613552119689435329519427607648808039987095579973579961133046464353196386286909020663497 0 45482587854271028902770817885284143581635498662368194698025977352933743933799189109901017793688745577594623527694595604810313504358764575860083386515476807174987923177735804405284473755066934183256004639352108484702274953900333192385269530392210757684450187112003674444177836992150333249054702130799610355040881331216089333384447820718988928025554074304355567887574813315506152856851669230184726480128481499268920312416866515808041382410378316215204974756173877802603170296930710582089613410137158337317994538564658188439011523423780823240606329841082961200433291793972091062343918003068165989458033428353216141929996068678255654039247693104366764606274764078658617636217424991507187568278244109935035828898609479518101929066828346725868624049272030586043 +0 +0 9 692 76435178552732951009197817856 @@ -1042,6 +1230,8 @@ 11097141842847614394079602992178709247589894415852402133624794662338776078636709858667481909108996684238974927213647046033793578164937980468332310219323018 0 82530710943173231626463573325692779692754436886030672265032417122005977153566763311330845411954261860082611069743371135724846952083541297125118407037493050030091643369219829324270394014943329835515994201433775828649245506299733766913929800609741182391963525575197020867022940715414622480667671660318214941584751533775381692208931704572538156619567358516005504845014729061861609309938184807822494453768234138312147725645217994821103263459723465254832283850235782838705125412229606677970164359134170387049947834936747341490606705964743350233898238752785281953469479577105057231853639552966381327604682311651351459053909013509504660605533181768496353010464853798444299853619689055126369510353550151910971027759949464857702231495761241052789668272665559715128 +0 +0 18 856 672949534961130560651949768704 @@ -1054,6 +1244,8 @@ 5599082768478558353474373621584847716101862099962719911376003810521845817678124356992801556560959828813284665370289254359505555309567567683413487963442538 0 63614981716344260887316728944952136895331320691835789808211797760982858050080814744379959772662822086419621105477221657320538493043796273684769585579096177584643239556846663373469269063761585283623405673614268918152004727231417941803827358580201799024176999958175343719377925756364804719730190086604948077995925104080216677975705027083541462053344530267616661507574271008674113036010390145990008479521027421278966059966909296208780699736375119231619806996569871604678886482503296539830582107517385273769007336972457140938425032039801259553207518991916993266714618667514018606860146526253248470582661374014064895598863780107120671021812437399331942125813127174533956650265112004346544310754279846222746362678824781169770678080461547337584499680665583752196 +0 +0 6 528 754710143931888045283579265024 @@ -1066,6 +1258,8 @@ 2287281553939530956352194620419013279616295380484047525310562106105104280173822770723063903213369365468416110828105561770407010047970222328014275531881062 0 22560001863719192796895130044111283738945520048063603412446058847866470382227887350538096696720355715425217113703294078745750123427892008604381522584757059875738910777798922847776950659894269775989622503322713905674484029827036908225927648295253243636588948262687038057955837034631518628503896505484117164018589407950736774304265477087982799532022258738048312405013767357154695940386662807565228396300124620904083969296874790373985742813478204314013287258685560279464175856469039885349100694798098733709413909852948085783605761402713861540847716211278993698573479199785557338834966149172681110440896385904747269474735536523234021906650038473170693630524524884902017976797497627898992391869701702535398358340570017537063259494194026845815788634086073391689 +0 +0 18 884 269006938810274604690777833472 @@ -1078,6 +1272,8 @@ 2289668776080774022092664264319203559647600991451909561040327250000009538496148645073308529369889500343496260137733562205719817974360067449226154885838315 0 55792270959626079454245536536891746354044061015047378864251802708509060407086151697970260732559323247238038340248514574684316824272134174004243988966879849631208907971654413572741650607421546193766202020807183501106070183571003940038655481350482617321765238930755363311752183755302123466676483484756339745336948317667293942084049543762250035888819856859289316485878098427573790906104117375103618312469721978524651381801363881731773586408529411807824733791291961745654550372410248174655751091811290480475297754529147070427342112584772701229214077688828222555110528095105674230455201005627397295191268703416963965223576018402787685948928073019794376927754477549000044207277554142643898938434676637583745436658573054848623282334124500748223256654681856011928 +0 +0 1 1 1 @@ -1091,6 +1287,8 @@ 1 1 0 +0 +0 779 300715359548629347440791650303 102952137211174581797368872328305713571 @@ -1103,6 +1301,8 @@ 16638238834641956112960131003736280741738593054766265118601106882033202096218023706427311810640257941823837170462099179068909971646758601676945280397737983 0 0 +0 +0 215 619250515473902100851732774911 103650056966466853129126116701268879096 @@ -1115,6 +1315,8 @@ 8060703179875501734452397315645371132943842065312906287724986321339402104890394902953798729083389116031469222656762579407462366908520135082538921787129855 0 0 +0 +0 133 1142291584765711146581424603137 224218142599483019744159109472856123376 @@ -1127,4 +1329,44 @@ 8743749066401491218980507448428993195994925213193153534362044455477958023767821426016797793119641242022272990879238224077152409380573039679533424287154177 0 0 +0 +0 77 +277301662095735836746088185857 +142152606337025304918525812319838745556 +12534840175881050541917831132805720442145400436291151254501325700683775606785 +20878764386374173777118657238171357921836373711458087960880076400635863367681 +136552059111960251915276090336099326982899726428231723116111201986184982594466 +1309756871750733417455059188261971390672404632186814094430483190420092952237128472634463119986376912159204339035021972187813353867261934673638407012353 +2943370938733633382605808344901628632951369041812100574435646648657181085629472266341801305958290453327046622582139872251050014322560690522912986433898975 +9585845803470202086393444688608391911098205350216816791932597819794198747297646808582476755416085138620680263905816828708538683380792568203293817246109093 +2206621789143545137374253360345990308199762545199883788624752793974248232491530652167961020693395748368965925754644305556503287697444204056449929002876929 +0 +0 +0 +0 +411 +324570178940368711767358963711 +130173237873606161084081513111146125666 +4440243184057253002058366958949011297729551759653463141908729574974703009791 +104599104892758785945721006587405088655973823131502021182212424437563981299711 +227937449252631589648339596776884877916446709862604265787392220105881584676676 +2761661671097149506426178776418384527810269504846708444400993519040372610318448755622489684186366593808385933251347879225999716850530968694338659287039 +3326758864026021917927985608949523566048578856734365179616807109188697949259297193247893354152568830232368527655546919021919252855447574774424860276818119 +8973169221126471636848109947272753534539663485823225948654863833547893642416253412473354043645216680363593572499550915955052548192583464946608584977309944 +25295172712169986925695313510287246491016523019640348674864055622865874306543756462338800322323361265163416085720907702160935829004000553942038515296501759 +0 +0 +0 +0 +841 +9420399794733891643001274369 +26308239808977071113207244089376343366 +47302805955142258029697650139867929719657651495110021315452033696431664529409 +100219160123634284631294789632259431938605132574157213619083861154062642708481 +82087772153295270226001133350122835922114973611844362548444268958331029834966 +2117450239054833117818567728047394797813051157453267188024371670913736681578312878632530891860285848254755118558052690958479603408892033292293462032385 +2379888884486213427117291480161905955722461874746438148796605337728982724816128290033475728702112284664885760972474749948876959990565603221079913603426520 +1615235102089076361139051104485129565618834035334363566497760617314748626717238949288388003745630890305450300782302497900890298444504361582203127184376369 +13052856770005614178526443656735412215939232343908610985741660157597547881692618783955585903710495256222918417819937168580320734187963952696812226794749953 +0 From 6d84b988ba1fd994168881047da7f352a0177ecf Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 14:56:08 -0700 Subject: [PATCH 06/20] fmt --- evm/src/cpu/kernel/asm/bignum/modexp.asm | 3 ++- evm/src/cpu/kernel/tests/bignum/mod.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/evm/src/cpu/kernel/asm/bignum/modexp.asm b/evm/src/cpu/kernel/asm/bignum/modexp.asm index eab7e347..4b866602 100644 --- a/evm/src/cpu/kernel/asm/bignum/modexp.asm +++ b/evm/src/cpu/kernel/asm/bignum/modexp.asm @@ -55,7 +55,8 @@ e_zero_return: // stack: e==0, b==0, len, b_loc, e_loc, m_loc, out_loc, s1, s2, s3, s4, s5, retdest MUL // logical and %jumpi(b_and_e_zero) - + + // End of special cases. // We store the repeated-squares accumulator x_i in scratch_1, starting with x_0 := b. DUP1 diff --git a/evm/src/cpu/kernel/tests/bignum/mod.rs b/evm/src/cpu/kernel/tests/bignum/mod.rs index 86fee346..69474134 100644 --- a/evm/src/cpu/kernel/tests/bignum/mod.rs +++ b/evm/src/cpu/kernel/tests/bignum/mod.rs @@ -299,7 +299,10 @@ fn test_modexp_bignum(b: BigUint, e: BigUint, m: BigUint, expected_output: BigUi scratch_5.into(), ], )?; - new_memory.resize(new_memory.len().max(output_start_loc + output_len), 0.into()); + new_memory.resize( + new_memory.len().max(output_start_loc + output_len), + 0.into(), + ); let output = mem_vec_to_biguint(&new_memory[output_start_loc..output_start_loc + output_len]); assert_eq!(output, expected_output); From df4a6f0105a30735da03dbbe4d0790963a689032 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 19 Apr 2023 15:27:49 -0700 Subject: [PATCH 07/20] fix for full modexp test --- evm/src/cpu/kernel/asm/bignum/modexp.asm | 2 +- .../bignum/test_data/modexp_outputs_full | 429 +++++++++++++----- 2 files changed, 317 insertions(+), 114 deletions(-) diff --git a/evm/src/cpu/kernel/asm/bignum/modexp.asm b/evm/src/cpu/kernel/asm/bignum/modexp.asm index 4b866602..f7799cf8 100644 --- a/evm/src/cpu/kernel/asm/bignum/modexp.asm +++ b/evm/src/cpu/kernel/asm/bignum/modexp.asm @@ -187,4 +187,4 @@ b_and_e_zero: %mstore_kernel_general %pop10 // stack: retdest - JUMP \ No newline at end of file + JUMP diff --git a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full index 4040fccb..c1626f99 100644 --- a/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full +++ b/evm/src/cpu/kernel/tests/bignum/test_data/modexp_outputs_full @@ -12,6 +12,10 @@ 1 1 1 +1 +0 +0 +0 0 0 0 @@ -98,6 +102,10 @@ 0 0 0 +0 +0 +0 +1 1 1 1 @@ -124,6 +132,7 @@ 1 1 1 +1 0 0 1 @@ -138,6 +147,7 @@ 1 1 1 +1 0 0 1 @@ -152,6 +162,7 @@ 1 1 1 +1 0 0 1 @@ -166,6 +177,7 @@ 1 1 1 +1 0 0 1 @@ -180,6 +192,7 @@ 1 1 1 +1 0 0 1 @@ -194,6 +207,7 @@ 1 1 1 +1 0 0 1 @@ -208,6 +222,7 @@ 1 1 1 +1 0 0 0 @@ -222,6 +237,7 @@ 21 21 21 +21 0 0 0 @@ -236,6 +252,7 @@ 5842587018385982521381124421 5842587018385982521381124421 5842587018385982521381124421 +5842587018385982521381124421 0 0 0 @@ -249,7 +266,8 @@ 3456644180256483296524124683106942480722843461305992677766332070622386105650335816178720659995652203171430416751945868032819203139048842456194585731900908 6658621772694490037410881754126282754619191463278934006643576166056374826395321115677201742806056121601730868428249390651828408651815409287407418905560894 2188719266686453452930405899199235044753192686954839466176162624683199938127424638750308949204554559166758220326224401920489333667474175603924673521175569 -97683072410076712392282066589062765759142693107292941896505293584188136243288109019576354936509509922977328660487195240361272139205510222433941017334790678007764542793184659980312059915447722823578668568011564108579332326431723751410142184277342914838944751536309663705322838157117861387318160798897161585596832140403965513049019443014736754070054609736667260175758805144888061962097304053358670835773333470540890735799904230791681702069723170059730994966345549884415945422800168211660316601223536176280443881579581601353735508758304931277498652094516655270514463040776026586550201010112790848764931894737145319055710919828903365167548960625995539691849361659426748054745341215957250295921172194577332300749566307355206009183548481079880848158140024332983 +6123795749220870070888957688126499811687439102580957107200324670516588221814874336490966980509479995815372272026912905873172415251713982723428918913460049360806724424126068570078686852874442462644585471618684175096178614463856372447395923736155404199722474001519774161213336837801565210105511353961489 +21733503076822274238215696841643994124465086209245797663103653662160183433375325239843496825811576935617701675430794656070743382504699894663869396198800858049123949931636855462200807567378261808374350727356914491895652225869425999023896449493174464626623879583913773127532285149008185808669981457659175411110681467646497612200879789944122607924142423967190374513947785974855081897919456043288039161362376188824242511311222201467365944959686354630547972 0 0 0 @@ -263,7 +281,8 @@ 2340550614088062323035521333507933205420749928049240408457893198554975629380160875595843975025528241912895931129450956293623201875314056184463318790281141 9658263392514739927662836103088426769134800307082054844647958520598804818351406352355729785509682250873421347556031006118797390529574721358615425274369903 4647428455414528310735419222346137778331384012634538551014412602117023622880652353771726881116679285768237724443091476402706202263926819772616832419102721 -28906403319829335579152758638386875882157614960297137405961247837759673945253015729546983871627651295299575319061533798314387500195065807539803353638203395485986713693607566481778609628774446828616734151668234602307947424409538672904687959912738570330185363904523550454152635659490551290870515246999942195502104118152301334700089287366991317719093433052486678593858217226842307981271549071491620802771924028173932162208416803577135606285968124070284901637877651643821446019733885049153989665296997992788886918211374075831435931210077446773069558106221488521309239497226225767367827327143784702703425755307906283612559634838050993457902429094094933513319959004350518056515716806784625284507193189229626210411741030529099220711533547813203461920864443567261 +4105943439683327149496995432917731734349623330617416765444758819531334403459555965005600275959433826680513222328275949889828341311187920607090355380046540579908947040106371789193081113409035077098486792404385747715667974409598976733840748313362165044117491316370103556122704636978835764926194391187457 +28645769207390246795138025157012310806200949947458739337397211179141156343070918052774971042600619689369921890873698767518883214265612034430865062720501567943382208222029969252942575712244757709457154177152894494535042763023966349374143513752560929258976200745379909865727692592552226677876935892285307870731885285227994511501363645824725317338462104668462291125838004650196777287385052153407326433125418796527586257544647700218132360787318720777100831 0 0 0 @@ -277,7 +296,8 @@ 4109950494713993893142341968876859588899697995149574488387185284937507905151071268229544837244462536429462991654059099118254521939414590134998340719446475 844468128021093833521017258842640197099986073495355910940365822372902152436005754957689228609364360833723273104884193579513808541852965164830299937335266 4841490524461293458775865719630252706317774131797304941603107709106391551373400827563106022147424343461775948749633172375219539070706909069136692738510653 -2740789198296345318965111850612712124652802051718746728440158354114594129999474575422329095265931082725696402694153115277645383596764582263006721610854081043248870278564998781931116935500580780582792000279161514916826840858575525432768051097577477367255077045382464021310113198660432638949403898388170795721793065002216164669679010725866562559739695895046156552765387872883795328098201847555353205101813822718040399910552301303131582151997608627639676073359537022621281032462623358483949826772477933699237569645211796888270724678872987960765671548627563068593024266312400431519682768720409103443029801469657858538886532661680709787379202798150567139685716652711550210175722552439867825919976479511936022577306731016108116152385593537502616696990796522755 +7273173343143062730116325603650929579289657910222550340667872300408581237430197382410051906687144077202863842569199267502562443871512075909613158282763060439777587356925584672588460920490499485650537891223823337073005846524449165906099576249848470870580763810627114753982636643198831102678792829914941 +28046651509673296558629424584063249731669578718145238261130675472681779110268140721442904856558473621167727640615713345067811595168883183810857635560068796253449136272338112002671317203041266904678503071806393932350113469015095445921306266450082664767442783548486830460889239098543969021176454257806145698621983814164824010062639366791567674987083305882183188142795298379711201433370817683665471805353684719806585009665707704695044458674998071553291930 0 0 0 @@ -291,7 +311,8 @@ 1855138457669725370795603609175257635850787505475418783821961151316324964106211402480574231460442281436102848418947738954752184731638654925034081955953702 540244355168038810439245856412365092477075663815074675095751794574495975677637107674742162091364766891790053303512224504116561928038681836474597949011431 22981118609480295020302390537085998300920429526471726567398293023445956296114258286587907654003543675558782486527003079440548040281611791112262372611325953 -73941510060571769808707847667790966361814661795164158907944820368767039175329325204318632328932777023413894322006801235569878477004331269927355367279719698148339549611862266243948248034957017596288151561242678219756200772050065651639668126957338646741620454044238313630119096517295028568676012861463546531042912418706583467447570262205402306052654170522693798233816940007926095553081467230774677628419097478417656740275827661249952779211901082402701984013817630510703444381158174601539927553051608704757704256329593150815404929742382319437401751432803111155121722314969548641096333978274402305457624550606359775467371439424755012388172195256850392440613960542485094267479774582498660391674109469751118744651961944474483070585106972705876377013009303003480 +6951084942072485004602792642768728173731086340286788608361716458550264564967198485402397629024961093884371645054422216571333979237852755889053521204926773487912585360977600077358240969038752377614031729154197921202596341838056184283438478913472604440906205314054471964590715571751484579200485577195521 +33110177016061425855873050546700017053104395816945007989361323145125706671247445069352845357430211170094709814842881235921295997550815440918489134011703431383697905373158706778267396782608658244538288231998579363509402374934461434235027334113339168112113235815389810790459912467851237692233387577938141749136860402850772218835907235676691685574301095898691939348359786379380091090548413315980192736618829302554133559996331787700989395178469522588716520 0 0 1 @@ -306,6 +327,7 @@ 1 1 1 +1 0 0 5 @@ -320,6 +342,7 @@ 908 908 908 +908 0 0 20 @@ -334,6 +357,7 @@ 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 131765835135960660552807451524089028158233849469678584969822208 +131765835135960660552807451524089028158233849469678584969822208 0 0 4 @@ -347,7 +371,8 @@ 3484767657771443762420853002633790658478025026595023030399445962591501743459655114168018705061836715787328457528577115561192630399480939905028160741471812 826369288885297875981086985856579353870084500166446900173411432842694716669231467968748002518734902939451616083284004742033317955616293179658208664891021 22202087655311450647135419149250531087927146350676835345655785380157598138557194753184373294689489916297473124960377821312544654416163136210039001929744384 -96326898017422549955901653473833317437779055242533369421502155472853312686359970920631618758332572373344127788925685357338018927325197920383756639905996985594464076611884108612383979058239243581333594431766225648327089235187237418565994427057194424144230986856523397430803984945243481297655005737624265563071611038633687040642892633295910225235789013409695764507857108219593405978524437916413344943216420760961385716325465327198936950858396311435969338610001054630999456127724084117584337225975391887983455600569619204999635614531187357888356383792407464654357840556181154590937696619387875087097799731553278646623958202450683045055334559548014107490770158063376348589984756721663474292053996814484159314973841417990207095034106982307493862880629121436691 +5867290145612847972373997073309915340902862989135230389100858222930181445218524888102172986857355110271349287326639814908840476463002707271202642441777343076399506363351555575169003649515921567023847735339868023560115487675698958077623452675911334000167018425794800395206246266829715066932889888227328 +6613183629137681279087117062720950270493246965665653353814545527865422606963860172688377962562995370224937823909402574900579151120138866568996446233013596125260317722731462888479963743727090415264356847381807593700110142796538796057208396283278444005900325957636550564820775653606338375016287872257899328947954420594292130424139307631549548532332505581708062755002798299585128036685598543159971540741219646857517061331622628267531564244017650020495747 0 0 16 @@ -361,7 +386,8 @@ 3586935919752527353984027215088868451772937854013928716747601409083300019440067660008036473811750553056666280422401084064457379199486614970622678033275267 11435172354316143741773241295887896087133672859698695578907055835282817586890921066517171600518967766241323412371609567006600523639894522363112407210324509 15149040910228070805694652326182650730845401534077532391632591405118117144643051256922675471878552887101021773709591676502861584900921169634374950540279808 -56355766588100866282759682860797737644333456486609653821690145061731646301509427532577235211073754179875805682373375444169056701023240723500943049070332395713592503538088139163641332470621142182061028756763699330098279139021193717395765578924738553383866433961757002615115656618107086139201371155417227057833294387363725105804398704482830941592436648716775980247000000269741607274596027979588268573128057345637713854419746154790792746601966483920954150371581596833034052802813842628620625504186679387894821638490513018094217182975985101634425625016603667727602990826149251788162518904458942322862611953393619284289193102324110779630113399662848749417489714492032695738284419047277571615136307300694250850975078143754035182602823410211073763907416991824957 +4352157484305171917414400736736974322230700579288245632185873247491184195730898991437344106792548923888580847271187361373793947913900504263300740461685586606358268444829299316120497158281612307205034189058550655426163375786508423319573157431875873496129188997627673849109716799860744235677774874935296 +24655669188850607011881278212500400404795975111909544352042335778191251712079013936428534764805902649880208931889745231758199080159268053714657146238568540885026847910322826747799581068534312565470606227666766265055047378610529765358823154325332792516751882522879055713682140011583363538951298044003038164972718406208736221386819603161486554136555558914468701937507614273119563961498468609340048830696861579728696267046957787891673696324284268296592010 0 0 20 @@ -375,7 +401,8 @@ 1238216679956500444264616028232887647747940490327785007262817775307688862239704307927037312429375849475227131933476467593816834523153314124523020288669761 11027839566584582470519059073521721670466350661122931561173065258823257321580571220589430064206794766082774897831215317085884716390531116370426677289293467 2022634134337910980433929460688286697109516578140587883097911933500075648632085115589857581520940210394331242638360018211669767050461136520845948293742592 -104434002006843236008977680607322179909107225265723195172106448264775516650476878743833547793134822307341579260328191748266784852490161978530160695975684513538749150196514786995025112319430605048357152763823300841556582239612109067728895698905501385995876685519110292901541609662899550868216317616138105858298678470326863134702237726421551517029247749909571485746296095446086931717436380624490524897483943213105857255382008413019679737361439910325961856292382954474416887424544673025993513511888208735498436773448767939462642401895140762934543757089989225250342650950389055472793689331649383437755553290743552677603436417327718879340225284742201264894059121415641518774058619813992793525299939440882356982132407391369731777608785484350813033980885141899629 +10563633569776338863997290139173141475448369840952853889830314442522523629045149771574493906944834062931170774068081579834010118509008087930549452650473545745495642812824093639365842736796360564731533873032609439082530461159518786091690259460722677617446344350444358408993792066302845337558798580056064 +12824372483412385861669199400205004566724858538474303800494747762440269818404951059835352877380356415578282393020015717678870100435248949572316256128400151457357751827937645568676301032707345577683626030686702589840795543017433728119877924868065460364994171679438527788229515928801213836621134264837100427090704057536254578168099404041165838330491183445948965724854110273982983705590693431410760655261855587976233430383255504302646591767978918856150863 0 0 16 @@ -389,7 +416,8 @@ 1316454184270635300204354290028403652975569924791362044247281669809677739990181839549155145392827806973474851174980544451539377747682379975465127356763282 1438923259930704879657001108769207409876637192084506601145086731796010515496862959970405934371385188574753305943073462813023599491372378876317837370133527 3751312292780009820304966556683277538490745683704566160236438372682961982986048670343223416367070064938538731816396930813426231559274819821553090255912960 -22245827804735705220117704141226501502064071390534072443304730331219236590933359461634355480686062688856652758824214234474569118470794815179202389882960630393289571816102623905452982847756909044174684278809183441442368980646940944033452129063556227674889674053321140347856710814670492783918404567115943752242132179948224781036963934893498091336265346815823342522106301789947400545161838051916557443788755305106534416055804785880604630383100935891307521128089394000417311935481221851817253939762456589711248274272603968362800596648622527005911004624214546005361950076957837412463355621056287213223178075347444917257993070579220268724782785908266671543562947422542040620358371842622681799613531211436766739540220187728136764807693542730662249246603715717954 +1940812635972614747466109277992726340848630072707912304640929127912329064087768370597314351590495738864766600213011565689114652892971392013558976325205708385347610787529794002191911334996478270010718764337052847791754345043741034784083083057127201125434592632894903882614831512194082202201086343774208 +18021429550902313767357511567759601756356647595430959756983217203030344977480124379576430774082535283607744829695070380577186356624450300463936384113907659808083311741619551253897275613952178963423684191041978549151808016907300923588567042148170623295160006737511147422878843457848402746737171046772562256330802876792353279038296767776587843369343160581335263159088902098345089167246852603087883635586088364841422928542822495523562426663120058625130224 0 0 1 @@ -404,6 +432,7 @@ 1 1 1 +1 0 0 1 @@ -418,6 +447,7 @@ 1267650597867046177654064545792 1267650597867046177654064545792 1267650597867046177654064545792 +1267650597867046177654064545792 0 0 1 @@ -431,7 +461,8 @@ 1077242566599992264249169571444336551411248487528972966637628471569432402384081668659908518747150256909990581460430565820193233307152827275575539899170758 13073126603118771003805243197447306343271660677454831683154753707889268850436361661628016500641989777790467968280342772010149753216162050495370020985042625 20998284069276981893190892536141895412205721732777582241948778013718640245971369156599887283883776856426273476192138787335689583588114031186267728857006080 -145542850807497848835319178145854049254749355997392611232552085578142798867040512655869746128273722688794373277401694240068639939714289029241882420255560766785421263830961288462589671284715213700259981420839552784433954764136129895647349608900424001098087782010788194049925972037176206755004721388556031373292370905301046483673732115270915431015370122027913276559667416729060604786258013103534906022354439463657079061912817809459399519217831107039092600535346674227177324605058446151697792280617616240531975687128608716128611655864852795243359772002145334023510826244773813417705825695275150689101537745023681398310201413740361940992 +9895687224941938536992396259410735585498593485949826080868857632522617767715344081138466212990213054852400162837201310103538489800752934384336855267244623540847988822661005638222750684585548680702427543946047149085737687298331380026993105619948605279977576581565502199750299350287074957960820551581696 +20330471440166965706846550975654713890652417870226965905923146732405275304116721701265925830155132264142742283294001589707864787012405943213404119056019767248830063561795881859861133225475226440778669219796000363700993800365618586534090055278009338085683400928935050079339354878794718829630509418239605013719652286315425501679172072558159972643172621667859406242995437705040600030465945478758984414424005354845660305153595541783513391622742931412397213 0 0 1 @@ -445,7 +476,8 @@ 398463165885851265042497914635418511071393473395199568610621293995767308754233006664812655610002899538162554806154059048581305437649155727562069976883240 11845528388829065193137342380492024118612741433871500160171557205928409375950091328760923663375034610212896359622832576619866946421226527978810823517767195 14358105553296630195074581259093482904061967322039003650287242246847189245898106579740731184467142158444184654938258232190794449000467281976153220954718208 -29752262246259984678162071014197346968143136331663455256981077869842278686037898830681337972402546323960946254640523419175397824351219353528741213076338024666791105522838263742864055702639833923153008293117724612975777700118712172163321970946497599246107858287141120189876164900071195554149879560929714317726886802213377669062443329404613286649769284209181705417929996296531401439508394294295981454293915959331276279328651326916467814126531151303158821906765519330853044852025868724455596200247310910196642038596122167329758444440621256743172719588202406984180471326374255698187674614229475956485349393277466831070800337767440086480706912261115764441177598645584859965475859908792264470117807584960743322003648528490225730990797216523246007325125660813792 +8724046093635123581045526611633144774030370511834937151107124782757791671626741053594651970417496109952491903631645243345303037829497694196648996824200842520327610130549622341880795147265298435073802163280558766387420771897374896142381275499545438532579692773311139765116038449092364593363996255453184 +7405751147045042170442233630583323728853684512846881489652126352481138580343808254155794109418214211938178940574968048906922983783473775456657957578956020062439863911134378708160968666080910153080712910213618483308281268671163181505833074812656056876069748103205570600234366976045578890131475420080402034328956554170169080621020401502037844882798216390950223171848402002782939936087102304599378409563146797567777945011228369651410924564026853389623899 0 0 1 @@ -459,7 +491,8 @@ 4631405091549513365618104032938964387036004178571962489969520427453823044584554995003585135178458975230639830757208179222570849484879646249622084312888560 3444397905407459769678888603161852413323651620442902175963208412202586537665061311535470334927067187735566811052881866689633902610439151941964220310971721 11022665256141102472940378463699540949238908279778600071282259749712264960911250408144499157327170064963756957223649027433072458668570655608803856874471424 -81919800719046671517207878533082805186701437860813948669526605848765879544474579530529213258319904229463427416500034980139071493540508610379427202516273597241143095130860760643788268993138393873688928382393660799195777113637555095197708201349107045094113568679365641988474973555339779269195693828793499743438153464500880227617361433873295240468480091950267597172415617173026834985248894403081410665165176999289507171222751308781836602163165730218190683421881898534701677415079833299850716047375983171219380868596376070770512341426910609957412762987411547721228138660322763891960946563558118043129184649038871557137165767859126740489391397423454065954530520094206892394931511879782267862690117117821375879839535619206923499907870338087896184905875270865206 +1149493853622624808951893133000311601994554292143458692563726487021442743023464156391272602913618081421849882373383362805133207036962919354651311719256865291542887462144185133870512659168195548443958858491083766172641138569350640961793151838633119997925593177565959971136032627767125937725101431586816 +33826235027620277221304225387441637043664748422971678909986538422912010422112157161893624219767292791117193745224367096503738217947106120516761159479154541434507081629430040858090956433405889392516115304242345520261752268880565405366762142190916629498630348949119250396008683103444433062400285561745138697466209715485695816216568719770239333912527091815214766386375891923409276947021071960719444492160160428059721106325731604292930332234337842204147864 0 0 1 @@ -473,7 +506,8 @@ 2606640266791684811701307747992020704987556721798189736831558708134786779427826595516656788456057404569214323026273791700577064277010116095681833143649967 13236721874325271723025473459287198396620022329708721480674722710511848773677038674125983763343329458361710367424043866874114509274517527946107266648826241 2194764262264585667059858125941452105865892742975859841108712998947329687982788884647082000066632025028061458492389933022294535208755309187928296471396352 -57355845567277631605466891338726588644089168231176157542837482832445739996777264257736709708719870652751122872815779613324883278513875916648714007640679582725318528875933814419008616453081735986389172535526171417933073790237448684456371375012177818371017323800403026152821936870963289658435094570449606483182790495084679923580056098533465388873546412605658044277945663984045593268127930808295095416816320488700035120640634800027458402856427447416869101366825313425698561772279044096387622248612510184764590511957351321992760940588152562393870554012339866893305722152910751088759230319843257735303362591220388959031206648585192806326375249281349826218061542078179530915004289316383242721047093262796736375481154941024161803411599260123590363345661492356322 +204309344949056669756457560943541502699162518130681389120968275752795085274348261696673034188427085066909553427932479215637901119300398120607913517490261871972031537818140203177045230095689669755307530773417745785587153318345703950240765166902545254968306769674012995910371703479321012180805203525632 +10264690826749513230358184346151757544435920255861917426522952736046646856221133004608608156420505462277842900802805838197750732768067254277504971522375036317591854497981434809048391519641178668320883274044427240323533445722232511793549340418570864089915044452302975506872587143937799291446332426997988486186420527441812688737993113263455373353444533552218632449194597995340604827994474495437980620590990737309478013598033891846127947111075468737667005 0 0 1 @@ -487,7 +521,8 @@ 3229174536762564836328011009025477898799910197080321024421312234854337921760217907684033379377552188666880062823173769265434474194314757844200157057703739 1423443399352876324872592588473564301454095472277230446652620290446968276830664095418889947537872334002573975742103104497418388304230155249816071500187318 13271987893729173924722826693052254951121133786126776376721905614595108288958742926463506237918989779603882913708829786515628223071604050168421092211818496 -77905163329900867420366537018313477469905867162687873813393972295483850618977227791693088449798950674478036536807908041173896960311217710308282172582393944149677514321195523061240702828647496809204345189326973455270189572598303985175508953019401483296366422730919952610005994556655769831109807353377091098573022662139773340132455526518635857168244936106911312371715079630324434205701454925506932022716037033236074043005019646714876385572906267836713196559389143711572457627590778030188607449891771267696070680749135917564518323190360612364871790463549758918603258303428611971436568217794166218285910235112620619466021065907142038809788800937452474220801409964080345487147019001555645524503805537058212837105068645433031569147212247780129911832438913883087 +4601804950488826494167685270760036664893236871832882663322149997831635784436681349022970436277158840767511957327023782099178816414168280990846944956415328077143836700852459969097230280911772452313608645578171031885121285719728944681182534906015347671757933737842458574792144739909126764366189368967168 +857479341893762723161505496595417165049229108770456259194779683064981414515307526837194732925160817384742675728910002446344631831783238186297049084225178616281383135711434226661298337670136802627018979396403252157951565007991996142431686702381810961834168285921445713777780679851079387977357401452731948432492393075599084080144393344786427912661179463547435908489113931675491545959285551896625752610448451638448866450487107364387582471184159571074175 0 0 1 @@ -502,6 +537,7 @@ 1 1 1 +1 0 0 3 @@ -516,6 +552,7 @@ 340282366920938463463374607431768211455 340282366920938463463374607431768211455 340282366920938463463374607431768211455 +340282366920938463463374607431768211455 0 0 6 @@ -529,7 +566,8 @@ 4274984277410983807532089925150768740931153586735292491383528412859129258433112273099949231101888023707157602612028830310955239728286706980227996295680904 4270974226494341897280469825731968602385022467387106892501039803249858350601697035152008485439522684257776791254316572547412071137653017182505839419643661 13396349486729820333578617551105577176007659045388305976467765207187599750765003306881228272040491956095560694041316948995285357929407282941862450720407551 -41335482013742092607340811393696289265383491659142322933176202133259802321593681034528755929862481933532393128757559300673957698811146130096420912757069006505560092013193058114993341087169760011081108233127450523524951040608820702691804101365559446397551316177148051517733484177074821304382338437764467306979862063585555745663882763752228397056876102734020204479560221614187264418308618629620880123146215622627304037187875802728513960072756165523453677069766105888884368223266356453595038697920292826607321992884044691584622439589759520114123421788741839649085676566641773228464920934169309554870587864775049223057007191810707214225188647666288834463204299431877132150564481249043414298411851323421333913909136986057992835748995108031438173716216778129698 +7272107039633935551591400893562218992924676126105717460127870788013015797432989950658439810996946118473016444182279548084821341534588106843981486932573866517856077154029000374861836839944939375168692527383494491021504979898639557323084128794258468279454347871141949852954622679013053097034606228537343 +4024681230464577896473641062977638052721373802614679861781599094800123563495932827294337297078407941193782141971643023681636515761542479169594195464691208343312685562380387487284859733536618386758347477945214430213026727223935953464725954742778965827480842612641410510935813810716514672572547641952771526945317395473564193078364064275666028733643505934945383834412116242058173431754061071146756970189972698298803191543547137198977609076610984071659602 0 0 9 @@ -543,7 +581,8 @@ 1412681115817651652595578657596182058840351787817337255523617847758399731969803154217604617416738018019082279140815098858103221944816565427541047989874575 4658367006324170812599422256080523502806559591300942419231897265664273942632706886970881430455450954648568107656318501922464893981721336262565505150036230 14176910549874618607407657930219555895908368234965503682114333452984200436110890119648814677868732070859714001297650338292337460853941658691514163789824001 -3981590997528577985614013626496163269309337001530158828834919698707508463533911554477117533902325017572915525754176662144767060171245958294730597431813358362095749926259432146429268064183442642625483652372876461555552111669528698715632169681920785094541248195816649255512882995742569140939871664873643710831289778166479150632763297994113176828816163829137609722485397222557029388537555905894840696252924686455620903377787500951900791439866463151002257292062493531521259668828212238177466630166755813378978387753495507655220937258672560809333463242552800990330533067696358587513958431815046133411714898659555238120452857813163223926948860131697571033149747044928872650853564255699945166792002731329998286732647104143558910495746437412765192212775849994225 +10406141366637179727319354575345523585198131445101199614041074944321283006099873985593501657875961054722659983805551437203724122242706464697758320434979188004227317962713115722036138880945569626619984608791769942492732939213456452058202944264921993463328233802720857330376187422666409410692321365721089 +10395612500766716889498607750936120296402196259538392550447369284462443521703220089793251095458371323061297217472250908800671528775762556075103359185483070524957305359923584052804148040373365959462663236012867000124244297047788081721144621971838346991977347509145949856725062202597193816565726641315796367190832625962761358471335171016260228986247896685407131636015822155281779300035844200755378496158753851995591046914832248761433986938772195242877368 0 0 18 @@ -557,7 +596,8 @@ 867054567978498531065761454390276935399048293801759280371014301861063097032842313817626802406894612171009202210526526325159367606967184116106222709354994 1139630468367775490336631812613571548165746938068725127033848437473514644842035232747054391798198457303514508910901267746988126523368144746838663920634335 23229321847788976756725283113649930370792069582610592470231250035730463613494249923319913356844479204498929051652932802538286625056745478043326957712572417 -21487647700948725770264219795271945319749173192243211453565596987241176737462250667633618886948279562252171101905667946094773469883315171408531140186855386367646249336580544723963373739798434897480106621747141407500552065611752936446513575255452313224578647762353090456207919452697909630833138121540651400661437851470186602006938775128954463677340497236474210542169245851888174674678830034001396086853856173586859326673017624988194867397733165469207954391033672813066099060448147357170672504662139485543607498255164955555500404555706050039769127136110940772239631000421580210911841692191756394540966716847875044874206186693212588146722503861824552180465617343841495586000134019723162576895089813808176808430959645984761484461706924153776124666379090009872 +9736393711512156676697476147793419950291123704462141453822865116456122510755024608271599163197384361427364997715319701954677607307667967970314752567786721165005692082957947082637259982017311319355343061387874272954404686630047193927081844593179586832512413662625777018863736941974537158057318938574849 +29060966502289446762773527309129862532230651461433207672335349512468314509838153919700009183613587271911577714742576064666717735555966747507902189346161650683338259890112722032957837515796161015553488353420265757652831337573527786397820733107579265093849101520705267722311390949184609843752198524487159831619663983822993580005359239978622465631388243890591655090541561296753761373713020979145034193471076120681878728773637249747647754915387598872616720 0 0 6 @@ -571,7 +611,8 @@ 4592124389902639952157884879500633941880823326525745966966661569784155220592348399170518240885296517746840773500441608980855453698091666787607843899145829 2534000532084385254011173048792691142730414486367806853286959714601853302234763393270798424710144792599095332446397093107565422159020315343985501774159892 15542028513463832582045168836396386001625310864606581833373826691519685781220976702479707834361513658452848273358428791133185408252751328679278502490406911 -27855593116714084078162208384054695954058993655347035442442179921961577060832675553361363768691284076718916857364752494526844926555439953895434905171819600393919839632321686484452963250758696733364354962412703929346121448165936594763979749743986180482780225609168629837008693038338408977887230386816779307922171459072440924593974717415489081076605422061521481900028889163041175095249269917613188334409527500605896088131198525624936674252007051575485702484149862125584208439328630135980638729947396581292462742088861126756410817710170706018291317780771586734693798945816799442649044357722598789451512849026273977421119557083044897445609719917137143831367136164117890467710418451810181780268537911406332672074241783568820460769615890093335916694542757288864 +8412092699337531037787046468081884678528099171920466557150153840517555441701513747481625075399369031563363890720070512929533552898722630769019938157826781770070834212210476738149888508884995219178808489342005439633046794302879951435958690454691212867490392351796728559169919328744714016812403628441599 +33830106619343559855814362535589211924203444187711545573142435195593086511328847987971132905556265209639736610793615201190028737913698317064723958072416856829114676871668002147741395866264126547513200446705626505358831619201264825403452572963238108829829155602404009157481163421152595415563917960605621467418213148184629070795051181898610631600475141956877575705748780551030079535279390822434842453037166286438591706030638299501460332593582408355701860 0 0 18 @@ -585,7 +626,8 @@ 1313998427018914497731975785557000192540482097274033470133500010806607846954570954898528158955314391602627353029912678650049483923494107529991028097123237 3558766711272482011504448167665545486379425587311683496485361619290623375415884515332307272266520310480366471739749365076632262898225547952923293595733728 12553285567146229581143238572266763310070996960196734618418238189114111487087176302379917708160855599798506766652438515952406574783180790667512374443900929 -97159030126633829597136097971952095447819013982449285765934773565865340571860394947523612579798472319543447250648137552684505225800254817082318510333085200619841378709947507256156769600212492868513841001182586888796188714995803932972130045022421338995588284122277277252253773904930943448321203400640850726145956154506701740238971182204246652277481910635653257716342505752786715299131392950755696825083787096420904257094017949450230308096656371015076532528700124758206739955106033591193772505444903595304186731720399187581590976888363465586491099855056851754180558610125245962410906033444380950412894133308093881338615037037363848849681332843054706412988017518927595434433405772857527554569413308034400064517677000618708750917221012796646872214754875380955 +7334817924922815993844247909475070087281744359403537502526299289084906210615638233675595384256475356219608076645306747447902878463733829119335042011404584250731670549991672963716637969622660364460577985065151746629898564582075539489021571565895740532432194811300868623563387061791622447110534725632001 +23782765486299170619653377638001085226491596574584464898704365460889585549109410835130873109130617681428671842761358877647827448636728589051462502446489865488918684639573926641287700719325755142839567735191800755724523772975690463187286534957742763295127666200814136161150077106827630178598134515070629372319788894871157470118252128383759870860296840401062420257746959094446951505893201604983152709936368275205715331071029074242829807922867113197544311 0 0 1 @@ -600,6 +642,7 @@ 1 1 1 +1 0 0 13 @@ -614,6 +657,7 @@ 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 57896044618658097611351864738157061705262361561497619362091104892532012613632 +57896044618658097611351864738157061705262361561497619362091104892532012613632 0 0 13 @@ -627,7 +671,8 @@ 4718242244578560577933620411853546035676043730739668011742858611491785678155178214146108560032528947886096115390359535573786208426628238424552910518225609 5354055707309912886614410393569876624773886934053676926684306993550773407750553762949175437211369217571333055727536737153756343047932603108461352921558471 25365469084896632438831937795363726978720559453448504867481253590410035300967847867532559492662554029011867176416570131146842894254418120377083085899956224 -22619096124871383318112295146842889073303814371605345095383233795170631479551746348815087421524678717453965509455660287838427423847169211714828596281997684789004627847353198055765599865486506422329293807467645077941773514592600738421251976380577575882032324559233081705659227219112318455656983110210809943601933625629880644853490850095007658538362417036453726855372348519767721147063930317955475407601904264304792774876267561255494505090533363568576267962083615004621048135707122075251747344476975836746644988257090294675499533514516099932667526906076602510814454355743316358417647066752438499266782078096470209967559276168613499470451000597854188801912120661390116619348790746561379486566757130299748657105161796124617016203782579238850942498672523329752 +3757578315429890131235493992649120836389777957623924867570462633554550213501972098599500200214418806050260619389176706179192857127356531256489639401245300261047944289856878017480929565003165920312519588880225017152460044735034054827437950584392201188531715789576969371957511327370055692497232100065280 +15253647830407583141547363309274688061512324567554978156617633130357138545424717528865172974543531851717065650176201323923438841684204225724333600965120694028156933393649297273989140526164630013338776321111358526273453216724232977621477413581907629724731139256634361519074694441451017597636834753579301989604484256575167632226812528730857727215779131743352342648896678763239802119364145369163238668734832577049562494126042421431166789603595812731097644 0 0 1 @@ -641,7 +686,8 @@ 4007316844468480444786209097240877242135343232573279363036730296408578470321526904806238868824798952651885510964017728127623908601645102032546751410140438 10809419853862469069424671860661466104583061712836069230246390212316112130066125544420392691125603322947467815628376833408555549515946984480656880021651380 1850019664799561828446887689859810128523634383437118940053115370804552962470182093340221950762057683211340120378944062888849213207787569638787758996586496 -79146062726645406094125245786551837498939308900395005168244204631903484415658270158844664157707310955348248763771814711063046788391067524759221525529104368326321326084563472124318731918256168278623002358270765227604826669835435958891438295342434903159075288156677246336154439150755947520052886328714167256538973433346444421333656676210187605803784393721586492840057545981989309171468153197884162328945042603749066570005966624779093957794076862811092779063304321109842324091731703363279951462666574672700671376196246065961538032986903599915099739318454751915689195199186259591620422212377311621369407484297784432106440200065147739080924962213019703357438002437916474914343797507018762537475763362516037464530375045287476905864731829154079915391149321968191 +10601990121875444106767485014957569656736374682760746624229897705443065241696873816254196776531479775231519679842263077569364013222740741226981954932170832015958461515448934122357561377336766895492078707171525168572538566552146347786295929420700117193632141413315523494643262931844585426006586863648768 +28508439658852678107665155972792842206287661263432505699726272954607239927480675380840437519995918207158667265234219975518214394765767765060644972734142492559569055673270149098731414835043509095821925810223271993800625817447425850539568468486314744453634053786991467939161412382560926663037539162059349437789487898945599562092125838900291727653251158883415512092048307124528711465011479916269612248338449949978973514357464893125428777863416659679547856 0 0 1 @@ -655,7 +701,8 @@ 1628053801365026402929640374014765553703071179544257678606217838338537677419257865674757673512650450839264317003577960931228650240349967706184064403237564 9528330235712431695508651348872596587940214388314172729001944199117139203073649460506789237728120154262303033791074115687461447137304611451019062450033166 4143685306341548231504887338288660968707624803700705709343351955022110657856432837240377395875927501705908299984063250507069218496972459859740452129341440 -104562740839673051503481578895764239526663080510065863568700531455357666811369786434424695396331208203674279431043760278050410976183787457855892806406288752625718864322157193135769794697567013312432056383089033459465930753275824303748732667955926341050919959544909694846454721655872047011992815813101904694198241623012881202256275588144302323618881878753528314530907071840869821031266325498114515282538879043478421665955468305417347448163949274702442224107731910630000156878070681872216439482078511101544761151961351666834740966456291969981543493720485639008116953134509164476604089589320621991058625751690463775539274052816775322437146286935605947581551624753707514918261540969042840854540826516277183600699165171925650708475149449313485973818422281998521 +7458796787007837004712235977661789416985633116148918114280732607368491371782197880736806507445402383850766124164590251775004743970419719155659219708540227384445648790605201658248003617820791276119099869395011354078111731072541949883562883648840249249510616061917989297687935201755531527627290779320320 +32562067415072239193840246016716096268985518768069377976952382448190013331748839889139882498448289400400757853808819969655477710609459023410834554011819177127950022030097667847290699738778525902043243023637500887645421123275436342796803206335835309725086671594130477830499317959884237607103504253659374293236168368765551370942719124768927841271066850440350466143929412219292019549741670650796223584473716652795660385114766444013731211424652116447263871 0 0 13 @@ -669,7 +716,8 @@ 2824436745521083250434559952136747236272578919613634664272602203887075383079538439468738841849895882276490589513884561192461063598286468221544075155317742 5573805721606072201024464091196637283572352485715830551875562715416314364897955988150179092473897788638830452265884540199145584775259028641318262487547968 4057677748936070618844094810747404761610038515502652344029344965685330894561953958031306249055086692013728933315233447834639061360828462307224389794398208 -88805558984185112795255952736925324601122785431405035576602411741507621170399545249153338740407851719428060900073010468408821802935493225406349141834719114871624992935268626480271242919309083181247592470787139392455723749357111206028829838073246684382343203181677082339668604262839742742487557831265162674992762636154408019739353159847808458505828285614006445789755453887253630401662086162458718810862782531906728058604853740136139465565601302099053412977760544006397324270863858056884622177695713355282096557500701906162213797940826417474604859594028449742637862923899962768141687417119968332378928546368809483394380922906923652815578553545438336575578328749210393869199030932921031494164347096808050678532449008199752921295412645439010521079989198707275 +5784796441501303882265576458065577676796946906096587650440461985290957058829054847129274276669244130440701590711328886296578934710291199277222000695005904568910944144582690667672945892139302539970077461280831973659874645207539604298268246794000404198399473879519441764495134256354634643900506642055168 +27926326319599679689321531260972663838094871826824944182829437453915195129091090522882499755811750977000485175430688110045958476439969398119085050907218285133398254355136892348358892640344189516520338960373270419222146816179324538294913966113727777599048121837592524129719217066985421105982471108005619786655759673241565670064548335049859971927753583710716463045164399494432220069188699341199218886010208466355717064435978272444257082416306333129756637 0 0 1 @@ -683,7 +731,8 @@ 3141911224089662508005439140547996848411545433412668670184330989833051246389721569721933639157984163331306326586989550527910321306108944965118472936437373 7056836934790078890629897242686908388561326030807269602244791722619134700685270860402176255162872248124156286310896170748542196945067054699971451991857017 19653627676393504480845906820110557077219860495796321885850081681411361274754697849285945541928921052518914208933686885858752894441356909201046802838585344 -80971491865621906872687361455266590261837769438953920156547938816925768812130351125693403692372531635187597207678371546119842393999946368251808241062815009537201922482343834280217543563385790528991891486955186752804442082611928288446541683061339642049117523243263526092524645999730641570341457586483133065003298380514028101577820902138870910908422214978896149068391330152027315094631190895000724733490201374419942438095933050937915756036226904754356983169613998368095692094533690592884544613225600675823643506613658403330578865342487542362468277076769889849827121184947189187765093232341824235548721589704690368245210012944395720194265051720532446465158583188993358700221084102969580809093675283436656573224838978616518282441341625699723104395311464856000 +9683163169799910671354293907568672381107851254294002957127298074004784481037839670632521780649121780401926430183897832969166328037150107405373952334255388250551814999528496252119738140300795402325170176550137471892883221550198049424126188627968546323114246254076277484385665176149283033551751023165440 +16624156320060803479105655673708019093724859687856669901597323414016554716036267842673966767033477560761233327486461318339447602081002795923903537066139452947433702150477385673218681847304679734427371239598965310386307842392299911576146706135987880533258592628104184356529185963203696378503916725011966153849031868468134727041450767305498104186987445591841485782186937410888737747186818628076918609180767095586934198055427262999789790553748249680495030 0 0 1 @@ -698,6 +747,7 @@ 1 1 1 +1 0 0 1 @@ -712,6 +762,7 @@ 115792089237105570840234253759177109864155645142784332660520492325483608801280 115792089237105570840234253759177109864155645142784332660520492325483608801280 115792089237105570840234253759177109864155645142784332660520492325483608801280 +115792089237105570840234253759177109864155645142784332660520492325483608801280 0 0 1 @@ -725,7 +776,8 @@ 3543131743813569641335946273683240931826614024019546282265784836005828417893383322228810942263163410646159776819689834231870373605456177912242267705525812 3201888256116239379504709172928241207634570507519243666267842079354934745091409880730742354222322722404797424377578771802961012486596039415971972097760189 4721437724763666216912653616574178996088489462586407187533602132486864388960603129501403388719024042140502457650359696753171122610737975161314352895623168 -55205153321423885338956400064028198664777869807781110728609963023113127397799487072435330520570509674227424013583745810499657598526035601000813992406801177785654880796763619086540215022787992132190574189038172275832590358776861644727492756946966750658508989064774358448920178937939967901885420472435626511097953664008511962779746263834925846263368943609296037000961913781533108186027361869767679638534133572973581741775890124715963547264348199334411727966106430979815522908566738854258635779614741558605346566456990906260060286149956197404097883016944875962774702247371289156385212377503180483598168547092790446295055664483192046839671126731689954934743379048870609922204145815922015896815781635235421742690146908458094281966246581404186172173133753100062 +4837005771188282971935407089657043487019168586830902406943047384547231889109685650839979581515180335872804870881921663586570464571734302300526117404207560436370497430406529093043461008746914986949167798918225893839078999027089145630276892534029320307629830535688150128766532774699466359036038881476608 +14649538351459906058741226567249552783659862553950272384082762918585814063949755926925837749924987768515640556340283222177993507623584971708636450851372760248421615193323790004038285247571226256925988926564345592560305885533717028697892048480537531768156992921912334188996185887209116041579498773878589854193709529378983879403351880522010001304035516272695800246073052875655027404371065192473535905888797416623200692032732055359224565770757807776402248 0 0 1 @@ -739,7 +791,8 @@ 2366345409847035124374650448074879585773647708631341355179263252964806807879670158353217088899380315556678858307117619065167384939975455280949447515369567 13191762144369989130760985435688757812828881793396707694471183793997116204175863881278765015080350072806582669305591779418584954819749146010893985699341570 13301718048073450430547712527884367748161420561064642294015103641915503834019416126543999762601710015216018615418920000282926562454589067268249095837319168 -49769281410460079587160175170567172396868114308017996853886640420533796807286477273833673204546740576725320996039722521612053833334969359392750604880174269269691563903355785551869296573598748844759330739045893089809768955601413769089329821698243159057856348655739971360896746872957056067463031995674345800660461377513320831790263825314771253934221261090427339884556900829469063294537348024008289581118375314929945056302399670691682691431742185244922959167693536920751966429893443774313559460258906531208397758280206465867926105953925426176615769227172870551762287519389652134919720196926711638429327818529325606413699532013110569630521033485451153039357638432468810344302542925792453000718773720773888713451243298922307261297537275224785799452209942707359 +9391084627976509998795459430240744148278054341930566001679916095435726828423076214248815541128823696135595365039592549569884022180775653333743792501900544596968163878667412922650434328739761497861462359470427289461508215509253714046614049256486535514319610185904255475081934449011049104472856091164672 +7354519734624006876179435352514087233297298809165790925922795673494116116655759843604125047003991533731435264281192336103815636919140214933167210447579405287498010619153112075099093006295245714725499708200955637344617781547142646463544824911616543471784407538549422907647454757217835547791373749159887064306770673576013161274312701154428403688789455533688700894782342280314573076414570285083813175010660748552095076178542404200729953294305533949916369 0 0 1 @@ -753,7 +806,8 @@ 4665596396220733640168649174535027159196397070342267963244347648666006311146611981668674060621225920926771133113452576288300091774874699771692345174655000 3321497911172409553001804903171022673679565313946048256955779288266740305599386551480119034076080803092083102364750364882135550956683614114559617436903767 12793018574047350137248079672509016968931556367756809163171704828712247163091906244764359814474025125944855607579655662889196220595429789208504167192068096 -76689588434293201835619981066989977477908413005779753088866172810964808473094991876212777269773122696199331130485933575282270332735785700928413943556601975066482786096313163465341993412070612418928408710357145493143294698834250060597291905064146156670188605739321658556756932045817073412966209066142063156039312180285153065411311548383943716222450921593288580859391382453317396476747621728712240646643660359972038663779394318168094323388866014840669339297737399151832669131468852916425987004536557248422915005390001651936105161265315235641833312850786365439390074831681304150075182778531434833937852580505677817092104426326851552435105848297197549099189512817962975477262222108336785184201422735915682453207631211836049078758133269146887032420460663443098 +53376332098238942237058265874185808937843825750519948116793606680215516009579250363703665595580229234392378617881585484051555178971860102930997202131537779988926409286598509132127582039147943382149262722075187323524856262926753691304631056792968823860069761025941851259838112955696975940302445477888 +19923611385063419051384812211007230050060207617704483913568487020386612675099470773370717657374861044992939563075540978208277455783654511878538950291808744228334204522554009216806163343973548097843046243549174022328700851586804159313601461216565391487177684815873717679059019796761667669491458419882506144601791158476320022142436392910265642137030624038589331580844312683788761159106773836049440285100183481918534526738945630197824116914691687618255349 0 0 1 @@ -767,7 +821,8 @@ 2392526284157188505188392690013448960986950491375028571859495919060981215979514074503662055648827708202314679184721591212604079491336362235307206391833426 4218798631160832202661168847672965043016773529025064083427701368151868437320716279368190139450621334670500868570495563594616568204374854957138784941027870 483959849385694416988953239395437763233014877575377690428602005170645490229330810160206389562974522706669622381302406569004289640692782430642495811485696 -29906028071054660047981472687456811942854117777380291648479644593101403451134729390839923856506792491608604686349173972820836411471398517144783561852166707443288031772609799795421520218704696005881653249444293587084344906925582382385833765007518021414057245272257857513286192778815704104660157569277882610070331479401870391133503202094059866779539881025059786712040384113834568677737413823801351493948758683189504972649013495383723128253737143261767592099355975063319441155485484883757202590696381356714651681163927857735028516556612765982416921120650980465407310503954116569362383619864223066588196928057154054625583850781499498748269693042624253500111241966728384180291380590649385478398288572110568982422258266678645735032469585491009643093205739458889 +5378187878649244049653816422966231411527819255785030355895748698860605699359864142748498411935665392420582096163286983444186194198233107257177496094195107895074872712441771334893808547355079651652051885242856910759791626223884287793085982216148604993192657336251775590261767563683353789243163725004800 +32818464130850205246467682789169918339482637627874185171064672905340879331577799944668821853359894806536530578739275748702344346513314541480359830789085211784100573835252933274724858360731614753176374779056545876405547001284878778829435612577133895639650041742079621450894836820613872672377867785376695923853094317140137484881752383755066269670040095376107209776772131790659671001065420513961226520376690403010625950002651054751819424823637290081472387 0 0 1 @@ -781,7 +836,8 @@ 862159323782353319562779470318789629705961090965297342320245925680889441369443314188948203254697918300615698372425403937959274851949640461887703447193841 7173051967940195554257280536479042043827601659905799457098258573897554700956880589901442356513658795342086705483095145011273200575189131337241532322688171 14778026829432832620717758207920676238440861869481283376192906681351851826811501922740289231253685732115671799215873523794595875524613727991318894568538112 -668067504300992717252313285562626189380629889111341091830534240703164407858722452235218413940670777439758195559237384098604159464100718268464060833022755680567822699161005143840662079622723282636344452411426226552839822155973011916925207170513568724737127970382747418516695456246080872159505564214904491958943630974686516554785906411149419613863756391212293819449403644890970105617508890739662736955041010715658738393820032566014396707892742492154887137823040904306377096304751108123753609280374579533467459444188258347076611992904793838673073224357117654214880814370422705211653066712982927068215108323247838043982832803519373681940171214501886315441940044454283398151994392726062247895395190990157884090912229945700120937761598924992761275839959911906 +9743687940329798123999941212290764982687335446528161500746427614131976390988057307286128146303396660476408358788140586545951034783015956845304363388199684637129690259093248015713809461202981476094156748203762337562483089253099990690430154929727318541968412839173701447769414174975320032013797193416704 +11665082978646551184396197271822834154968679459301162080769250076458812934480608734582177152703187939426687223961976274547227366150916137584109379949067630208858792329939845114289322648585580755616610302258512584989884644997352747262852786631806253344305668062922039579812843505258327167494097412319071183014601014647063034669866001123270058546336028496149434886023941746932012392894414262845484462335477059377413559348424920746843432610014073597213636 0 0 1 @@ -796,6 +852,7 @@ 1 1 1 +1 0 0 4 @@ -810,6 +867,7 @@ 231583736816786089484927226016147767929578972263620494977377884571370600267775 231583736816786089484927226016147767929578972263620494977377884571370600267775 231583736816786089484927226016147767929578972263620494977377884571370600267775 +231583736816786089484927226016147767929578972263620494977377884571370600267775 0 0 1 @@ -823,7 +881,8 @@ 2457416883750494183832570853589468397031071769924709837931117427688509339888648917495080941417107639148560803684251898538275596934697939251488325371868124 4104295260045454815975181617904063417540583687524096503951973213007375671429493052370291608008405377354342405201451646421020861407202042797591936611216757 5398900427668751217850873803494875937404578551752982184373461962988643267134263496913051856036153441820443871129747572123078186712219756428262779956232191 -25531520392182917621337740014265445721361411239067575024230568347946075320398830026544382853557813619997106244783404600602273843615454111971321802832323954204758909584487837377147721299793435780761645822065614232271833405489542021999026595034251288100931732635677680664415277285956289483074905242080888390451447804532057853574474532668157069142722357346027408682960953231102254815893377964988502569695564237724002824307525923236722261247849213782126269361908681141220395046844058912660486234093554490328216557221498188571532941534379932605686821928769598267882437940244043304208109576414850186630091377631389750072498035265207407367166886810022150211578030876848768624043493097838663809519882479152575072930049411429000574417439368689782570260468950650236 +1007218583726087024268446200406511915539475815058077584580036382202886749107233498655574150289262240696650047786995708501433958989054102047792490904760349592902261758650729430923763743863222004063022441814082480599888346140582423150899204609625387915667741403853025291774074147108688932055983390195711 +23380145599663018538794334849478795685367611191421527490464557496763254711125422173670092394177895709559935294769976819952372348766078401488089491379204849818544542158134496224979987816433965631446790943462305235568068590323956450149969681186862262029930095126068867520361231472357215498730835672433665458819876311608479695607535070166435960898021320714467950701155806239822554229659277947203115399804129178780683995750006285527204806890220566457893817 0 0 16 @@ -837,7 +896,8 @@ 3610022075817249902604614007613923579547402226882542852635039392814912818785402413253274269359316403441885507203823787712636067696281764519975647585808036 3482683400560148150354019097545843271463498486574340530929160498845628623564983594731900657921818042087045491261078134766035389271551015123919424955561779 2250865723942111784039421608251851432625547218473942867505887413831061852377508665133755951631672797483190995230665622102487996363019684093932899173138433 -61866270620994051976113571314671260206546611944748188112014889348493817466332260528520301269300858711370883733353426316921882265660293584980654356196771813752830814863393751514205166225063928375833366427041736421075638724317146660425062918645164125281670322555157768033263209921880226626073745938238353561817422240921335470283332639617981801975929597376257248840471906471329807309263918434948865990118449297463830076205345681272015774701876996655192982429160114187749508187454482524462594626273643456933329535616251439094405771525770802013707141754927319091798774497135450785624609672740195526493570561159214371152346595992797266701839077640764323028946890797349356558919797888149709272434268684802587758176996374949295489035483716749157376093129107707252 +10365393947735305013406914790529970011789937562186538656086799243490315444313309044458058836146192026472268081854266767322163579707977712683519957790124192466318755078159491340837738702367012687896445047003782661660364048868352982928925323993821529472941240126796375997530714377580986794001906926616577 +14333822648693704865076879128906075720499136539069158690685854059407099164825884209184916036182302301395671457986593271682838667112004613576105840990149035878508820984562415792148035482874225110645395684214966452961820472792442602064243527154948068695736851229344379321130087114111462740896607157184206550890192589389891097286967351231550279425607394341507476319668354155045448922078367672145026743791767604387213710928364307934410387263608077250700922 0 0 4 @@ -851,7 +911,8 @@ 2878686104109625229862354165402805665509620736230260577444969531934998053988812440085505116849926944621437581036715525742444317675163909046866434002617548 1408524625048880495289336975458683532829516256219036238078109087870567897704916529748103852417398524574297919263661719753670147382638802928308999469587009 4742693590966914277133482345622645931210627503968707620206733070482049794927860629080377711683265908227819055370520162972241526589942916768449868513411073 -58802344163554310313574978287775834467784857956644339721250016762118519806951148053474140926585685356202298098751139250100138314744225604873028679176491267298420186420381554202221786287213544660030226767383015807559348245256142726358221133944933425749923349300912609238400148112724373683122191718105736524831375412200353861993290888486983540153608895939442657041312429531038809147094126680019476596400280871477208987834492667531073192842174453455717785469219469725823299580119557925326668809782964063680858296559261638980508105364447435571398293447278460758141749296222837597474374812107194809169603306500140846258516651419124556186781001627564581437597576492697808115604193821199848040052454181045801939393118553214307066690010428647360865710351313245979 +5553130642134937791530098743023191297911732972994212582055485264717254209908250004950803382001574291176411334745038178232430168856024215688613524818989709760819986306959630308890022984882592785783047391490235914166320765169341522983194375620252621448545812049279764384555916944408353668680790336077825 +4723927638618295083690092755463316838498918330240796682728223697622545893312048720733281849001727094418300588431465926349278460120916795941753250274668142622894086165783902042659225253028435298371078758268910795425148305403592272806883261778790469890737429382002305486407398555872939312784693343967014010596526975636760014820772215746889139520167274303379900890377661917715485803657804374133841224806618394107058611468658108088260131560551896063029806 0 0 1 @@ -865,7 +926,8 @@ 1170950137596410394079556452052007744667922551742356085549311726107104621063174324321159198410238181081409377899289339696505183364108241398143346683397274 6266577599180715272643179829794667116364415231701874317566806045550798989424764451453171897199722686363150830763178386494247478884029147366386550475745174 19499454418662965629802092201099350207580257918576731805737028058666848388525076659636862212534884659279639848323707620894715396779028548909594207393415167 -95862489324824888829063620932019725852833888164695526035022601535004945584766410932268167578549527575073071629132935713944998316919046789310121293504364041124532277236430262940542378173881448492913176491387398844399993039996789279577857848174346427604815454297671230985915025331674992916594895826262876530913916171850617716151441278682147025748960251878981479156374083721491872710427295466322992846907609488745954314715805957270283666039983078879793824466444419938190163155697145898133079802602602353722225107790055421648837935756995174223043214034050566670542186485923300401095619229934254702680429337508022944449649248198288421089834753256140619932771553037115981281018587500510997229178929836152007445007528380951317241720020980457731242414544349924054 +7491310775427379205451275241696534198775207876533479087995103252323137907742560676206102526955127596768143236592364563919391365130622631807244861360530642258721353802216367646769792844931749654022069462592705831533949527241530587573297737411586728906086303832296331156380881819739166686878092144672767 +18796502162760160226250152204618694839807906286113092800003110777883789218842243583036064249900793594494008242546403509188567430371285061255161460873411492857908336448904619340775306266718509033743784612836222680866203517611201799111354771581380221437368528919952566186512228630174278700984373922250123310919722657324347467475261738175114760435522588005390001769791388961028828314032397203388180386644894795950381375883062194583758183135747713996158476 0 0 4 @@ -879,7 +941,8 @@ 4982989173773022649022397963184917180752190882657662748886552370901797910421968943370653256257967628629024664151919676967847090084950251857702290490980262 12148110333218384648436139282566844904693423767379435822469549432550659540325752661673352721491851141598081552703324243494124595306618572675953315479573797 11028869767950066853862903870251721369434866526464337153519928986032553183047292589177288689002878431824162808354999536746934113300550015294401283448897537 -58606743903456547221900468885249772291576952030679996097498477009743844995676543590192758644724090079751688530760171473541897119764421794956010728429006280978957388951179210589666065046283855669298206903519798531165135083505723514843194432031489074993214637785036796024933827363001124388230620312743627491315719415609068813186688905104367027578284183684797889586512143811049534490660482523966026899262043286492254927272738622395074038650865166965903827122630152337781020302738480811674375797966826600289037875084256686503563207679731661728079362620463413234443568150076382266727348860029360573126873091558335717737879504275102852798676585481840766965787992022925191117334050737265596965836939913217442685101717248568268676635054625934454260099074919309949 +5564677243506565432840796326485830517108613266274939211083439123715117854386689205611896780808790236784879267345611559615161743402643098893029929273758889773892627347825037932396714085133601074675261736569510119123888317868706628104410262093816075912392494216258946925258732634257705061191794611453953 +12832448199509312748037695466110344603691973686346158577275697531431038398255234604164046550781119126216534644040340178530673012471457078814611960997016443056894042854161746711315668268536386219382705407726308690881678952673969590544355499320160817266809347245168990155961021732027075310147074025336573553132150745598676058388830602694665869887746332618578258133919549090512076129869049818309689542631433818773293308811803158552451157660610127239822650 0 0 1 @@ -894,6 +957,7 @@ 1 1 1 +1 0 0 10 @@ -908,6 +972,7 @@ 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 +3273390607896141870013189696827599152216642046043064789482248405676250539528505110690804490707447337828870590656092725446174963629590181147084998049792 0 0 13 @@ -921,7 +986,8 @@ 1306435882293703054785864617754127645947981008635081515972982328252373992773175682602366698784049948578438144756464452476167658757197266011674411590215624 3418924933199934873321329948743314146142040692630731923496865500679236033474734183436540120875605867521473258874285532970466381831296084581446997731696468 3109273453047763295057753183837237869395959180214923717206774456268927599702732452171437824488600294111292564013762251960507352853270412970588497512497152 -88977217200146840664835987057871414342758656226482702119455134566079289759461293111455137678060305324123924650245282618632813746520379483136564091907304118161505302770042826556669491003997788040634250764459343012372640895868893685896302853009657056166286847643764352254944479236872120415948809439964977244216102420715456410411660886545767779677699315376084841335414581647517102345454786883637029530098791042769144912151097744363218237972900918795095222036559877208914398001283356608105215340062508789546403610568009222203488753181052446817053481932306339868837058506301443562692349864882744221053904653187414752280043967264954580774211209597627575080937932571575024581567429077910187545227659810710158840134973106598283417650179109728601466223548158882854 +286731836186446095857785724442739726555989697273304519023165182400415887707383423935925307951900182657313805119211164740403675553245412634677881978590896153075228565724249371402865963565486212287922871904886718220392004596796756145262329924195978312198219275306469037658944155791679821415216932978688 +23705763208580774588928458369265619438916460021945211232193047627926603512005878931377912938311419163243403002660952903410656586223538662133420783063393034282975381898012298576963467515440532649689328334345780681671723172171010972029952896075198416960048234210840439701334495379764884464832012212719290831505340271260696067947540265478850247171084561966330905870702345126530017405343636921534310353745046761481665427795564834777302251191884558790364186 0 0 16 @@ -935,7 +1001,8 @@ 4365216629959533172982077795378474518196312747569830926192625581814797043834797277039496659650371970445843961712911189437934023902885370155197127447599587 7786275362280256985096504919805326940788214494037837259488750879599254096754641518066648702992692840392471672645638933505566197966897842107066681649920912 8618362445903795498495298150872761763162723533326999016941555427533106887247180867507912332927251479902784257469217137485980295377407380260430728522629120 -16490134315404647213406475029434823318168374910390512831510506183043332120558830896890815596494806986512558339133075794403795234456629635255196109630302274063596701645127268499059076587952023859015770347837308708846781657401257233464407323703928750607092699546669184153773323322475159132438875535982524264435538020967649556545078439217499131244698211417633902347244248116513105556404055186363737550878189887290194234432316841541132142640860294449814887861397238054043043687805797703480541139181008458487452494632886183551197864883932104816574402149990710531327784104683031823148067071502782716164931902527187266922087618072262539701943603716347752849105290562996477056326299873601871677329339992648973891648562337687129654590330095250352862403755335743881 +7982146058423899625168899480055973629935142133954608148082398488598972256455265091746814757927002125120326401286119392678755814780700585901254416951099507381124434116044162971886485060919796269087997434118497014919733636378546760466317072097028651097132741041399433702808164954962506455701888258015232 +21989330961427482320873414443063015928257919942443821711178892798696487896352353009088507622971045148342817299121972243674879166058756712149437499808420544292407293376143293804754263654378017796839550542953209140796361828649433680420247205870246799908001987021274080200394165262473622337823240257874872815088714497275294574219657771744609557582141606487864476140423350129460552762119376149626806864803509401361323064126501267414575167852478576633701103 0 0 4 @@ -949,7 +1016,8 @@ 3944008675763809747015020665178678882677044257366818833894853057097872891661745300374363390097768393910140535804055885471681266094856681311889793405842943 10432168002169925309120503644722046609224368185326214525537866102657473676610157919783033661419495704812662343601179229565468596161053474859566232729971168 4434125550755468286273915949559378521845137875362780075693690876557539422008078027298618389135234122502995076657800647221775819541243724097410850717958144 -58879788797133574843674131226486041883043037064364921634336146348882294403645081889149704029388967907656933395787481771948052519303852184993397307363710467889468536203573018705713826463259584860520796926335149895942517048054871254750870976735849529300524514232108704637780155141118411244754977929687460596842209901839253348640752544938339746749766226819465849574267355287548308057135150017728253762852882959593249872280268600100063435528304362920475150321014853691982290820505367135397257267603891072223573315334630909168764996403800044441159417477437125537149248656998496445381127256913909869799043466504230175983072915172182868528863530322908212009681173652253736821737022441593015806151561237138209580283454584751470614981673001307089147844396118914642 +10544028428859860647631953921720386323000119376125885681800950423087768127297571058267839503395689317829039753434382369495774320720145371495400808557366564483951610047346873818659355869536197251947067485092374284236784198628790721882722429857933128554802811282519317048898934233902279839985805232701440 +18440345941730146769481994533733567141044993718475504938583318912857102648847047027910392382495051573769813528456979411954962447707741851707281536897396641672916772895898381890381674089051912642497004147872377088851984352979390381063683748636451983558056315085668918214320300476071304869797011014426609032047214117423653962127333957708782154126828418118548172708012943197384144043383315600410200355075913830695186216882152046505722142344944887793337854 0 0 13 @@ -963,7 +1031,8 @@ 564120810776501871547030068641973310984074415468950923614458445915309234305596816720344025395793468749961903973331424982658487492675732875715746581881639 9512030017005233270085163286414408214444876161604376761868292912053847917535106665754020297449298958739630340441868032179720694634048588859831514895174004 3424474661482523359099400350868558228999347406743051468541630110333927244078257761445483195343636488588952518919760460591527948463291377508337491634028544 -65118227872255208530978095704531485836531791966226954070036062366093202114962831327319660285109455888197133761203512225226041875764396311381690994387083960684631953535071227406811143021754477627057151829718556492631789876514561153094036662960783881750912022065256283109433376637350129397107611734206091378876306623078656111427158121771687232263391493393488514266430172677971487821825458132598600699519022946978758903380204148370574856240951611086240298576710022096482000928787252944656591755022573584348378606935374979005737085171301709078465765360521191167661768604901337941395774664950252681168911559209068972333611778924289152526326746867827632109174629937032521660350755374538076710856028955052886565380305045312456930204360072005577652223645437113583 +1908744027142267160255992222033230928186240062062564360139414061079951535468660083714712566829573866331135382316682210055579103865954047482673249785878901884126518352007886346248743951305036458287883359238321077240214116300549133893047140060961188058073853208070901174162050948796606119057608052572160 +533753182221943739411515817506559992144353474201345586358967700583566469936103300520749166184587887860573873190047587658861707366381179609208438444812890854907402119224883354291361848266886930865694292240182736475266290660159879661714355945901578730736360959787897025448543671196789177297617755152629881870393271660514425363164245734715462258579427757199028980848704112940977349320451917649697374845997311260177033885249436939940782382383929118269489 0 0 4 @@ -977,7 +1046,8 @@ 2060718003102261095469378358151405280518660285538331953442371394551388847723544748074563153067316177877347237081738459763835643097859427740490945401065896 2427597878315108052588416153186371822454229878691660809974423528713640874637568365876246285814256304894224389434236414966957500210729605332124313726402355 17899117585006203601483637166090154016991728785619486538375724587636009980913873117460186227173247676970981855052572465455831400785016798907992702502043648 -82719099636401478752972883295793152872271583273831508899385879961946763312818213867448814790012207589877958696910786352022004017128491458398678502380092727265352370894849648327689817089369872665581355167087649797725569274446713910131583973239774555897530741710201488112735698863245376499177657901145733481399797327393996328870113233422246097739699922081427164348371229969681257982602491765348673669982560870277531296394337103334897894312101299211803382899983684502590889160634216771237753936528683049440831694982760288677341061831863338447913878280666371538325483664952174202444434304882598014748667048569192505645286173327534029793348718165869908522264528261983539603039105723499993523931967046987164591154463040088382996154836338979631948658199465914336 +1871601166577895913665863813882743743306248246207644360499054669218177312807383799762174801630805340092267502315367248573627278277545825513989809282952455822056852517152157679111824332559476177533337546335447972701488371422446112963735366800940695179512495443184058856851596498196420939445759478071296 +10550306778399659975487897356875358924973318622498728253620155978576923389364488120390171602550388451242602890206431322088607185746985283921168954364764596976217073705682936664824865112089874261838527911965608302408800742105060068062502398384764473486663935558909957592004243003066730197686300227260257298269425658277997389598475973630768006422518890534069851801433726348188900604318019697404931564408067035791107685741964005839508900413176154475821036 0 0 1 @@ -992,6 +1062,7 @@ 1 1 1 +1 0 0 1 @@ -1006,6 +1077,7 @@ 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 +5027927973729236057982426364448826617555638513633071601633370220421967636306746498030257094484300966958703364072352628851378448187094873990326993486348287 0 0 1 @@ -1019,7 +1091,8 @@ 0 6499574949616620637580116906143754514426259529884439117780273025054849187451370731789917263550769050214853609122367946205434263410894715910936878759479861 10124369117566771149603816821574722189892029783289052707167197978669109873476852672835440349606345261291423564961708638702389275798144171277206026719330303 -8705415614578401703439377544034032850201217707644163347213448385251820480402064059350202110481875528833463043667310923822604441385001445446052708783815053349633963516466471509187688789589316773369344615677792826626309051716580310906633140773315576308672949910323971834475319446949557690005611853568373950288360968175908668687766510861164934214529777553732432896865185158370237274446566279159090124925721960076023134644068706631984582242437068272120041502784115042808783006043527616116382358734970451299287076148174547739692786708052816344409042256904123745725458827196208845706437968200534005237308917033335162989529814740197634204603683936920599194317277256865413864485841368194284658974110212415023489145311654329202564690552488285659475304098262048261 +5383941699543092305623443842804493263947292181555684893992973883142751498900796716464867906615276957493629319704781718428057228609756150862864742004037399095952297373496665788422781648005837085478113966408640459815231657886564133913536806437981143729147690610590905694337501640066370356251688307785727 +6310918068059471764026319883889981132676900864298663494645342741409042787564204104397616974568887642296873516370780274089671686771704841938229887196137460632598595783254274133337225772320128927921843666172747542030026661734330465262950674563868305274037519191385934219987327624738988091242143029337066541173427000341834616390107777280313836624864077607937735030229348205663463578720868333899592726387334113240438244508441849656170478117348105420506878 0 0 1 @@ -1033,7 +1106,8 @@ 0 4137577240563885180314014646510639308253117303602681600936018963727274657401877961996913350454564200277844605264306113013779943962820037004955398417119598 6012634743225204725211101132320048969685865768619552174466530181728480133292301029875548285114373185900664580122272341980596861811413330588763908353294337 -81795937119532106335414628142007540909977658537640179159437059236630425650411885370326187121444740803210715500330984022270379288757433204420162387457613244457267982829771730115530977365339900995108866087275312353663936184818179575223977540191631985263739097531812210312755996680822466849659356805615283270271559218883156442720960075373128962323225954201545893321230436240679191047181572859564297275606464598132233617134504193123508950148217886663754637227759657863229014333138561206386634029631981247244317340373651674534396150486840052283462761691683271761813123839124550828306071030249616370906042368728428188678275642758172811081689374710468896615837529258853907516810148933427557064757233181559122827774230157455801620060265635590458075393637334298735 +254535129586580270548521975414349752244526806343151862080007760571223205791187472902044998439332623334230660834529731711989369170257700618020245017747639011641677093780420045542350067272071826391827216607645254644193288995966198490603503031365625040118877912466523642200661116519635298806043651342337 +8385908846676081908370043980559351677127770716607791744592576475690297800091571658800512758412511961004663163941376701719082333294800426334317916965716031020176657167014768130949406498916053374967901129501825532754676652724685176412371614884225185706503174134155152063944407927152995929183429819648489312242513817944158673167844009257444561330167132349514611454316120198401977968656265677200605323359155355731762973826116236680898629609918324923846369 0 0 1 @@ -1047,7 +1121,8 @@ 0 308755345928398507077827126197262399264414124207949539753718673573534243084848112587571000480595914906260398850382596175138781946603416961836963870626141 18244350893087399850665188670118991037975220133032205465990746245721929325028153136705422106519390226837480732385191993725441112016188775082810504002928641 -35497041025578847034501100086073209466536561136508516335013344270660017935868859278315896598293856322904030275411384771746298914220919105038326604256986745062645190294804526675489256642809751675533646043594633436860337913053703417141370429474001608393015936441508400591810630621128843720442719169952498841878428043616134170692538798672482845808628733736912222222835494868718990850193361338659654698100822633175501310238243228627468180773090337145705479830831741295755757245726438863169234409611568762132507269416198114830241213504234567974880642291566086992270545520441074370195803131662817790381334873417850159055327338002481911259609118913167424481776413764325684911684692540815623011260021939894562955348430481298027007410284302139530405351967536881873 +3665588193601842217160462892006519794441699353581412583510916962644156398320556835171594452576616053963810443333586339255795973680000246325868129939290031865642638045425971867009672427500503914468057445618838753197439907968265469989645596428647594500319536081932047598179754671610950943455199214174209 +22186396831654097227986496390728371980330693530332007779166541519242688898973938381447063194690736625552685027691280623961530978041318772892810396870809949339891780432739513792778708087762348742046586160063394433346940941101035727747372800903757578028991776450199349428475680885800121505072160076081825165777670772329510069207190667831629973354820426821121553497181841257104073871622072935426694421062659417600761519902665044177543487193516620418169098 0 0 1 @@ -1061,7 +1136,8 @@ 0 560629320288680383605194363023384807151678143098424596613421718363041709472766750167486947243276747104145109416759625120625677741081131727837587049341019 21759673470171209133072662941401074809641596506044027427359195245599749269615278218888544963788731822407161900052925229605030503595641862078189438914002943 -48914350145218439705906568672200367796969287350938182949379654192199011505216869338061795066404508514409711613257148436276038759959294510097071327557269961224657233124533675566196627680457707248004848068687893159393201712113146474154643723873117223111183020680896585619246094543573264302805376451620772423606446526420628061991035935289820171452375284762441434380410449759463426756883286554269235628531755002958821353224373032342079546971516226498682559814377619662262209744231352611522198524332131765194581996840783766846255253469180547953962698030763012753169497800349425558331288444588408837283091960297057338691424102975776370837552120268251157155308653220431283001956686251393146283998549094172293087591626540060360218133822122308383440495234963309922 +8222674955398877316557535473602868565827602242812253563419515952040766275770537334852962079852348771177051126858608391846792829268299315517383515972974712379197466243571886838842455021350337318953242740755305732748699335134286099636570483789761728214215928903659103496254292223405306563391980052676607 +6704878406080177707560203655054736070477248576489688306407842672251903096919006312415980371154994403260429964471609192482935456676801001230508899453034708688807610209409717279310365716437632450197121589568242633422750297260272378736694314947182768068352565076127017290514776717356480481674630872849763970700450069226388331363736946106411055783778057065098928098706626638969150760900186745176895660013716070551573583271188993227435662677589978033750659 0 0 1 @@ -1075,7 +1151,8 @@ 0 11889537611764019713474395414522017738805331131412830425961734413527746223621889642851856767739924676858324754442498238690013743634420772752231361918208575 10100837533498068062116682421711269237464416549039194254318934545331492474511664814492105364025928254622293940722169331634657785497327849544082846163927041 -45253272398683486503135647480546932526735137482648983772602319829758278426282326548221674861255116095426333792573217354680883747412470857180423146853304197991995369543158047208601197540622717356875667661749000843836978338755449525157032244963760117525923053553081941890120196549770412880975555360904557764314756189571080933525608936448614857337235318443148692573094194685794107280259285183133505236685396056175003692596478944431702441646328891039761273277929456060982061303570556186099371719749726908630462163994404796714299891926613959427971511569286158738862769695640206622518511417148726413303897685871409215510922897034154940725003238330414715650272829271341547072549019581775308154038128433212364492506931128167734571430916037205627421756245756464875 +1369148440215267019286304149733761118056665924873961991411630969747965209899998790716499635578218937487656801015714762781120580385002698505340071100124982713842184248347860416733386896580942622009293934979960183456583184237569483817916647944103549712738217905254990813029611090034738596009778303991809 +14470891946382593133261871975556948917962250576470186541215002308627316792841475378647804951570288535703522370652296694295712464047904010907340184090003647914959531499893292863053894273874528256748420135416037596722727653113848255103464219786106388140414129037919023044763659100696777268559628822671794913188044005920185870352459166957980274030642096976079120265889000691672667107327976040012293388052690990946304488345186187456257606086924331607962389 0 0 1 @@ -1090,6 +1167,7 @@ 1 1 1 +1 0 0 20 @@ -1104,6 +1182,7 @@ 0 13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 +13407807929942597099574024997867385471458758537929012740010782671329620832395834992528134114986407662672821420428107228756016346166874193365792884690780159 0 0 20 @@ -1117,7 +1196,8 @@ 2104386984118747727716517063913738816025890811467756992449715776590348174368338808503581044664946651173257522380822233775261192222343142632013731451133938 0 3245766926972643552330628549049705392854964955772154252338528686239084242071182385973867724746592501989847967320150395945141828002524173519974765401473023 -61080681645991414549067490692081334402081972397971028746517907412877430173442766887268502928938956689855686968723305555144818285896267263657710942751602205704048358528758460732296756008804811854842722305639692261245463676201421427021692640796896111199503032898911798682259054437677204216339229172434824743700358776298226543549612665706139787699818996505261338813388342911091730404851273471048067169751352130853775192270827166068955332150833437792442149070397683322292273034999892709561157211011989290641892339659870906874678677504859699231125692278719325534934035201975234131443854930601918538057100277806802757327886696961876993004881817336740781448664573364169350407114702705902813993358826145855515225329878902273560866951736476611475090737818033988659 +6907648306248975720047253807553315878303563975921476580151692887533957733952838913222178155862261045104101262891677093360305327510435202370854866877221225386828546336285443261625103246327521271905514699410432996107397381514692809796698965099058352936055010684764360915671953963860003695683345510825983 +26447750664679572972311511491346762878392092007822795854735091849389623944255827031514453721868656369736370805514656452589804235525013818434397127292257036933491312808959509859350482891134824058764033024690355796359079598096947363393151627873770672958867270537674600576785634138230894329775351387231396268146781903236645159728891454367132969379219264931998221585031609847512363429272555066238888068880222596086485264677276997340726172359858551867347999 0 0 1 @@ -1131,7 +1211,8 @@ 4220939006243733889354999574941943865608293932174863319944209124029612039884827143990223224550002012724043690083235647740267932838159837905350721905177008 0 9819440398814080363130785191409752685155104538075120057014007750225191492119731772827023591993721591147390320845851382883568011993500439254883415399333889 -7122048118945560119316699160720553961978433028250832356632987064632178469601289924334761716843864521194405971422994256309344299128243345780357318179573891332027174794596349900514436964878897341044541747221511411801379936266000034393130953351626231473024446300205114809692182751681382918793815319254538702558176147904801708426647532177700676433087822991182959261814482654296867542907531806086418523075444098944989035965323104111587337986738030358187241743843490343789019348630402171936696201446676114242834126722172863968855674947640604324144163958745324958813957622562236693952102477460729523924597596293556438095619187584135738107568196111010905928607888154445077963655076780117251537706889532737407608309004227600954352302398749172691718423958455958196 +9655632408759825233958611797456496067063588648590435065602226373676034823927066598142456746083088436655720971023229982832504728539123316354948596655920694029523232211427760301619988760938379731840724545418059474244039925314243108598463317618776112331037188490273232491842485947576029350960119525933057 +19168469482771522387361980195401090898697209536327388812153014901529211406007624393592650590928364242770484062532946351666565045957764391288622530585296240046291185627706970869937489824896647625260613504074528292679224168776865581606886288126591395731294608037126460284763239262254718080804765957557128258706900873267005249160304719047478911756155253168469506131790620297150118426293519712473869983955423743730285845904324583142963587786011293140146359 0 0 1 @@ -1145,7 +1226,8 @@ 97407145078903878701182151565338220720952838018650765330450334535905937357373611965592469739325221569980257894281512858606923275277875824669884901395310 0 25619912338425179981237074026942021799265536991310528535894660424287880718210785582129672576271686161615856398250702958965821900733894974363009685894725633 -76010139396677895110827272325655170735073429812754244224065567827072674955856932119584786811151993167167501426583952464280371863780796745748456052461411101229527995926637941814484628183648009917423519376707821313085607510789924117200421530001135073989351921094438000753380349110659634417761484664096117454662720822651059990956245758663429700410864387600527899115840834751012921946678422566816724884299415039620785142784776219585718273085355667734156330825330852527721204878050664943807379704377280623463834377082200575952282427801903821552563762553924876437863681217229193327327952063777869515698432495570884538697893963662646742169138455099039661938773403989337857498529351848559385557226317341038460105140266809753792447714025965171823132637111727103356 +7671522909468965446688811864997649775732139334764200965671339202409525004787427756456574114546598384573443159084990772200209956297641268137668960261240194749599773379609102037525886640588454985746187171015912121459949370747421414640087855414458925160365198194096646399383154836512890554710890718953473 +10293884923205428378666956554848182142244715690619212169171170546179865224723565444900771453248701102868483061985574173559709761183179067864659447677846955231286308377671525004854738789280605580119191885659203370511449399894078589757295087079227410959307116809855467581150399434097595488801159507371338585214103760300181569615667928415747705672332480417684601788700985353510796076482470500651763753290405004222433976439506565358025254851862958596926224 0 0 20 @@ -1159,7 +1241,8 @@ 2286371016578508441121921294709678407693328940913329697268533575124016682365838296403222603898047913087019704067878310158113313849417316810388464204629572 0 25671226303654754146969894507457657987204391426702541645624778236755811429128127378887919394161592482970532540809070418766878887011243610093297304929828863 -15866606951591235556409191617213573399155927811878903607694869739495905400678992644637518436029559246426846377785378587987926252791949664825152889115083598102400393140235120405417417997457110081090628306335598171967679981092666003385383325972859314383907768209172868582249740126281615082843573939589158718380155501844256488600077946738820515383460955868182422292129795992585952215505240163432033184622635932548576865649973348050288000788639331974785273445844199983043022304855363518084651671719146933165057669295305321544071196137536533399138481915468269791078767728614599543591551954017339053729475630770769438637529489889077938682440068899125495245061566733534687037786573509633820482442842532515449103712758325050642085385733732747184720870296336579935 +4785525495332916713108346669310355883208597124913721653495570548939574646651963675833362058107793696545444101958156033302876198568608530737409310207901760770957083322440752303097212064072393248697788251227338207068162143919875155956848187111766304706403350196933167632508223394324726953817363397476351 +32094431582633234807734495384819130272063712020829901878525215417797644447839755174060744776726644205182311880852974878748451402374419467270518797046912443530456212016605470991508907045276371141670695248538943422952924891445929100158107096854447459717681547826391098044944416207597160685051923871604127853310380648807504003049978615375745963324507225789653536595005326797804437482047876186051782235982636836244442075633553513047827811973923415770476767 0 0 1 @@ -1173,7 +1256,8 @@ 4584447565436503172316825244033692918247702864479587471557460110462846155092582971475613387484731203139053010262859517492416070493565968167184179196803079 0 17855886664960195299137683256225599460539695469189441741138167148311674787837063586188982923974069115198316431121434733749422291458227574255634138536083457 -59384566358794087713519036985941921971727779065663226676982961995154491198864950156674000316581952280716214848408093230901933126757201868871641534753628308280252753935126431103884375360812240262365325812639199087538091382144152792974414950141108853217718455335529345676161916298239217369740781198083301965528295312953779809502130360588408271070396938846868179567129569754220713703452395001463867093290041999114172263915537606735392097717571719562218093690326215509153961064259037323365352677591556046507171442020475354888438981613944670146542909526903328992226020955963740333419878396193097750885594896614110979159252979239707405514132990634945047790196417564984004506593382912262142143958951256493283696186469568641746587438284051577412867450570462631877 +1374356246318253574025982110729726842105081842171225422931088363015788466146368528015009583509706677602458662747215994780981399824925913453782201779377138318045172999325810798864144189015648497899487658934661306497156780183553405477807924063800170898266248650878103340616913829333509130538752749338625 +1640563579891112614924709605958688587289742793630758509110339884654417246046905788570037457484399424416760895124676877531011891636277126802773558750473620855831931500866708684883937438953118514443126192930877064490752020898747438980089537975395182532494013272495476219349907646220024050095700438285617434068609057901263757996869152424637406600611987744170919997651080917069478242122542753946615128758176926986841759042912203967255896726167421198572976 0 0 1 @@ -1188,6 +1272,7 @@ 1 1 1 +1 0 0 3 @@ -1202,6 +1287,7 @@ 17917957937422433684459538244547554224973162370938960458267029029640947834979519339152474433150005542914 0 26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 +26815615859885194199148049995734770942917517075858043397979502765092926124329914532610493203135186264306101107885244098459867671853087539206018919387103232 0 0 6 @@ -1215,7 +1301,8 @@ 2038636880556966905914764363156480651959910168504797327228316486248128297682164213768446666903998086070536989636186162862522556977670168122610463846604180 10761508670374291972420269797715021028414464448240558938464987728552613552119689435329519427607648808039987095579973579961133046464353196386286909020663497 0 -45482587854271028902770817885284143581635498662368194698025977352933743933799189109901017793688745577594623527694595604810313504358764575860083386515476807174987923177735804405284473755066934183256004639352108484702274953900333192385269530392210757684450187112003674444177836992150333249054702130799610355040881331216089333384447820718988928025554074304355567887574813315506152856851669230184726480128481499268920312416866515808041382410378316215204974756173877802603170296930710582089613410137158337317994538564658188439011523423780823240606329841082961200433291793972091062343918003068165989458033428353216141929996068678255654039247693104366764606274764078658617636217424991507187568278244109935035828898609479518101929066828346725868624049272030586043 +40984697395123061397847385885955617731982529976694509690496120168455541366383914951564162858485528121548558319374726064139914899078481865279546572464299479360080901581918627814605543248487499283343493082927078480873799428963538897690536507270633025904660571444960128829640263091486837879144125038592 +8909946412269299572792850981460782799532037067275283441188867265579333027637974855653738811158117573684759311560589042257190296847643010765802475698723405320867966475350089536733110413273085947267298794710610764685212306019986582674496969299883756072077594732387268624852957690791194886450004295782387045096350267854332914068470074912878717285439467272539570799182006042059497909029848272463040589609458879066125823035788194404021371601097559221551987 0 0 9 @@ -1229,7 +1316,8 @@ 1329225061763580875918533781650822376275620990297295670554223160059148641553029627129765204098380667668821227128123235735809087554397139852326517131173276 11097141842847614394079602992178709247589894415852402133624794662338776078636709858667481909108996684238974927213647046033793578164937980468332310219323018 0 -82530710943173231626463573325692779692754436886030672265032417122005977153566763311330845411954261860082611069743371135724846952083541297125118407037493050030091643369219829324270394014943329835515994201433775828649245506299733766913929800609741182391963525575197020867022940715414622480667671660318214941584751533775381692208931704572538156619567358516005504845014729061861609309938184807822494453768234138312147725645217994821103263459723465254832283850235782838705125412229606677970164359134170387049947834936747341490606705964743350233898238752785281953469479577105057231853639552966381327604682311651351459053909013509504660605533181768496353010464853798444299853619689055126369510353550151910971027759949464857702231495761241052789668272665559715128 +8071735877529897797164814472711670751575699750650911010717417970127274646674179517149969617423521215633934503699616678817716843715742637948946050252837432727686220974468561142882832356080149399758341834298569043889563654149450777405007560189562518343814488242871896319575202397519320214473602582446080 +6694616185800266287626591614740434614172450545677003882600376830829359762042179214842368391192674719407443643400544441630973206517018113283369936295245057174712933556994499956071283288989464799795553730151588182776157104143243273082778860642399792205046014812501849329466277700807982917596823152488508302015315461955865789728769054751228692423119905880893937895064193158759226982592756051890511086607781198053342618530824939847343739509034244875431247 0 0 18 @@ -1243,7 +1331,8 @@ 2138965005429346794405216904139045984058362385566693925431000008613749092589355018622253069902180893858672397449645385554064735573191661559383999731945459 5599082768478558353474373621584847716101862099962719911376003810521845817678124356992801556560959828813284665370289254359505555309567567683413487963442538 0 -63614981716344260887316728944952136895331320691835789808211797760982858050080814744379959772662822086419621105477221657320538493043796273684769585579096177584643239556846663373469269063761585283623405673614268918152004727231417941803827358580201799024176999958175343719377925756364804719730190086604948077995925104080216677975705027083541462053344530267616661507574271008674113036010390145990008479521027421278966059966909296208780699736375119231619806996569871604678886482503296539830582107517385273769007336972457140938425032039801259553207518991916993266714618667514018606860146526253248470582661374014064895598863780107120671021812437399331942125813127174533956650265112004346544310754279846222746362678824781169770678080461547337584499680665583752196 +8505562198751426520419753868937928657815376861050869644650730877638862873089958249260761602153572619531088220914388128107806730704564885365227693238095778773347289827488140170092404396918489146978219366997692666431664422833499810391011971777952027507988195640695475217721220156144534273026766902657024 +13258845752058319557761867621646364193350685009107763072613748715545508884518792435165640060432501692620709571169303323832489898753595064750109814688579187658973115795780901167999045757923357842908980476028181042805278133908688854546483149229843751393689435259677649157449342132761603805685178078740303455039238350459994854784015714248007648831119423734010949858462504093063563879993972734732657191983776886556653813278840564588343475007599515963220807 0 0 6 @@ -1257,7 +1346,8 @@ 3536260655104985228570598047629889621504635464480007413999695872026244668858612074261286775235489798011926649959578184502755418831731290347207977473778761 2287281553939530956352194620419013279616295380484047525310562106105104280173822770723063903213369365468416110828105561770407010047970222328014275531881062 0 -22560001863719192796895130044111283738945520048063603412446058847866470382227887350538096696720355715425217113703294078745750123427892008604381522584757059875738910777798922847776950659894269775989622503322713905674484029827036908225927648295253243636588948262687038057955837034631518628503896505484117164018589407950736774304265477087982799532022258738048312405013767357154695940386662807565228396300124620904083969296874790373985742813478204314013287258685560279464175856469039885349100694798098733709413909852948085783605761402713861540847716211278993698573479199785557338834966149172681110440896385904747269474735536523234021906650038473170693630524524884902017976797497627898992391869701702535398358340570017537063259494194026845815788634086073391689 +8975406365256287079502146141544330687925839285578604542063444104478512627003244297195048898182515489030820157009675126108192822666606148894492389023997343919294064572180355360315826219274413911422788253153439868196680254069763329891225781141566431534338291820281857844001159772664584722309392818503680 +7627895627796776336034103253504663513973127224674837000702424659700877395432210192501491531145025624704509245843631295415207650789564811514832835249177414395254574557066114110734069582082204595410051869299928733226428505155385671730599432801289079265733997957718465603964310879479766099831516659589939704922842510148318960095699074620514977940993795465684303075866898594805143270298319852548800656967084658804532267409910838781960922542128682794059262 0 0 18 @@ -1271,7 +1361,8 @@ 1919252284176976160011289332010981490746074225906227007498726993112622893994450491566696784468278809972885041734059388168593055735985280406694325759910450 2289668776080774022092664264319203559647600991451909561040327250000009538496148645073308529369889500343496260137733562205719817974360067449226154885838315 0 -55792270959626079454245536536891746354044061015047378864251802708509060407086151697970260732559323247238038340248514574684316824272134174004243988966879849631208907971654413572741650607421546193766202020807183501106070183571003940038655481350482617321765238930755363311752183755302123466676483484756339745336948317667293942084049543762250035888819856859289316485878098427573790906104117375103618312469721978524651381801363881731773586408529411807824733791291961745654550372410248174655751091811290480475297754529147070427342112584772701229214077688828222555110528095105674230455201005627397295191268703416963965223576018402787685948928073019794376927754477549000044207277554142643898938434676637583745436658573054848623282334124500748223256654681856011928 +8759003555859924455289792006122150340086642892965675685066523367563039345030166298894450331668432839835781802150906003659255941165890838655350310430355795467012027286822624520715979773959322702857888683940335230551215550420172560712753155144372559458294216901317555971294843609695973013254603739758592 +10233986988627486160165893250925551838419499341074966949334890607408070394472982377098453235058445034249828511040640776640636214044010669184255119316736950277091273009417324454157384181382413000016000601683912644163946480527308355567900081185611244964219361614299468279593357197464317206904586553970296516293220670021691347612227687198102745489374326883191094857906024566921950771760071555266307078912566589261856641951389747392777294648176011723094938 0 0 1 @@ -1286,87 +1377,199 @@ 1 1 1 +1 +0 +0 +11 +372 +21559839277448701880456708096 +5316932265549267143283400319839567616 +16282337714987120045892153486177165723161016453744476162789802658371874062336 +88537159989150876890408569427587371627685568624275408353614000822051296772096 +117153649598454680903779921606971322936867216714956963589387307178373077018966 +2451846285358576582757929577719947826359368522202829009982370031469538161149259226929244677345525601309596834316982200231651181236759995889790497062912 +3757219424385931343692363754866841943466352992489416825487678472853020775555494604110835156534238535884545156565469882173219151445924025758587329876446051 +1637494313049913248505508525988843145443777840250318553676797222770022673451141317105487157651955800518089884835975451904017985829916792949984404185120 +10058766516776922387083424546997939506014390161211981301999104219673036875504700741486695698194962976600388399803269774949866748354955056527082238634885120 +0 +10715086071862672019870723708373567867164049597134887969429342556289689092328893032953381579589338312602609246283412714238525362926688916032991604094856600340922050198587112063568778839323187143820237543594206457218073322356882436956454658807341118763364007714359232059366253413058442519879029375369216 +0 +0 +8 +788 +946214455905379764424855781376 +249640706902979523796329170594729366801 +16258878864784814636110793294682776772576083739386883456710601266131116228608 +94078769493157252401658832572786963194593512892920809466055866983486739972096 +195490272915595318817582071325338439133008656712282569735706902622916446459266 +774359154233456237796402928872914317257521270747766957039349342659625972382672493574510375099070233552293990548180408226281598743426255631871050252288 +3324275818746059767372921081282057650219072022078335429667273973120625111543946446086475227802464005339069654858828935205186959839930518363496383948716964 +9690305591136628284730559742274731850602666195501871310082095979151178872403510613019650261986889225542227473459970356781573066183889915340294060566934540 +18854688550460679120040977419238299860098014817785306576788948091134630080082228033258246996685817245124205310980844728342008317740737273944965604408557568 +0 +21535908620540850229409686341283386471970416340429967737238370022240247758101364064839301635897318433287340370763594753912136240228661108354045783804012930997208048017799043921041828011421457343668782820520536104076035026053782745857307697762578688266768524636747474268145327146906132830376635108519593754580661809442020459403107922707419305832717345589771811762862349427813533987428011905051344117484841279401140909699065164456004599224024146858711124 +0 +0 +16 +132 +980393085630777633795127377920 +43821595176334581224008514546980603456 +52058795012750249675444812857939886156709846064922449115753994933360369074176 +14561123691201700806224839696324937581522964314772521776090379875080644591616 +175349175863053101686937135303271674300289639455959650994302374762982917881921 +1131906497036762609639522228534153459919865408591834031873180959858521631664870050151451799898073343006753689509175537114042334594659610848703981551616 +1350536895369391632569184447114500324766670158350291610958967597949326028999359576936432279782089126385784555900383659506910365560510605065726285256239859 +9451728608924473583394143032579162808176109643324961089109032935808751128466005303662886867241622116000970585797391055402890609702666479416682290459195799 +9869891012844468185531924549366273911251756943322915384954636117410087675117010026464336911857990363996496352787552233421136612436976661888444063719358464 +0 +29160913186613439708872461352513122879764789952607298290885068203114782142216922372207081593038688735241042977627651978016800109665004648282579021506383793652512992091245080903136500261598244223396601485010319512598372184283395628393048826477026318554363070339145452721174808395510502917485184825084502201409114714736758473035605478534635042521922391709556430295750595675343883087393107990838077832220859144502660929828804609103025888309324882798051740 +0 +0 +4 +484 +1089134261820156880321423343616 +145538748117878092352760460206159211126 +33511658511802278583722924194874647566922276789108093402830459143321542459392 +101058486350009815877613019026909063961257758922502987153303461721695947063296 +55893599922312747075336422508333078260508029486824190273117160196130533025956 +2458978570716352272715788097961829640376943254320968964331207836957962374258773872920562816268264474274565514907090130109741585328325854023827972947968 +2334497061062585013441347827924568919650652349786907365392347487262095082662967762597898425035389335443705851967166882197635071826354135997079594483994794 +4739636748710839604647340865523976068039985893121701111166740470358505579292913487988032483975449672818248784390230013345327930989784690681998862554218456 +9268358303535012104892996424126494308898855298485453509135477774190853103484671018397846744502851397110775756567946279667738536399988345534648240817831936 +0 +1823333014513972248453863033569237311230812126130506337878885326530740596368720446811271380284232373400475839583564476423453964756030828084801793759122506966503712459173121792772565318978814203256490836178101826827909880676810922045422401824859785223968311017274407457720180425066972434143458217681896098086428204645340725330308523442939629221459319570158112385542686278442818549344024940355939362383436777208099871277202253431959816109988249138938651 +0 +0 +8 +268 +345705300287849490539146641408 +28619945476059463819047280294135199591 +50097187803714017428498902612256509194829161297911658170445563991107297083392 +85421690222206289410508936520273729553730897899163659208114955446435945906176 +23541147492225259737409530414900909030720627244427625246343510574225863591276 +811358695156145842831903450818927915525548089569942629196406351050494125902340038663677284364719310507462367292228961985914579995483031930887980711936 +2753993259413215653375383555168520262036721258923608032707398699340884867309124328134824761429544678847308130542242013461361725575679679273117130844404184 +6291784738152052628532475385001151529792773731941954632670769788526762258081592087250332058353673371670605911117825763975584603160350868362121314372190208 +8246304950196854775397532690840382052681504659869650088188493089155770401666344769741621508722408724512112431250395089366004560986597746949833784645648384 +0 +33536828490723711025794383275603096340930562958525566355063509107668073876964224976171882248532778409771216997252213433993697133630589947644361952834437975121876157813462137576683247086121046784363938117600983461647174331186404053947864440728674994199031341263900784628270176815603173354730641751334159968196129982738215961466145470666104403167324840397876006086216517663581877927694551780431366423367588590449610474198496508322115190229617947779491804 +0 +0 +4 +744 +285597678780049650206757617664 +183060435302525962072268027628016111021 +7217761771929207302500684142267832220669089126781480397245769148255541657600 +79477460217247376097886641006546273302212937742057604494280155910320628432896 +158450537078399418888641617303234395161356907531049363529305739478391665140056 +560479410674256955928059381764241238133905670084218664847601259116454401923250286188028355182665809615792144602857372046658783886046707955042334277632 +3683866358503387723371342100656401419267927238139401708364406415400694153274197402996715954111156399475059634029565264927949827386724995677572872987734714 +12590844567997964881164942256818297297627752677819872355996517914899426206584352337319457485189429758905990389059981412286350729613199131538807367459067873 +14260854143752552717856629622964902246009611015390566846603377483401216738344769373127606724470825630558473764635392820940186579136492501381274523880390656 +0 +21800320263537007047472351208796015562335481192952840431265409041550951526374116630066499902549548119697525627775845229207308993284066362779188144732297218576386880741913758964084484707758910160792538754632482272801417299710417022721348611414238310143561872419421028837234898971823910500714741024986033307017463050796451118315775556231911389073082154651438223368297410117325974472883309213628390772734914681877034242596184674973753688803388293273496715 +0 +0 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 0 0 0 -779 -300715359548629347440791650303 -102952137211174581797368872328305713571 -52989367194921747398140644829530345164714725742745665979711712562604515786751 -34267987018218655411120483587274031568161823306818289698531027458242297987071 -168690968894183742936235831942688571047904497745923725955091877321747654220396 -259272780705810127344776889495570747917460389058617673573215932643800064644515134025583656203243524957642341470219228728851192153452047875057398054911 -62973227282342561941616951866480478041444268264203341049496779575658669539851333029867803366812194344709884276320875145423969400548183329981228998122706 -5965254129721766112779853674459000262932441534062571314641843535702756946703539112611658066814730814361962056449893208202027591294575821893529344046075171 -16638238834641956112960131003736280741738593054766265118601106882033202096218023706427311810640257941823837170462099179068909971646758601676945280397737983 +303 +1157847834746177602004396802047 +339617671798359351079692875821060456446 +57867775067306645753843239588701162944294645608219998114893217643713234206719 +26369455828243150957066923597651481411694301395220676885210503666274163228671 +11817720390503827648781894443752171196964219125141796458180108788425643579396 +7804371375807015860240250407429415282553584425143433436919818048882206801446222314107580658597196283229772192970700820967091727381696957189718015 +941081632068259047813718693871170463934954812652267338340003979702879896717377687462914527089361639645292415086148993612559161291073345891219533759743345 +13407795142668967188561258511782701242040321017549139392778624385515507058390936234830335193232662892196414947249258255251754028773259240421675666352640010 +18030219496951436955703469321804144806589781292361309272091751131804808417784938468039344100394760314581363716192040882359255669821551713959394630176866303 +20764409093138106714694669222174000783080657450980639056024872831998438690744740872244449057340558976478438798965361453061982147397763104606367603575189606869434278459569124428885756214636676791959099839519692515219337740131125546138808227180751694999895383762073154332479036368513723304712662417407 0 0 0 0 -215 -619250515473902100851732774911 -103650056966466853129126116701268879096 -34228731807048729756933359825505148611254558132425294549833192748910286733311 -88441005919192315584276015684605463479718022380851139569025347884689603428351 -88328258705344571218903867513172716845271068769336469141311035976146790772196 -2649226107791138846724729561524834046756305416350380340956873321870849588917913724217345591524067810279058938311198508544218597293890693510835606650879 -914987870040111141558011898563137014135077957828448748324538340111654574081904823494871258138489611929723478447052852109662650428138394060112195312822830 -8239613276355979167525268263572050851426590695698386039898717453191554916258990950199747288218580220361509451657894228815633791196406573967297930635387177 -8060703179875501734452397315645371132943842065312906287724986321339402104890394902953798729083389116031469222656762579407462366908520135082538921787129855 +131 +1049832718450901370153113485311 +123743968547971240881793449350717343096 +54247495121211160361188037929436149205783261053517263337868798039971357261823 +43780720696046181429968922798344646336098289195769104725971763934578188746751 +8569638876184228017621190554815028317573269823425357131497263831998166914171 +2590756693431741009163041429286398894656679441703939344261083891915266425352426310916864582943630782192228522635328133722758329149109900984640654540799 +1922792972978790663157142765037754247364399993465703829196794167418278912188407110331170404215500826901691954309618913442459626285713809675553469719932485 +2247688179853902828346517371756160939505222414700682406758025105256274372769418491926470116598950917484231339173818993910715883012571037685660436398094565 +14071886071206496987190907766460338856608548573141424962453698818757002916637223518158300237915282267942872621643500179521389478132153075114062917306155007 +6980263492707976602733081771294983285805560539203752519918453497642718603261557999924227728869489680883742630490486041372040492077056076650919876897423133050548479425912646008193088180932733170859088326636344779595580028567634175375390724080269085084386954408009560789015111093719791523327272483291135 0 0 0 0 -133 -1142291584765711146581424603137 -224218142599483019744159109472856123376 -32923443490593568626210425601747684080669113293730909738370866772661994782721 -68880568352305824968409003492650515594964772213132854422080812645499650703361 -12652723729344688954900910126958714289422530030413497425805120886970447592711 -1103206492849224833236955795854604182628160722596764506866311880804509653626451170571700664891519212350617705716677022019024494549705682338329365839873 -3425258808981181408986114435885160216075175156275798387598170377894554593328920485321584208872367865125844049077566765910972308481949916335367518159311436 -4860741751304940812135261709809577128133600853167171692749010934360905221876127788131663351390876534092256218317140333827184421686005266886422175125693628 -8743749066401491218980507448428993195994925213193153534362044455477958023767821426016797793119641242022272990879238224077152409380573039679533424287154177 +213 +624277807757669988326564691969 +308806362863810512481109604679086238721 +7575495667463650924420531623779877444872078518414758729895107613392445112321 +71383655898197942633634404834290712896942744228408684751177316467115735121921 +47122958114890946067870921450228790803155389424276201823055498825762056188186 +1994424534807216528160042697004302546045534768650260352155667756798588514332350607215428085715884919952309860849179354235231346459029751145877699821569 +3146301561202581022604671318145679315132240673197187143392208577019128708207517211248787901932425426040980775091796171281106110880987357700982231152858994 +13344055815468537346229177929721616555294581393221545616480099523908865321613366395170905103332895603014771880154289842243792973144146321750132365948266313 +25653689183378345635977168873503678049300684399452321461457658485062084019322850001321503409853791883406838755199097647132019767454780407950907465283928065 +229130338950058715207075928314567718431940966481184952335048896861640341691504660128894140126073639123936931770837384336344695028165941321264091705246687393301105660309858229907321110227251032801854835879822879826073555284111211015122519313114936258162164556856278990251776549227306961333644609716225 0 0 0 0 -77 -277301662095735836746088185857 -142152606337025304918525812319838745556 -12534840175881050541917831132805720442145400436291151254501325700683775606785 -20878764386374173777118657238171357921836373711458087960880076400635863367681 -136552059111960251915276090336099326982899726428231723116111201986184982594466 -1309756871750733417455059188261971390672404632186814094430483190420092952237128472634463119986376912159204339035021972187813353867261934673638407012353 -2943370938733633382605808344901628632951369041812100574435646648657181085629472266341801305958290453327046622582139872251050014322560690522912986433898975 -9585845803470202086393444688608391911098205350216816791932597819794198747297646808582476755416085138620680263905816828708538683380792568203293817246109093 -2206621789143545137374253360345990308199762545199883788624752793974248232491530652167961020693395748368965925754644305556503287697444204056449929002876929 +141 +119107286127314199610661011457 +208956661746708815346102549108455455236 +9304183766217687257009318351289386378056338413009755635813258086246793609217 +37346116786925829034687685788004865887841441332555982208115369087891606077441 +142686669406791276574941284020696419378508583519717415488223479096553530067216 +1022103513376169960952043514852766564406369544025973264953283529967298973963692347373601150129718093616182401830320452020826518193269025639232195002369 +1255461492445777082599853012891109353852057873636592494368775587155748628015369099916821369435584805024717479183629939627196544920025710945751532635492024 +1189975803267431345957974690102770165991401096160981798863264688637086156816693253154715236752646520545321786646254224097289874096394507609482395432557936 +2038989167013368656643873390716729359930711113157962588962483025137830789336536213929010174321600155153011333126258568329562186707136497102974740273823745 +9084986068063143759355885696834360372551159629320665871137722600252611748073183150082604901064288041886108395689572588307893872058553059179847191635406482453723540265118257106957652545879445444515005992515527078762521603272600432053705760074646655367876806955197570127991703691485644599174058580377601 0 0 0 0 -411 -324570178940368711767358963711 -130173237873606161084081513111146125666 -4440243184057253002058366958949011297729551759653463141908729574974703009791 -104599104892758785945721006587405088655973823131502021182212424437563981299711 -227937449252631589648339596776884877916446709862604265787392220105881584676676 -2761661671097149506426178776418384527810269504846708444400993519040372610318448755622489684186366593808385933251347879225999716850530968694338659287039 -3326758864026021917927985608949523566048578856734365179616807109188697949259297193247893354152568830232368527655546919021919252855447574774424860276818119 -8973169221126471636848109947272753534539663485823225948654863833547893642416253412473354043645216680363593572499550915955052548192583464946608584977309944 -25295172712169986925695313510287246491016523019640348674864055622865874306543756462338800322323361265163416085720907702160935829004000553942038515296501759 +243 +699092340274526400217322881023 +38592925135126088279952503537704324536 +24069098860725904074101863281316659899407559169599337507189559069499782594559 +31845123066004062045091085308083188950704500797090491164647969353944050696191 +118305855347934305358536379357165472350660178373988900770159391774566491848801 +2008713282085666284652556551621962437401356361830493232520690122524894627206383197505895885671920146557265344301589773021846167435240002500658026512383 +323133594322353610393135271506551759249338578228327732110434346721529507354177413565941533352573023280770193553578703771044066939448141422832699655754215 +8866309339762256938205367118241359468285084241706741644373897192876383324845891938408677922953893394868024823096760328985859074426231649039808204582908518 +10592335116562605574859104705966049302824382333355134511227046941609708791279611163990078774097256277263081299114817404233848814642481057406588005371609087 +7409638199867804511590556491020804147437821443902201231464956650918710757587485835871076220513184441280932875327658339055507870288640330135470374231086564968802510793220658631244921907134557333508582119960035628956742572301380943132749810700571732870307187030378399921152414041403031737491047579647999 0 0 0 0 -841 -9420399794733891643001274369 -26308239808977071113207244089376343366 -47302805955142258029697650139867929719657651495110021315452033696431664529409 -100219160123634284631294789632259431938605132574157213619083861154062642708481 -82087772153295270226001133350122835922114973611844362548444268958331029834966 -2117450239054833117818567728047394797813051157453267188024371670913736681578312878632530891860285848254755118558052690958479603408892033292293462032385 -2379888884486213427117291480161905955722461874746438148796605337728982724816128290033475728702112284664885760972474749948876959990565603221079913603426520 -1615235102089076361139051104485129565618834035334363566497760617314748626717238949288388003745630890305450300782302497900890298444504361582203127184376369 -13052856770005614178526443656735412215939232343908610985741660157597547881692618783955585903710495256222918417819937168580320734187963952696812226794749953 +361 +1098223571363824020337471782913 +73118673265328369333869451006373159426 +12612570963041677221068251937087603519725683816332068400361871614991377891329 +44757643964492500248872741260097920363273353321461345189639693578247602176001 +3942245179751587580113754740041160627070588205547869974769586858647333898741 +2612294559420208791815554010100531022826670009294237097218906452805851976960451833971257091500484048552506300644536870798907627346813539746460119072769 +4886652767199484464651425905879582096234981128410546139257549524800652233964932550117395659883947428238070691107034177061699574595056075593731862734910922 +476948687153533538165001293464509838331769398407122530531483520520031422134660870238181672367938291384232556352408026637315514098467464396275313797141550 +4019828793218805646023303231154957746362032987800527539184202417766187717897646394634196457153911354739604912893653289014782783880263859608454097188945921 +4075360670358372722795335962773428342675661975784760871564112696474315403655585860035546105060954687834105799318439691150952278271480480434794674741133762365172004076850361918268011359368504306942773658004160938910939812513459072944161883845284706441576028699349927725653931250854074869857900046581761 0 From f7f5fb4e9326e1b77c683c6e84fe8fea4e72605c Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Wed, 22 Feb 2023 16:33:14 -0500 Subject: [PATCH 08/20] Change display for GoldilocksField --- field/src/goldilocks_field.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/field/src/goldilocks_field.rs b/field/src/goldilocks_field.rs index 8c8d8bc3..e10d0c74 100644 --- a/field/src/goldilocks_field.rs +++ b/field/src/goldilocks_field.rs @@ -46,13 +46,13 @@ impl Hash for GoldilocksField { impl Display for GoldilocksField { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - Display::fmt(&self.0, f) + Display::fmt(&self.to_canonical_u64(), f) } } impl Debug for GoldilocksField { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - Debug::fmt(&self.0, f) + Debug::fmt(&self.to_canonical_u64(), f) } } From f71139d934238c6d0d0e928055ca53bbd9c21e99 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Tue, 21 Feb 2023 21:12:03 -0500 Subject: [PATCH 09/20] Add serialisation support for gates, generators, and various structs Co-authored-by: Sebastien La Duca --- evm/src/fixed_recursive_verifier.rs | 316 ++++- evm/src/permutation.rs | 25 + evm/src/proof.rs | 56 + evm/src/recursive_verifier.rs | 38 + evm/tests/empty_txn_list.rs | 37 +- plonky2/examples/bench_recursion.rs | 14 + plonky2/examples/square_root.rs | 22 +- plonky2/src/fri/oracle.rs | 1 + plonky2/src/fri/proof.rs | 8 +- plonky2/src/gadgets/arithmetic.rs | 24 +- plonky2/src/gadgets/arithmetic_extension.rs | 26 +- plonky2/src/gadgets/polynomial.rs | 2 +- plonky2/src/gadgets/range_check.rs | 29 +- plonky2/src/gadgets/split_base.rs | 20 +- plonky2/src/gadgets/split_join.rs | 45 +- plonky2/src/gates/arithmetic_base.rs | 48 +- plonky2/src/gates/arithmetic_extension.rs | 48 +- plonky2/src/gates/base_sum.rs | 34 +- plonky2/src/gates/constant.rs | 15 +- plonky2/src/gates/coset_interpolation.rs | 49 +- plonky2/src/gates/exponentiation.rs | 38 +- plonky2/src/gates/gate.rs | 25 +- plonky2/src/gates/multiplication_extension.rs | 41 +- plonky2/src/gates/noop.rs | 14 +- plonky2/src/gates/poseidon.rs | 36 +- plonky2/src/gates/poseidon_mds.rs | 33 +- plonky2/src/gates/public_input.rs | 14 +- plonky2/src/gates/random_access.rs | 48 +- plonky2/src/gates/reducing.rs | 42 +- plonky2/src/gates/reducing_extension.rs | 42 +- plonky2/src/hash/hash_types.rs | 4 +- plonky2/src/hash/merkle_proofs.rs | 2 +- plonky2/src/hash/merkle_tree.rs | 2 +- plonky2/src/iop/ext_target.rs | 6 + plonky2/src/iop/generator.rs | 152 +- plonky2/src/iop/target.rs | 8 +- plonky2/src/plonk/circuit_builder.rs | 12 +- plonky2/src/plonk/circuit_data.rs | 91 +- plonky2/src/plonk/proof.rs | 8 +- plonky2/src/recursion/cyclic_recursion.rs | 18 + plonky2/src/recursion/dummy_circuit.rs | 114 +- plonky2/src/util/gate_serialization.rs | 101 ++ plonky2/src/util/generator_serialization.rs | 156 ++ plonky2/src/util/mod.rs | 4 + plonky2/src/util/serialization.rs | 1259 ++++++++++++++++- 45 files changed, 2974 insertions(+), 153 deletions(-) create mode 100644 plonky2/src/util/gate_serialization.rs create mode 100644 plonky2/src/util/generator_serialization.rs diff --git a/evm/src/fixed_recursive_verifier.rs b/evm/src/fixed_recursive_verifier.rs index 2dcd1824..8b8cf284 100644 --- a/evm/src/fixed_recursive_verifier.rs +++ b/evm/src/fixed_recursive_verifier.rs @@ -1,3 +1,4 @@ +use core::mem::{self, MaybeUninit}; use std::collections::BTreeMap; use std::ops::Range; @@ -19,6 +20,9 @@ use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher}; use plonky2::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; use plonky2::recursion::cyclic_recursion::check_cyclic_proof_verifier_data; use plonky2::recursion::dummy_circuit::cyclic_base_proof; +use plonky2::util::gate_serialization::GateSerializer; +use plonky2::util::generator_serialization::WitnessGeneratorSerializer; +use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; use plonky2::util::timing::TimingTree; use plonky2_util::log2_ceil; @@ -47,6 +51,7 @@ const THRESHOLD_DEGREE_BITS: usize = 13; /// `degree_bits`, this contains a chain of recursive circuits for shrinking that STARK from /// `degree_bits` to a constant `THRESHOLD_DEGREE_BITS`. It also contains a special root circuit /// for combining each STARK's shrunk wrapper proof into a single proof. +#[derive(Eq, PartialEq, Debug)] pub struct AllRecursiveCircuits where F: RichField + Extendable, @@ -64,12 +69,13 @@ where /// Data for the EVM root circuit, which is used to combine each STARK's shrunk wrapper proof /// into a single proof. +#[derive(Eq, PartialEq, Debug)] pub struct RootCircuitData where F: RichField + Extendable, C: GenericConfig, { - circuit: CircuitData, + pub circuit: CircuitData, proof_with_pis: [ProofWithPublicInputsTarget; NUM_TABLES], /// For each table, various inner circuits may be used depending on the initial table size. /// This target holds the index of the circuit (within `final_circuits()`) that was used. @@ -79,37 +85,182 @@ where cyclic_vk: VerifierCircuitTarget, } +impl RootCircuitData +where + F: RichField + Extendable, + C: GenericConfig, +{ + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_circuit_data(&self.circuit, gate_serializer, generator_serializer)?; + for proof in &self.proof_with_pis { + buffer.write_target_proof_with_public_inputs(proof)?; + } + for index in self.index_verifier_data { + buffer.write_target(index)?; + } + buffer.write_target_verifier_circuit(&self.cyclic_vk)?; + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let circuit = buffer.read_circuit_data(gate_serializer, generator_serializer)?; + let mut proof_with_pis = Vec::with_capacity(NUM_TABLES); + for _ in 0..NUM_TABLES { + proof_with_pis.push(buffer.read_target_proof_with_public_inputs()?); + } + let mut index_verifier_data = Vec::with_capacity(NUM_TABLES); + for _ in 0..NUM_TABLES { + index_verifier_data.push(buffer.read_target()?); + } + let cyclic_vk = buffer.read_target_verifier_circuit()?; + + Ok(Self { + circuit, + proof_with_pis: proof_with_pis.try_into().unwrap(), + index_verifier_data: index_verifier_data.try_into().unwrap(), + cyclic_vk, + }) + } +} + /// Data for the aggregation circuit, which is used to compress two proofs into one. Each inner /// proof can be either an EVM root proof or another aggregation proof. +#[derive(Eq, PartialEq, Debug)] pub struct AggregationCircuitData where F: RichField + Extendable, C: GenericConfig, { - circuit: CircuitData, + pub circuit: CircuitData, lhs: AggregationChildTarget, rhs: AggregationChildTarget, cyclic_vk: VerifierCircuitTarget, } +impl AggregationCircuitData +where + F: RichField + Extendable, + C: GenericConfig, +{ + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_circuit_data(&self.circuit, gate_serializer, generator_serializer)?; + buffer.write_target_verifier_circuit(&self.cyclic_vk)?; + self.lhs.to_buffer(buffer)?; + self.rhs.to_buffer(buffer)?; + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let circuit = buffer.read_circuit_data(gate_serializer, generator_serializer)?; + let cyclic_vk = buffer.read_target_verifier_circuit()?; + let lhs = AggregationChildTarget::from_buffer(buffer)?; + let rhs = AggregationChildTarget::from_buffer(buffer)?; + Ok(Self { + circuit, + lhs, + rhs, + cyclic_vk, + }) + } +} + +#[derive(Eq, PartialEq, Debug)] pub struct AggregationChildTarget { is_agg: BoolTarget, agg_proof: ProofWithPublicInputsTarget, evm_proof: ProofWithPublicInputsTarget, } +impl AggregationChildTarget { + pub fn to_buffer(&self, buffer: &mut Vec) -> IoResult<()> { + buffer.write_target_bool(self.is_agg)?; + buffer.write_target_proof_with_public_inputs(&self.agg_proof)?; + buffer.write_target_proof_with_public_inputs(&self.evm_proof)?; + Ok(()) + } + + pub fn from_buffer(buffer: &mut Buffer) -> IoResult { + let is_agg = buffer.read_target_bool()?; + let agg_proof = buffer.read_target_proof_with_public_inputs()?; + let evm_proof = buffer.read_target_proof_with_public_inputs()?; + Ok(Self { + is_agg, + agg_proof, + evm_proof, + }) + } +} + +#[derive(Eq, PartialEq, Debug)] pub struct BlockCircuitData where F: RichField + Extendable, C: GenericConfig, { - circuit: CircuitData, + pub circuit: CircuitData, has_parent_block: BoolTarget, parent_block_proof: ProofWithPublicInputsTarget, agg_root_proof: ProofWithPublicInputsTarget, cyclic_vk: VerifierCircuitTarget, } +impl BlockCircuitData +where + F: RichField + Extendable, + C: GenericConfig, +{ + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_circuit_data(&self.circuit, gate_serializer, generator_serializer)?; + buffer.write_target_bool(self.has_parent_block)?; + buffer.write_target_proof_with_public_inputs(&self.parent_block_proof)?; + buffer.write_target_proof_with_public_inputs(&self.agg_root_proof)?; + buffer.write_target_verifier_circuit(&self.cyclic_vk)?; + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let circuit = buffer.read_circuit_data(gate_serializer, generator_serializer)?; + let has_parent_block = buffer.read_target_bool()?; + let parent_block_proof = buffer.read_target_proof_with_public_inputs()?; + let agg_root_proof = buffer.read_target_proof_with_public_inputs()?; + let cyclic_vk = buffer.read_target_verifier_circuit()?; + Ok(Self { + circuit, + has_parent_block, + parent_block_proof, + agg_root_proof, + cyclic_vk, + }) + } +} + impl AllRecursiveCircuits where F: RichField + Extendable, @@ -124,6 +275,67 @@ where [(); C::HCO::WIDTH]:, [(); C::HCI::WIDTH]:, { + pub fn to_bytes( + &self, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult> { + // TODO: would be better to initialize it dynamically based on the supported max degree. + let mut buffer = Vec::with_capacity(1 << 34); + self.root + .to_buffer(&mut buffer, gate_serializer, generator_serializer)?; + self.aggregation + .to_buffer(&mut buffer, gate_serializer, generator_serializer)?; + self.block + .to_buffer(&mut buffer, gate_serializer, generator_serializer)?; + for table in &self.by_table { + table.to_buffer(&mut buffer, gate_serializer, generator_serializer)?; + } + Ok(buffer) + } + + pub fn from_bytes( + bytes: &[u8], + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let mut buffer = Buffer::new(bytes.to_vec()); + let root = + RootCircuitData::from_buffer(&mut buffer, gate_serializer, generator_serializer)?; + let aggregation = AggregationCircuitData::from_buffer( + &mut buffer, + gate_serializer, + generator_serializer, + )?; + let block = + BlockCircuitData::from_buffer(&mut buffer, gate_serializer, generator_serializer)?; + + // Tricky use of MaybeUninit to remove the need for implementing Debug + // for all underlying types, necessary to convert a by_table Vec to an array. + let by_table = { + let mut by_table: [MaybeUninit>; NUM_TABLES] = + unsafe { MaybeUninit::uninit().assume_init() }; + for table in &mut by_table[..] { + let value = RecursiveCircuitsForTable::from_buffer( + &mut buffer, + gate_serializer, + generator_serializer, + )?; + *table = MaybeUninit::new(value); + } + unsafe { + mem::transmute::<_, [RecursiveCircuitsForTable; NUM_TABLES]>(by_table) + } + }; + + Ok(Self { + root, + aggregation, + block, + by_table, + }) + } + /// Preprocess all recursive circuits used by the system. pub fn new( all_stark: &AllStark, @@ -484,7 +696,8 @@ where } } -struct RecursiveCircuitsForTable +#[derive(Eq, PartialEq, Debug)] +pub struct RecursiveCircuitsForTable where F: RichField + Extendable, C: GenericConfig, @@ -504,6 +717,39 @@ where [(); C::HCO::WIDTH]:, [(); C::HCI::WIDTH]:, { + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_usize(self.by_stark_size.len())?; + for (&size, table) in &self.by_stark_size { + buffer.write_usize(size)?; + table.to_buffer(buffer, gate_serializer, generator_serializer)?; + } + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let length = buffer.read_usize()?; + let mut by_stark_size = BTreeMap::new(); + for _ in 0..length { + let key = buffer.read_usize()?; + let table = RecursiveCircuitsForTableSize::from_buffer( + buffer, + gate_serializer, + generator_serializer, + )?; + by_stark_size.insert(key, table); + } + Ok(Self { by_stark_size }) + } + fn new>( table: Table, stark: &S, @@ -549,6 +795,7 @@ where /// A chain of shrinking wrapper circuits, ending with a final circuit with `degree_bits` /// `THRESHOLD_DEGREE_BITS`. +#[derive(Eq, PartialEq, Debug)] struct RecursiveCircuitsForTableSize where F: RichField + Extendable, @@ -568,6 +815,67 @@ where [(); C::HCO::WIDTH]:, [(); C::HCI::WIDTH]:, { + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_usize(self.shrinking_wrappers.len())?; + if !self.shrinking_wrappers.is_empty() { + buffer.write_common_circuit_data( + &self.shrinking_wrappers[0].circuit.common, + gate_serializer, + )?; + } + for wrapper in &self.shrinking_wrappers { + buffer.write_prover_only_circuit_data( + &wrapper.circuit.prover_only, + generator_serializer, + )?; + buffer.write_verifier_only_circuit_data(&wrapper.circuit.verifier_only)?; + buffer.write_target_proof_with_public_inputs(&wrapper.proof_with_pis_target)?; + } + self.initial_wrapper + .to_buffer(buffer, gate_serializer, generator_serializer)?; + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let length = buffer.read_usize()?; + let mut shrinking_wrappers = Vec::with_capacity(length); + if length != 0 { + let common = buffer.read_common_circuit_data(gate_serializer)?; + + for _ in 0..length { + let prover_only = + buffer.read_prover_only_circuit_data(generator_serializer, &common)?; + let verifier_only = buffer.read_verifier_only_circuit_data()?; + let proof_with_pis_target = buffer.read_target_proof_with_public_inputs()?; + shrinking_wrappers.push(PlonkWrapperCircuit { + circuit: CircuitData { + common: common.clone(), + prover_only, + verifier_only, + }, + proof_with_pis_target, + }) + } + }; + + let initial_wrapper = + StarkWrapperCircuit::from_buffer(buffer, gate_serializer, generator_serializer)?; + + Ok(Self { + initial_wrapper, + shrinking_wrappers, + }) + } + fn new>( table: Table, stark: &S, diff --git a/evm/src/permutation.rs b/evm/src/permutation.rs index 7dc21871..72078c93 100644 --- a/evm/src/permutation.rs +++ b/evm/src/permutation.rs @@ -17,6 +17,7 @@ use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::config::{AlgebraicHasher, Hasher}; use plonky2::plonk::plonk_common::{reduce_with_powers, reduce_with_powers_ext_circuit}; use plonky2::util::reducing::{ReducingFactor, ReducingFactorTarget}; +use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; use plonky2_maybe_rayon::*; use crate::config::StarkConfig; @@ -89,6 +90,30 @@ pub(crate) struct GrandProductChallengeSet { pub(crate) challenges: Vec>, } +impl GrandProductChallengeSet { + pub fn to_buffer(&self, buffer: &mut Vec) -> IoResult<()> { + buffer.write_usize(self.challenges.len())?; + for challenge in &self.challenges { + buffer.write_target(challenge.beta)?; + buffer.write_target(challenge.gamma)?; + } + Ok(()) + } + + pub fn from_buffer(buffer: &mut Buffer) -> IoResult { + let length = buffer.read_usize()?; + let mut challenges = Vec::with_capacity(length); + for _ in 0..length { + challenges.push(GrandProductChallenge { + beta: buffer.read_target()?, + gamma: buffer.read_target()?, + }); + } + + Ok(GrandProductChallengeSet { challenges }) + } +} + /// Compute all Z polynomials (for permutation arguments). pub(crate) fn compute_permutation_z_polys( stark: &S, diff --git a/evm/src/proof.rs b/evm/src/proof.rs index b243c9be..0fefcc0c 100644 --- a/evm/src/proof.rs +++ b/evm/src/proof.rs @@ -12,6 +12,7 @@ use plonky2::hash::merkle_tree::MerkleCap; use plonky2::iop::ext_target::ExtensionTarget; use plonky2::iop::target::Target; use plonky2::plonk::config::GenericConfig; +use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; use plonky2_maybe_rayon::*; use serde::{Deserialize, Serialize}; @@ -148,6 +149,7 @@ impl, C: GenericConfig, const D: usize> S } } +#[derive(Eq, PartialEq, Debug)] pub struct StarkProofTarget { pub trace_cap: MerkleCapTarget, pub permutation_ctl_zs_cap: MerkleCapTarget, @@ -157,6 +159,31 @@ pub struct StarkProofTarget { } impl StarkProofTarget { + pub fn to_buffer(&self, buffer: &mut Vec) -> IoResult<()> { + buffer.write_target_merkle_cap(&self.trace_cap)?; + buffer.write_target_merkle_cap(&self.permutation_ctl_zs_cap)?; + buffer.write_target_merkle_cap(&self.quotient_polys_cap)?; + buffer.write_target_fri_proof(&self.opening_proof)?; + self.openings.to_buffer(buffer)?; + Ok(()) + } + + pub fn from_buffer(buffer: &mut Buffer) -> IoResult { + let trace_cap = buffer.read_target_merkle_cap()?; + let permutation_ctl_zs_cap = buffer.read_target_merkle_cap()?; + let quotient_polys_cap = buffer.read_target_merkle_cap()?; + let opening_proof = buffer.read_target_fri_proof()?; + let openings = StarkOpeningSetTarget::from_buffer(buffer)?; + + Ok(Self { + trace_cap, + permutation_ctl_zs_cap, + quotient_polys_cap, + openings, + opening_proof, + }) + } + /// Recover the length of the trace from a STARK proof and a STARK config. pub fn recover_degree_bits(&self, config: &StarkConfig) -> usize { let initial_merkle_proof = &self.opening_proof.query_round_proofs[0] @@ -276,6 +303,7 @@ impl, const D: usize> StarkOpeningSet { } } +#[derive(Eq, PartialEq, Debug)] pub struct StarkOpeningSetTarget { pub local_values: Vec>, pub next_values: Vec>, @@ -286,6 +314,34 @@ pub struct StarkOpeningSetTarget { } impl StarkOpeningSetTarget { + pub fn to_buffer(&self, buffer: &mut Vec) -> IoResult<()> { + buffer.write_target_ext_vec(&self.local_values)?; + buffer.write_target_ext_vec(&self.next_values)?; + buffer.write_target_ext_vec(&self.permutation_ctl_zs)?; + buffer.write_target_ext_vec(&self.permutation_ctl_zs_next)?; + buffer.write_target_vec(&self.ctl_zs_last)?; + buffer.write_target_ext_vec(&self.quotient_polys)?; + Ok(()) + } + + pub fn from_buffer(buffer: &mut Buffer) -> IoResult { + let local_values = buffer.read_target_ext_vec::()?; + let next_values = buffer.read_target_ext_vec::()?; + let permutation_ctl_zs = buffer.read_target_ext_vec::()?; + let permutation_ctl_zs_next = buffer.read_target_ext_vec::()?; + let ctl_zs_last = buffer.read_target_vec()?; + let quotient_polys = buffer.read_target_ext_vec::()?; + + Ok(Self { + local_values, + next_values, + permutation_ctl_zs, + permutation_ctl_zs_next, + ctl_zs_last, + quotient_polys, + }) + } + pub(crate) fn to_fri_openings(&self, zero: Target) -> FriOpeningsTarget { let zeta_batch = FriOpeningBatchTarget { values: self diff --git a/evm/src/recursive_verifier.rs b/evm/src/recursive_verifier.rs index 14e31341..5f4c5538 100644 --- a/evm/src/recursive_verifier.rs +++ b/evm/src/recursive_verifier.rs @@ -18,7 +18,10 @@ use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::circuit_data::{CircuitConfig, CircuitData, VerifierCircuitData}; use plonky2::plonk::config::{AlgebraicHasher, GenericConfig}; use plonky2::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; +use plonky2::util::gate_serialization::GateSerializer; +use plonky2::util::generator_serialization::WitnessGeneratorSerializer; use plonky2::util::reducing::ReducingFactorTarget; +use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; use plonky2::with_context; use plonky2_util::log2_ceil; @@ -157,6 +160,7 @@ impl, C: GenericConfig, const D: usize> } /// Represents a circuit which recursively verifies a STARK proof. +#[derive(Eq, PartialEq, Debug)] pub(crate) struct StarkWrapperCircuit where F: RichField + Extendable, @@ -178,6 +182,39 @@ where [(); C::HCO::WIDTH]:, [(); C::HCI::WIDTH]:, { + pub fn to_buffer( + &self, + buffer: &mut Vec, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + buffer.write_circuit_data(&self.circuit, gate_serializer, generator_serializer)?; + buffer.write_target_vec(&self.init_challenger_state_target)?; + buffer.write_target(self.zero_target)?; + self.stark_proof_target.to_buffer(buffer)?; + self.ctl_challenges_target.to_buffer(buffer)?; + Ok(()) + } + + pub fn from_buffer( + buffer: &mut Buffer, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let circuit = buffer.read_circuit_data(gate_serializer, generator_serializer)?; + let init_challenger_state_target = buffer.read_target_vec()?; + let zero_target = buffer.read_target()?; + let stark_proof_target = StarkProofTarget::from_buffer(buffer)?; + let ctl_challenges_target = GrandProductChallengeSet::from_buffer(buffer)?; + Ok(Self { + circuit, + stark_proof_target, + ctl_challenges_target, + init_challenger_state_target: init_challenger_state_target.try_into().unwrap(), + zero_target, + }) + } + pub(crate) fn prove( &self, proof_with_metadata: &StarkProofWithMetadata, @@ -212,6 +249,7 @@ where } /// Represents a circuit which recursively verifies a PLONK proof. +#[derive(Eq, PartialEq, Debug)] pub(crate) struct PlonkWrapperCircuit where F: RichField + Extendable, diff --git a/evm/tests/empty_txn_list.rs b/evm/tests/empty_txn_list.rs index 9a4eb5e0..fae2f656 100644 --- a/evm/tests/empty_txn_list.rs +++ b/evm/tests/empty_txn_list.rs @@ -1,13 +1,17 @@ #![allow(clippy::upper_case_acronyms)] use std::collections::HashMap; +use std::marker::PhantomData; use std::time::Duration; use env_logger::{try_init_from_env, Env, DEFAULT_FILTER_ENV}; use eth_trie_utils::partial_trie::{HashedPartialTrie, PartialTrie}; use keccak_hash::keccak; +use log::info; use plonky2::field::goldilocks_field::GoldilocksField; use plonky2::plonk::config::PoseidonGoldilocksConfig; +use plonky2::util::gate_serialization::default::DefaultGateSerializer; +use plonky2::util::generator_serialization::default::DefaultGeneratorSerializer; use plonky2::util::timing::TimingTree; use plonky2_evm::all_stark::AllStark; use plonky2_evm::config::StarkConfig; @@ -92,8 +96,39 @@ fn test_empty_txn_list() -> anyhow::Result<()> { verify_proof(&all_stark, proof, &config)?; - let all_circuits = AllRecursiveCircuits::::new(&all_stark, 9..19, &config); + let all_circuits = AllRecursiveCircuits::::new(&all_stark, 9..18, &config); + + { + let gate_serializer = DefaultGateSerializer; + let generator_serializer = DefaultGeneratorSerializer { + _phantom: PhantomData::, + }; + + let timing = TimingTree::new("serialize AllRecursiveCircuits", log::Level::Info); + let all_circuits_bytes = all_circuits + .to_bytes(&gate_serializer, &generator_serializer) + .map_err(|_| anyhow::Error::msg("AllRecursiveCircuits serialization failed."))?; + timing.filter(Duration::from_millis(100)).print(); + info!( + "AllRecursiveCircuits length: {} bytes", + all_circuits_bytes.len() + ); + + let timing = TimingTree::new("deserialize AllRecursiveCircuits", log::Level::Info); + let all_circuits_from_bytes = AllRecursiveCircuits::::from_bytes( + &all_circuits_bytes, + &gate_serializer, + &generator_serializer, + ) + .map_err(|_| anyhow::Error::msg("AllRecursiveCircuits deserialization failed."))?; + timing.filter(Duration::from_millis(100)).print(); + + assert_eq!(all_circuits, all_circuits_from_bytes); + } + + let mut timing = TimingTree::new("prove", log::Level::Info); let root_proof = all_circuits.prove_root(&all_stark, &config, inputs, &mut timing)?; + timing.filter(Duration::from_millis(100)).print(); all_circuits.verify_root(root_proof.clone())?; let agg_proof = all_circuits.prove_aggregation(false, &root_proof, false, &root_proof)?; diff --git a/plonky2/examples/bench_recursion.rs b/plonky2/examples/bench_recursion.rs index fd5c9518..c5635a1d 100644 --- a/plonky2/examples/bench_recursion.rs +++ b/plonky2/examples/bench_recursion.rs @@ -22,6 +22,7 @@ use plonky2::plonk::circuit_data::{CircuitConfig, CommonCircuitData, VerifierOnl use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, PoseidonGoldilocksConfig}; use plonky2::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs}; use plonky2::plonk::prover::prove; +use plonky2::util::gate_serialization::default::DefaultGateSerializer; use plonky2::util::timing::TimingTree; use plonky2_field::extension::Extendable; use plonky2_maybe_rayon::rayon; @@ -181,6 +182,19 @@ where CompressedProofWithPublicInputs::from_bytes(compressed_proof_bytes, cd)?; assert_eq!(compressed_proof, compressed_proof_from_bytes); + let gate_serializer = DefaultGateSerializer; + let common_data_bytes = cd + .to_bytes(&gate_serializer) + .map_err(|_| anyhow::Error::msg("CommonCircuitData serialization failed."))?; + info!( + "Common circuit data length: {} bytes", + common_data_bytes.len() + ); + let common_data_from_bytes = + CommonCircuitData::::from_bytes(common_data_bytes, &gate_serializer) + .map_err(|_| anyhow::Error::msg("CommonCircuitData deserialization failed."))?; + assert_eq!(cd, &common_data_from_bytes); + Ok(()) } diff --git a/plonky2/examples/square_root.rs b/plonky2/examples/square_root.rs index 9c253b69..7cf294c6 100644 --- a/plonky2/examples/square_root.rs +++ b/plonky2/examples/square_root.rs @@ -11,11 +11,12 @@ use plonky2::iop::witness::{PartialWitness, PartitionWitness, Witness, WitnessWr use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::circuit_data::CircuitConfig; use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; +use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; use plonky2_field::extension::Extendable; /// A generator used by the prover to calculate the square root (`x`) of a given value /// (`x_squared`), outside of the circuit, in order to supply it as an additional public input. -#[derive(Debug)] +#[derive(Debug, Default)] struct SquareRootGenerator, const D: usize> { x: Target, x_squared: Target, @@ -25,6 +26,10 @@ struct SquareRootGenerator, const D: usize> { impl, const D: usize> SimpleGenerator for SquareRootGenerator { + fn id(&self) -> String { + "SquareRootGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.x_squared] } @@ -37,6 +42,21 @@ impl, const D: usize> SimpleGenerator out_buffer.set_target(self.x, x); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.x)?; + dst.write_target(self.x_squared) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let x = src.read_target()?; + let x_squared = src.read_target()?; + Ok(Self { + x, + x_squared, + _phantom: PhantomData, + }) + } } /// An example of using Plonky2 to prove a statement of the form diff --git a/plonky2/src/fri/oracle.rs b/plonky2/src/fri/oracle.rs index 7855167a..bb0421fe 100644 --- a/plonky2/src/fri/oracle.rs +++ b/plonky2/src/fri/oracle.rs @@ -27,6 +27,7 @@ use crate::util::{log2_strict, reverse_bits, reverse_index_bits_in_place, transp pub const SALT_SIZE: usize = 4; /// Represents a FRI oracle, i.e. a batch of polynomials which have been Merklized. +#[derive(Eq, PartialEq, Debug)] pub struct PolynomialBatch, C: GenericConfig, const D: usize> { pub polynomials: Vec>, diff --git a/plonky2/src/fri/proof.rs b/plonky2/src/fri/proof.rs index cf1a60d1..326001fd 100644 --- a/plonky2/src/fri/proof.rs +++ b/plonky2/src/fri/proof.rs @@ -33,7 +33,7 @@ pub struct FriQueryStep< pub merkle_proof: MerkleProof, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct FriQueryStepTarget { pub evals: Vec>, pub merkle_proof: MerkleProofTarget, @@ -58,7 +58,7 @@ impl> FriInitialTreeProof, MerkleProofTarget)>, } @@ -92,7 +92,7 @@ pub struct FriQueryRound< pub steps: Vec>, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct FriQueryRoundTarget { pub initial_trees_proof: FriInitialTreeProofTarget, pub steps: Vec>, @@ -129,7 +129,7 @@ pub struct FriProof, HC: HashConfig, H: Hasher { pub commit_phase_merkle_caps: Vec, pub query_round_proofs: Vec>, diff --git a/plonky2/src/gadgets/arithmetic.rs b/plonky2/src/gadgets/arithmetic.rs index 6bff79d1..9a89e5a3 100644 --- a/plonky2/src/gadgets/arithmetic.rs +++ b/plonky2/src/gadgets/arithmetic.rs @@ -11,6 +11,7 @@ use crate::iop::generator::{GeneratedValues, SimpleGenerator}; use crate::iop::target::{BoolTarget, Target}; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> CircuitBuilder { /// Computes `-x`. @@ -370,8 +371,8 @@ impl, const D: usize> CircuitBuilder { } } -#[derive(Debug)] -struct EqualityGenerator { +#[derive(Debug, Default)] +pub(crate) struct EqualityGenerator { x: Target, y: Target, equal: BoolTarget, @@ -379,6 +380,10 @@ struct EqualityGenerator { } impl SimpleGenerator for EqualityGenerator { + fn id(&self) -> String { + "EqualityGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.x, self.y] } @@ -392,6 +397,21 @@ impl SimpleGenerator for EqualityGenerator { out_buffer.set_bool_target(self.equal, x == y); out_buffer.set_target(self.inv, inv); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.x)?; + dst.write_target(self.y)?; + dst.write_target_bool(self.equal)?; + dst.write_target(self.inv) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let x = src.read_target()?; + let y = src.read_target()?; + let equal = src.read_target_bool()?; + let inv = src.read_target()?; + Ok(Self { x, y, equal, inv }) + } } /// Represents a base arithmetic operation in the circuit. Used to memoize results. diff --git a/plonky2/src/gadgets/arithmetic_extension.rs b/plonky2/src/gadgets/arithmetic_extension.rs index 6fcab718..69a5668c 100644 --- a/plonky2/src/gadgets/arithmetic_extension.rs +++ b/plonky2/src/gadgets/arithmetic_extension.rs @@ -13,6 +13,7 @@ use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::util::bits_u64; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> CircuitBuilder { pub fn arithmetic_extension( @@ -493,8 +494,8 @@ impl, const D: usize> CircuitBuilder { } } -#[derive(Debug)] -struct QuotientGeneratorExtension { +#[derive(Debug, Default)] +pub(crate) struct QuotientGeneratorExtension { numerator: ExtensionTarget, denominator: ExtensionTarget, quotient: ExtensionTarget, @@ -503,6 +504,10 @@ struct QuotientGeneratorExtension { impl, const D: usize> SimpleGenerator for QuotientGeneratorExtension { + fn id(&self) -> String { + "QuotientGeneratorExtension".to_string() + } + fn dependencies(&self) -> Vec { let mut deps = self.numerator.to_target_array().to_vec(); deps.extend(self.denominator.to_target_array()); @@ -515,6 +520,23 @@ impl, const D: usize> SimpleGenerator let quotient = num / dem; out_buffer.set_extension_target(self.quotient, quotient) } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target_ext(self.numerator)?; + dst.write_target_ext(self.denominator)?; + dst.write_target_ext(self.quotient) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let numerator = src.read_target_ext()?; + let denominator = src.read_target_ext()?; + let quotient = src.read_target_ext()?; + Ok(Self { + numerator, + denominator, + quotient, + }) + } } /// An iterator over the powers of a certain base element `b`: `b^0, b^1, b^2, ...`. diff --git a/plonky2/src/gadgets/polynomial.rs b/plonky2/src/gadgets/polynomial.rs index 80beb62f..d43d99c2 100644 --- a/plonky2/src/gadgets/polynomial.rs +++ b/plonky2/src/gadgets/polynomial.rs @@ -7,7 +7,7 @@ use crate::iop::target::Target; use crate::plonk::circuit_builder::CircuitBuilder; use crate::util::reducing::ReducingFactorTarget; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PolynomialCoeffsExtTarget(pub Vec>); impl PolynomialCoeffsExtTarget { diff --git a/plonky2/src/gadgets/range_check.rs b/plonky2/src/gadgets/range_check.rs index 4c22009d..144ae5dc 100644 --- a/plonky2/src/gadgets/range_check.rs +++ b/plonky2/src/gadgets/range_check.rs @@ -7,6 +7,7 @@ use crate::iop::generator::{GeneratedValues, SimpleGenerator}; use crate::iop::target::{BoolTarget, Target}; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> CircuitBuilder { /// Checks that `x < 2^n_log` using a `BaseSumGate`. @@ -51,8 +52,8 @@ impl, const D: usize> CircuitBuilder { } } -#[derive(Debug)] -struct LowHighGenerator { +#[derive(Debug, Default)] +pub(crate) struct LowHighGenerator { integer: Target, n_log: usize, low: Target, @@ -60,6 +61,10 @@ struct LowHighGenerator { } impl SimpleGenerator for LowHighGenerator { + fn id(&self) -> String { + "LowHighGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.integer] } @@ -72,4 +77,24 @@ impl SimpleGenerator for LowHighGenerator { out_buffer.set_target(self.low, F::from_canonical_u64(low)); out_buffer.set_target(self.high, F::from_canonical_u64(high)); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.integer)?; + dst.write_usize(self.n_log)?; + dst.write_target(self.low)?; + dst.write_target(self.high) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let integer = src.read_target()?; + let n_log = src.read_usize()?; + let low = src.read_target()?; + let high = src.read_target()?; + Ok(Self { + integer, + n_log, + low, + high, + }) + } } diff --git a/plonky2/src/gadgets/split_base.rs b/plonky2/src/gadgets/split_base.rs index dd0edf5d..ace3284d 100644 --- a/plonky2/src/gadgets/split_base.rs +++ b/plonky2/src/gadgets/split_base.rs @@ -13,6 +13,7 @@ use crate::iop::target::{BoolTarget, Target}; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::util::log_floor; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> CircuitBuilder { /// Split the given element into a list of targets, where each one represents a @@ -79,13 +80,17 @@ impl, const D: usize> CircuitBuilder { } } -#[derive(Debug)] -struct BaseSumGenerator { +#[derive(Debug, Default)] +pub(crate) struct BaseSumGenerator { row: usize, limbs: Vec, } impl SimpleGenerator for BaseSumGenerator { + fn id(&self) -> String { + "BaseSumGenerator".to_string() + } + fn dependencies(&self) -> Vec { self.limbs.iter().map(|b| b.target).collect() } @@ -102,6 +107,17 @@ impl SimpleGenerator for BaseSumGenerator { out_buffer.set_target(Target::wire(self.row, BaseSumGate::::WIRE_SUM), sum); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_target_bool_vec(&self.limbs) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let limbs = src.read_target_bool_vec()?; + Ok(Self { row, limbs }) + } } #[cfg(test)] diff --git a/plonky2/src/gadgets/split_join.rs b/plonky2/src/gadgets/split_join.rs index 56e469b9..4e39a2be 100644 --- a/plonky2/src/gadgets/split_join.rs +++ b/plonky2/src/gadgets/split_join.rs @@ -9,6 +9,7 @@ use crate::iop::target::{BoolTarget, Target}; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::util::ceil_div_usize; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> CircuitBuilder { /// Split the given integer into a list of wires, where each one represents a @@ -55,13 +56,17 @@ impl, const D: usize> CircuitBuilder { } } -#[derive(Debug)] -struct SplitGenerator { +#[derive(Debug, Default)] +pub(crate) struct SplitGenerator { integer: Target, bits: Vec, } impl SimpleGenerator for SplitGenerator { + fn id(&self) -> String { + "SplitGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.integer] } @@ -80,16 +85,31 @@ impl SimpleGenerator for SplitGenerator { "Integer too large to fit in given number of bits" ); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.integer)?; + dst.write_target_vec(&self.bits) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let integer = src.read_target()?; + let bits = src.read_target_vec()?; + Ok(Self { integer, bits }) + } } -#[derive(Debug)] -struct WireSplitGenerator { +#[derive(Debug, Default)] +pub(crate) struct WireSplitGenerator { integer: Target, gates: Vec, num_limbs: usize, } impl SimpleGenerator for WireSplitGenerator { + fn id(&self) -> String { + "WireSplitGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.integer] } @@ -120,4 +140,21 @@ impl SimpleGenerator for WireSplitGenerator { self.gates.len() ); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.integer)?; + dst.write_usize_vec(&self.gates)?; + dst.write_usize(self.num_limbs) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let integer = src.read_target()?; + let gates = src.read_usize_vec()?; + let num_limbs = src.read_usize()?; + Ok(Self { + integer, + gates, + num_limbs, + }) + } } diff --git a/plonky2/src/gates/arithmetic_base.rs b/plonky2/src/gates/arithmetic_base.rs index 13b4a2c5..aa9f2d86 100644 --- a/plonky2/src/gates/arithmetic_base.rs +++ b/plonky2/src/gates/arithmetic_base.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::format; use alloc::string::String; use alloc::vec::Vec; @@ -10,7 +9,7 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; @@ -19,6 +18,7 @@ use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, EvaluationVarsBasePacked, }; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate which can perform a weighted multiply-add, i.e. `result = c0 x y + c1 z`. If the config /// supports enough routed wires, it can support several such operations in one gate. @@ -60,6 +60,15 @@ impl, const D: usize> Gate for ArithmeticGate format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_ops) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_ops = src.read_usize()?; + Ok(Self { num_ops }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let const_0 = vars.local_constants[0]; let const_1 = vars.local_constants[1]; @@ -117,10 +126,10 @@ impl, const D: usize> Gate for ArithmeticGate constraints } - fn generators(&self, row: usize, local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, local_constants: &[F]) -> Vec> { (0..self.num_ops) .map(|i| { - let g: Box> = Box::new( + WitnessGeneratorRef::new( ArithmeticBaseGenerator { row, const_0: local_constants[0], @@ -128,8 +137,7 @@ impl, const D: usize> Gate for ArithmeticGate i, } .adapter(), - ); - g + ) }) .collect() } @@ -172,8 +180,8 @@ impl, const D: usize> PackedEvaluableBase for } } -#[derive(Clone, Debug)] -struct ArithmeticBaseGenerator, const D: usize> { +#[derive(Clone, Debug, Default)] +pub(crate) struct ArithmeticBaseGenerator, const D: usize> { row: usize, const_0: F, const_1: F, @@ -183,6 +191,10 @@ struct ArithmeticBaseGenerator, const D: usize> { impl, const D: usize> SimpleGenerator for ArithmeticBaseGenerator { + fn id(&self) -> String { + "ArithmeticBaseGenerator".to_string() + } + fn dependencies(&self) -> Vec { [ ArithmeticGate::wire_ith_multiplicand_0(self.i), @@ -208,6 +220,26 @@ impl, const D: usize> SimpleGenerator out_buffer.set_target(output_target, computed_output) } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_field(self.const_0)?; + dst.write_field(self.const_1)?; + dst.write_usize(self.i) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let const_0 = src.read_field()?; + let const_1 = src.read_field()?; + let i = src.read_usize()?; + Ok(Self { + row, + const_0, + const_1, + i, + }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/arithmetic_extension.rs b/plonky2/src/gates/arithmetic_extension.rs index 4632dbd4..36274dfd 100644 --- a/plonky2/src/gates/arithmetic_extension.rs +++ b/plonky2/src/gates/arithmetic_extension.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::format; use alloc::string::String; use alloc::vec::Vec; @@ -9,12 +8,13 @@ use crate::gates::gate::Gate; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::circuit_data::CircuitConfig; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate which can perform a weighted multiply-add, i.e. `result = c0 x y + c1 z`. If the config /// supports enough routed wires, it can support several such operations in one gate. @@ -56,6 +56,15 @@ impl, const D: usize> Gate for ArithmeticExte format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_ops) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_ops = src.read_usize()?; + Ok(Self { num_ops }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let const_0 = vars.local_constants[0]; let const_1 = vars.local_constants[1]; @@ -122,10 +131,10 @@ impl, const D: usize> Gate for ArithmeticExte constraints } - fn generators(&self, row: usize, local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, local_constants: &[F]) -> Vec> { (0..self.num_ops) .map(|i| { - let g: Box> = Box::new( + WitnessGeneratorRef::new( ArithmeticExtensionGenerator { row, const_0: local_constants[0], @@ -133,8 +142,7 @@ impl, const D: usize> Gate for ArithmeticExte i, } .adapter(), - ); - g + ) }) .collect() } @@ -156,8 +164,8 @@ impl, const D: usize> Gate for ArithmeticExte } } -#[derive(Clone, Debug)] -struct ArithmeticExtensionGenerator, const D: usize> { +#[derive(Clone, Debug, Default)] +pub(crate) struct ArithmeticExtensionGenerator, const D: usize> { row: usize, const_0: F, const_1: F, @@ -167,6 +175,10 @@ struct ArithmeticExtensionGenerator, const D: usize impl, const D: usize> SimpleGenerator for ArithmeticExtensionGenerator { + fn id(&self) -> String { + "ArithmeticExtensionGenerator".to_string() + } + fn dependencies(&self) -> Vec { ArithmeticExtensionGate::::wires_ith_multiplicand_0(self.i) .chain(ArithmeticExtensionGate::::wires_ith_multiplicand_1( @@ -201,6 +213,26 @@ impl, const D: usize> SimpleGenerator out_buffer.set_extension_target(output_target, computed_output) } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_field(self.const_0)?; + dst.write_field(self.const_1)?; + dst.write_usize(self.i) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let const_0 = src.read_field()?; + let const_1 = src.read_field()?; + let i = src.read_usize()?; + Ok(Self { + row, + const_0, + const_1, + i, + }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/base_sum.rs b/plonky2/src/gates/base_sum.rs index 5883d71c..fee50c66 100644 --- a/plonky2/src/gates/base_sum.rs +++ b/plonky2/src/gates/base_sum.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -12,7 +11,7 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; @@ -23,6 +22,7 @@ use crate::plonk::vars::{ EvaluationVarsBasePacked, }; use crate::util::log_floor; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate which can decompose a number into base B little-endian limbs. #[derive(Copy, Clone, Debug)] @@ -55,6 +55,15 @@ impl, const D: usize, const B: usize> Gate fo format!("{self:?} + Base: {B}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_limbs) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_limbs = src.read_usize()?; + Ok(Self { num_limbs }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let sum = vars.local_wires[Self::WIRE_SUM]; let limbs = vars.local_wires[self.limbs()].to_vec(); @@ -109,12 +118,12 @@ impl, const D: usize, const B: usize> Gate fo constraints } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { let gen = BaseSplitGenerator:: { row, num_limbs: self.num_limbs, }; - vec![Box::new(gen.adapter())] + vec![WitnessGeneratorRef::new(gen.adapter())] } // 1 for the sum then `num_limbs` for the limbs. @@ -160,13 +169,17 @@ impl, const D: usize, const B: usize> PackedEvaluab } } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct BaseSplitGenerator { row: usize, num_limbs: usize, } impl SimpleGenerator for BaseSplitGenerator { + fn id(&self) -> String { + "BaseSplitGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![Target::wire(self.row, BaseSumGate::::WIRE_SUM)] } @@ -195,6 +208,17 @@ impl SimpleGenerator for BaseSplitGenerator out_buffer.set_target(b, b_value); } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_usize(self.num_limbs) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let num_limbs = src.read_usize()?; + Ok(Self { row, num_limbs }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/constant.rs b/plonky2/src/gates/constant.rs index bf365b04..f794c904 100644 --- a/plonky2/src/gates/constant.rs +++ b/plonky2/src/gates/constant.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -10,12 +9,13 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::WitnessGenerator; +use crate::iop::generator::WitnessGeneratorRef; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, EvaluationVarsBasePacked, }; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate which takes a single constant parameter and outputs that value. #[derive(Copy, Clone, Debug)] @@ -40,6 +40,15 @@ impl, const D: usize> Gate for ConstantGate { format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_consts) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_consts = src.read_usize()?; + Ok(Self { num_consts }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { (0..self.num_consts) .map(|i| { @@ -75,7 +84,7 @@ impl, const D: usize> Gate for ConstantGate { .collect() } - fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec> { vec![] } diff --git a/plonky2/src/gates/coset_interpolation.rs b/plonky2/src/gates/coset_interpolation.rs index da94d1c0..6ec0eae5 100644 --- a/plonky2/src/gates/coset_interpolation.rs +++ b/plonky2/src/gates/coset_interpolation.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -13,12 +12,13 @@ use crate::gates::gate::Gate; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::{ExtensionAlgebraTarget, ExtensionTarget}; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::wire::Wire; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// One of the instantiations of `InterpolationGate`: allows constraints of variable /// degree, up to `1<, const D: usize> { pub subgroup_bits: usize, pub degree: usize, @@ -168,6 +168,26 @@ impl, const D: usize> Gate for CosetInterpola format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.subgroup_bits)?; + dst.write_usize(self.degree)?; + dst.write_usize(self.barycentric_weights.len())?; + dst.write_field_vec(&self.barycentric_weights) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let subgroup_bits = src.read_usize()?; + let degree = src.read_usize()?; + let length = src.read_usize()?; + let barycentric_weights: Vec = src.read_field_vec(length)?; + Ok(Self { + subgroup_bits, + degree, + barycentric_weights, + _phantom: PhantomData, + }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let mut constraints = Vec::with_capacity(self.num_constraints()); @@ -342,9 +362,9 @@ impl, const D: usize> Gate for CosetInterpola constraints } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { let gen = InterpolationGenerator::::new(row, self.clone()); - vec![Box::new(gen.adapter())] + vec![WitnessGeneratorRef::new(gen.adapter())] } fn num_wires(&self) -> usize { @@ -366,8 +386,8 @@ impl, const D: usize> Gate for CosetInterpola } } -#[derive(Debug)] -struct InterpolationGenerator, const D: usize> { +#[derive(Debug, Default)] +pub(crate) struct InterpolationGenerator, const D: usize> { row: usize, gate: CosetInterpolationGate, interpolation_domain: Vec, @@ -389,6 +409,10 @@ impl, const D: usize> InterpolationGenerator impl, const D: usize> SimpleGenerator for InterpolationGenerator { + fn id(&self) -> String { + "InterpolationGenerator".to_string() + } + fn dependencies(&self) -> Vec { let local_target = |column| { Target::Wire(Wire { @@ -471,6 +495,17 @@ impl, const D: usize> SimpleGenerator let evaluation_value_wires = self.gate.wires_evaluation_value().map(local_wire); out_buffer.set_ext_wires(evaluation_value_wires, computed_eval); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + self.gate.serialize(dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let gate = CosetInterpolationGate::deserialize(src)?; + Ok(Self::new(row, gate)) + } } /// Interpolate the polynomial defined by its values on an arbitrary domain at the given point `x`. diff --git a/plonky2/src/gates/exponentiation.rs b/plonky2/src/gates/exponentiation.rs index 218f77e8..64c685dc 100644 --- a/plonky2/src/gates/exponentiation.rs +++ b/plonky2/src/gates/exponentiation.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -13,7 +12,7 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::wire::Wire; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; @@ -23,9 +22,10 @@ use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, EvaluationVarsBasePacked, }; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate for raising a value to a power. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct ExponentiationGate, const D: usize> { pub num_power_bits: usize, pub _phantom: PhantomData, @@ -76,6 +76,15 @@ impl, const D: usize> Gate for Exponentiation format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_power_bits) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_power_bits = src.read_usize()?; + Ok(Self::new(num_power_bits)) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let base = vars.local_wires[self.wire_base()]; @@ -164,12 +173,12 @@ impl, const D: usize> Gate for Exponentiation constraints } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { let gen = ExponentiationGenerator:: { row, gate: self.clone(), }; - vec![Box::new(gen.adapter())] + vec![WitnessGeneratorRef::new(gen.adapter())] } fn num_wires(&self) -> usize { @@ -228,8 +237,8 @@ impl, const D: usize> PackedEvaluableBase } } -#[derive(Debug)] -struct ExponentiationGenerator, const D: usize> { +#[derive(Debug, Default)] +pub(crate) struct ExponentiationGenerator, const D: usize> { row: usize, gate: ExponentiationGate, } @@ -237,6 +246,10 @@ struct ExponentiationGenerator, const D: usize> { impl, const D: usize> SimpleGenerator for ExponentiationGenerator { + fn id(&self) -> String { + "ExponentiationGenerator".to_string() + } + fn dependencies(&self) -> Vec { let local_target = |column| Target::wire(self.row, column); @@ -281,6 +294,17 @@ impl, const D: usize> SimpleGenerator let output_wire = local_wire(self.gate.wire_output()); out_buffer.set_wire(output_wire, intermediate_values[num_power_bits - 1]); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + self.gate.serialize(dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let gate = ExponentiationGate::deserialize(src)?; + Ok(Self { row, gate }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/gate.rs b/plonky2/src/gates/gate.rs index 34950b76..9821106c 100644 --- a/plonky2/src/gates/gate.rs +++ b/plonky2/src/gates/gate.rs @@ -1,8 +1,8 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::sync::Arc; use alloc::vec; use alloc::vec::Vec; +use core::any::Any; use core::fmt::{Debug, Error, Formatter}; use core::hash::{Hash, Hasher}; use core::ops::Range; @@ -16,16 +16,23 @@ use crate::gates::selectors::UNUSED_SELECTOR; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::WitnessGenerator; +use crate::iop::generator::WitnessGeneratorRef; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, }; +use crate::util::serialization::{Buffer, IoResult}; /// A custom gate. pub trait Gate, const D: usize>: 'static + Send + Sync { fn id(&self) -> String; + fn serialize(&self, dst: &mut Vec) -> IoResult<()>; + + fn deserialize(src: &mut Buffer) -> IoResult + where + Self: Sized; + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec; /// Like `eval_unfiltered`, but specialized for points in the base field. @@ -162,7 +169,7 @@ pub trait Gate, const D: usize>: 'static + Send + S /// The generators used to populate the witness. /// Note: This should return exactly 1 generator per operation in the gate. - fn generators(&self, row: usize, local_constants: &[F]) -> Vec>>; + fn generators(&self, row: usize, local_constants: &[F]) -> Vec>; /// The number of wires used by this gate. fn num_wires(&self) -> usize; @@ -191,9 +198,19 @@ pub trait Gate, const D: usize>: 'static + Send + S } } +pub trait AnyGate, const D: usize>: Gate { + fn as_any(&self) -> &dyn Any; +} + +impl, F: RichField + Extendable, const D: usize> AnyGate for T { + fn as_any(&self) -> &dyn Any { + self + } +} + /// A wrapper around an `Rc` which implements `PartialEq`, `Eq` and `Hash` based on gate IDs. #[derive(Clone)] -pub struct GateRef, const D: usize>(pub(crate) Arc>); +pub struct GateRef, const D: usize>(pub(crate) Arc>); impl, const D: usize> GateRef { pub fn new>(gate: G) -> GateRef { diff --git a/plonky2/src/gates/multiplication_extension.rs b/plonky2/src/gates/multiplication_extension.rs index 1f900441..c82c30a1 100644 --- a/plonky2/src/gates/multiplication_extension.rs +++ b/plonky2/src/gates/multiplication_extension.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::format; use alloc::string::String; use alloc::vec::Vec; @@ -9,12 +8,13 @@ use crate::gates::gate::Gate; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::circuit_data::CircuitConfig; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate which can perform a weighted multiplication, i.e. `result = c0 x y`. If the config /// supports enough routed wires, it can support several such operations in one gate. @@ -53,6 +53,15 @@ impl, const D: usize> Gate for MulExtensionGa format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_ops) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let num_ops = src.read_usize()?; + Ok(Self { num_ops }) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let const_0 = vars.local_constants[0]; @@ -110,18 +119,17 @@ impl, const D: usize> Gate for MulExtensionGa constraints } - fn generators(&self, row: usize, local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, local_constants: &[F]) -> Vec> { (0..self.num_ops) .map(|i| { - let g: Box> = Box::new( + WitnessGeneratorRef::new( MulExtensionGenerator { row, const_0: local_constants[0], i, } .adapter(), - ); - g + ) }) .collect() } @@ -143,8 +151,8 @@ impl, const D: usize> Gate for MulExtensionGa } } -#[derive(Clone, Debug)] -struct MulExtensionGenerator, const D: usize> { +#[derive(Clone, Debug, Default)] +pub(crate) struct MulExtensionGenerator, const D: usize> { row: usize, const_0: F, i: usize, @@ -153,6 +161,10 @@ struct MulExtensionGenerator, const D: usize> { impl, const D: usize> SimpleGenerator for MulExtensionGenerator { + fn id(&self) -> String { + "MulExtensionGenerator".to_string() + } + fn dependencies(&self) -> Vec { MulExtensionGate::::wires_ith_multiplicand_0(self.i) .chain(MulExtensionGate::::wires_ith_multiplicand_1(self.i)) @@ -178,6 +190,19 @@ impl, const D: usize> SimpleGenerator out_buffer.set_extension_target(output_target, computed_output) } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_field(self.const_0)?; + dst.write_usize(self.i) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let const_0 = src.read_field()?; + let i = src.read_usize()?; + Ok(Self { row, const_0, i }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/noop.rs b/plonky2/src/gates/noop.rs index f6f9853a..cfcfb912 100644 --- a/plonky2/src/gates/noop.rs +++ b/plonky2/src/gates/noop.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; @@ -6,9 +5,10 @@ use crate::field::extension::Extendable; use crate::gates::gate::Gate; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::WitnessGenerator; +use crate::iop::generator::WitnessGeneratorRef; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBaseBatch}; +use crate::util::serialization::{Buffer, IoResult}; /// A gate which does nothing. pub struct NoopGate; @@ -18,6 +18,14 @@ impl, const D: usize> Gate for NoopGate { "NoopGate".into() } + fn serialize(&self, _dst: &mut Vec) -> IoResult<()> { + Ok(()) + } + + fn deserialize(_src: &mut Buffer) -> IoResult { + Ok(Self) + } + fn eval_unfiltered(&self, _vars: EvaluationVars) -> Vec { Vec::new() } @@ -34,7 +42,7 @@ impl, const D: usize> Gate for NoopGate { Vec::new() } - fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec> { Vec::new() } diff --git a/plonky2/src/gates/poseidon.rs b/plonky2/src/gates/poseidon.rs index 80184797..af82a608 100644 --- a/plonky2/src/gates/poseidon.rs +++ b/plonky2/src/gates/poseidon.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -13,12 +12,13 @@ use crate::hash::hash_types::RichField; use crate::hash::poseidon; use crate::hash::poseidon::{Poseidon, SPONGE_WIDTH}; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::wire::Wire; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Evaluates a full Poseidon permutation with 12 state elements. /// @@ -99,6 +99,14 @@ impl, const D: usize> Gate for PoseidonGate") } + fn serialize(&self, _dst: &mut Vec) -> IoResult<()> { + Ok(()) + } + + fn deserialize(_src: &mut Buffer) -> IoResult { + Ok(PoseidonGate::new()) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let mut constraints = Vec::with_capacity(self.num_constraints()); @@ -372,12 +380,12 @@ impl, const D: usize> Gate for PoseidonGate Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { let gen = PoseidonGenerator:: { row, _phantom: PhantomData, }; - vec![Box::new(gen.adapter())] + vec![WitnessGeneratorRef::new(gen.adapter())] } fn num_wires(&self) -> usize { @@ -401,8 +409,8 @@ impl, const D: usize> Gate for PoseidonGate + Poseidon, const D: usize> { +#[derive(Debug, Default)] +pub(crate) struct PoseidonGenerator + Poseidon, const D: usize> { row: usize, _phantom: PhantomData, } @@ -410,6 +418,10 @@ struct PoseidonGenerator + Poseidon, const D: usize impl + Poseidon, const D: usize> SimpleGenerator for PoseidonGenerator { + fn id(&self) -> String { + "PoseidonGenerator".to_string() + } + fn dependencies(&self) -> Vec { (0..SPONGE_WIDTH) .map(|i| PoseidonGate::::wire_input(i)) @@ -499,6 +511,18 @@ impl + Poseidon, const D: usize> SimpleGenerator out_buffer.set_wire(local_wire(PoseidonGate::::wire_output(i)), state[i]); } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + Ok(Self { + row, + _phantom: PhantomData, + }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/poseidon_mds.rs b/plonky2/src/gates/poseidon_mds.rs index cddd0f9e..409d0325 100644 --- a/plonky2/src/gates/poseidon_mds.rs +++ b/plonky2/src/gates/poseidon_mds.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -13,11 +12,12 @@ use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::hash::poseidon::{Poseidon, SPONGE_WIDTH}; use crate::iop::ext_target::{ExtensionAlgebraTarget, ExtensionTarget}; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Poseidon MDS Gate #[derive(Debug, Default)] @@ -118,6 +118,14 @@ impl + Poseidon, const D: usize> Gate for Pos format!("{self:?}") } + fn serialize(&self, _dst: &mut Vec) -> IoResult<()> { + Ok(()) + } + + fn deserialize(_src: &mut Buffer) -> IoResult { + Ok(PoseidonMdsGate::new()) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let inputs: [_; SPONGE_WIDTH] = (0..SPONGE_WIDTH) .map(|i| vars.get_local_ext_algebra(Self::wires_input(i))) @@ -179,9 +187,9 @@ impl + Poseidon, const D: usize> Gate for Pos .collect() } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { let gen = PoseidonMdsGenerator:: { row }; - vec![Box::new(gen.adapter())] + vec![WitnessGeneratorRef::new(gen.adapter())] } fn num_wires(&self) -> usize { @@ -201,14 +209,18 @@ impl + Poseidon, const D: usize> Gate for Pos } } -#[derive(Clone, Debug)] -struct PoseidonMdsGenerator { +#[derive(Clone, Debug, Default)] +pub(crate) struct PoseidonMdsGenerator { row: usize, } impl + Poseidon, const D: usize> SimpleGenerator for PoseidonMdsGenerator { + fn id(&self) -> String { + "PoseidonMdsGenerator".to_string() + } + fn dependencies(&self) -> Vec { (0..SPONGE_WIDTH) .flat_map(|i| { @@ -237,6 +249,15 @@ impl + Poseidon, const D: usize> SimpleGenerator ); } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + Ok(Self { row }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/public_input.rs b/plonky2/src/gates/public_input.rs index 10c42f00..2c3e2428 100644 --- a/plonky2/src/gates/public_input.rs +++ b/plonky2/src/gates/public_input.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use core::ops::Range; @@ -10,12 +9,13 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::WitnessGenerator; +use crate::iop::generator::WitnessGeneratorRef; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, EvaluationVarsBasePacked, }; +use crate::util::serialization::{Buffer, IoResult}; /// A gate whose first four wires will be equal to a hash of public inputs. pub struct PublicInputGate; @@ -31,6 +31,14 @@ impl, const D: usize> Gate for PublicInputGat "PublicInputGate".into() } + fn serialize(&self, _dst: &mut Vec) -> IoResult<()> { + Ok(()) + } + + fn deserialize(_src: &mut Buffer) -> IoResult { + Ok(Self) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { Self::wires_public_inputs_hash() .zip(vars.public_inputs_hash.elements) @@ -64,7 +72,7 @@ impl, const D: usize> Gate for PublicInputGat .collect() } - fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, _row: usize, _local_constants: &[F]) -> Vec> { Vec::new() } diff --git a/plonky2/src/gates/random_access.rs b/plonky2/src/gates/random_access.rs index 80874505..6d520786 100644 --- a/plonky2/src/gates/random_access.rs +++ b/plonky2/src/gates/random_access.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -14,7 +13,7 @@ use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::wire::Wire; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; @@ -24,9 +23,10 @@ use crate::plonk::vars::{ EvaluationTargets, EvaluationVars, EvaluationVarsBase, EvaluationVarsBaseBatch, EvaluationVarsBasePacked, }; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// A gate for checking that a particular element of a list matches a given value. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Default)] pub struct RandomAccessGate, const D: usize> { /// Number of bits in the index (log2 of the list size). pub bits: usize, @@ -122,6 +122,20 @@ impl, const D: usize> Gate for RandomAccessGa format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.bits)?; + dst.write_usize(self.num_copies)?; + dst.write_usize(self.num_extra_constants)?; + Ok(()) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let bits = src.read_usize()?; + let num_copies = src.read_usize()?; + let num_extra_constants = src.read_usize()?; + Ok(Self::new(num_copies, bits, num_extra_constants)) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let mut constraints = Vec::with_capacity(self.num_constraints()); @@ -238,18 +252,17 @@ impl, const D: usize> Gate for RandomAccessGa constraints } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { (0..self.num_copies) .map(|copy| { - let g: Box> = Box::new( + WitnessGeneratorRef::new( RandomAccessGenerator { row, gate: *self, copy, } .adapter(), - ); - g + ) }) .collect() } @@ -325,8 +338,8 @@ impl, const D: usize> PackedEvaluableBase } } -#[derive(Debug)] -struct RandomAccessGenerator, const D: usize> { +#[derive(Debug, Default)] +pub(crate) struct RandomAccessGenerator, const D: usize> { row: usize, gate: RandomAccessGate, copy: usize, @@ -335,6 +348,10 @@ struct RandomAccessGenerator, const D: usize> { impl, const D: usize> SimpleGenerator for RandomAccessGenerator { + fn id(&self) -> String { + "RandomAccessGenerator".to_string() + } + fn dependencies(&self) -> Vec { let local_target = |column| Target::wire(self.row, column); @@ -376,6 +393,19 @@ impl, const D: usize> SimpleGenerator set_local_wire(self.gate.wire_bit(i, copy), bit); } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_usize(self.copy)?; + self.gate.serialize(dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let copy = src.read_usize()?; + let gate = RandomAccessGate::::deserialize(src)?; + Ok(Self { row, gate, copy }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/reducing.rs b/plonky2/src/gates/reducing.rs index 9bdadce8..43549210 100644 --- a/plonky2/src/gates/reducing.rs +++ b/plonky2/src/gates/reducing.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -9,14 +8,15 @@ use crate::gates::gate::Gate; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Computes `sum alpha^i c_i` for a vector `c_i` of `num_coeffs` elements of the base field. -#[derive(Debug, Clone)] +#[derive(Debug, Default, Clone)] pub struct ReducingGate { pub num_coeffs: usize, } @@ -60,6 +60,19 @@ impl, const D: usize> Gate for ReducingGate) -> IoResult<()> { + dst.write_usize(self.num_coeffs)?; + Ok(()) + } + + fn deserialize(src: &mut Buffer) -> IoResult + where + Self: Sized, + { + let num_coeffs = src.read_usize()?; + Ok(Self::new(num_coeffs)) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let alpha = vars.get_local_ext_algebra(Self::wires_alpha()); let old_acc = vars.get_local_ext_algebra(Self::wires_old_acc()); @@ -137,8 +150,8 @@ impl, const D: usize> Gate for ReducingGate Vec>> { - vec![Box::new( + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { + vec![WitnessGeneratorRef::new( ReducingGenerator { row, gate: self.clone(), @@ -164,13 +177,17 @@ impl, const D: usize> Gate for ReducingGate { +#[derive(Debug, Default)] +pub(crate) struct ReducingGenerator { row: usize, gate: ReducingGate, } impl, const D: usize> SimpleGenerator for ReducingGenerator { + fn id(&self) -> String { + "ReducingGenerator".to_string() + } + fn dependencies(&self) -> Vec { ReducingGate::::wires_alpha() .chain(ReducingGate::::wires_old_acc()) @@ -207,6 +224,17 @@ impl, const D: usize> SimpleGenerator for Reduci } out_buffer.set_extension_target(output, acc); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + as Gate>::serialize(&self.gate, dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let gate = as Gate>::deserialize(src)?; + Ok(Self { row, gate }) + } } #[cfg(test)] diff --git a/plonky2/src/gates/reducing_extension.rs b/plonky2/src/gates/reducing_extension.rs index 0ad48bb0..ce6a9725 100644 --- a/plonky2/src/gates/reducing_extension.rs +++ b/plonky2/src/gates/reducing_extension.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::string::String; use alloc::vec::Vec; use alloc::{format, vec}; @@ -9,14 +8,15 @@ use crate::gates::gate::Gate; use crate::gates::util::StridedConstraintConsumer; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator}; +use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGeneratorRef}; use crate::iop::target::Target; use crate::iop::witness::{PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Computes `sum alpha^i c_i` for a vector `c_i` of `num_coeffs` elements of the extension field. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct ReducingExtensionGate { pub num_coeffs: usize, } @@ -63,6 +63,19 @@ impl, const D: usize> Gate for ReducingExtens format!("{self:?}") } + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.num_coeffs)?; + Ok(()) + } + + fn deserialize(src: &mut Buffer) -> IoResult + where + Self: Sized, + { + let num_coeffs = src.read_usize()?; + Ok(Self::new(num_coeffs)) + } + fn eval_unfiltered(&self, vars: EvaluationVars) -> Vec { let alpha = vars.get_local_ext_algebra(Self::wires_alpha()); let old_acc = vars.get_local_ext_algebra(Self::wires_old_acc()); @@ -137,8 +150,8 @@ impl, const D: usize> Gate for ReducingExtens .collect() } - fn generators(&self, row: usize, _local_constants: &[F]) -> Vec>> { - vec![Box::new( + fn generators(&self, row: usize, _local_constants: &[F]) -> Vec> { + vec![WitnessGeneratorRef::new( ReducingGenerator { row, gate: self.clone(), @@ -164,13 +177,17 @@ impl, const D: usize> Gate for ReducingExtens } } -#[derive(Debug)] -struct ReducingGenerator { +#[derive(Debug, Default)] +pub(crate) struct ReducingGenerator { row: usize, gate: ReducingExtensionGate, } impl, const D: usize> SimpleGenerator for ReducingGenerator { + fn id(&self) -> String { + "ReducingExtensionGenerator".to_string() + } + fn dependencies(&self) -> Vec { ReducingExtensionGate::::wires_alpha() .chain(ReducingExtensionGate::::wires_old_acc()) @@ -201,6 +218,17 @@ impl, const D: usize> SimpleGenerator for Reduci acc = computed_acc; } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + as Gate>::serialize(&self.gate, dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let gate = as Gate>::deserialize(src)?; + Ok(Self { row, gate }) + } } #[cfg(test)] diff --git a/plonky2/src/hash/hash_types.rs b/plonky2/src/hash/hash_types.rs index c725c45c..c16092a8 100644 --- a/plonky2/src/hash/hash_types.rs +++ b/plonky2/src/hash/hash_types.rs @@ -110,7 +110,7 @@ impl Default for HashOut { } /// Represents a ~256 bit hash output. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct HashOutTarget { pub elements: [Target; 4], } @@ -148,7 +148,7 @@ impl TryFrom<&[Target]> for HashOutTarget { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct MerkleCapTarget(pub Vec); /// Hash consisting of a byte array. diff --git a/plonky2/src/hash/merkle_proofs.rs b/plonky2/src/hash/merkle_proofs.rs index 3d523312..240e6cd2 100644 --- a/plonky2/src/hash/merkle_proofs.rs +++ b/plonky2/src/hash/merkle_proofs.rs @@ -31,7 +31,7 @@ impl> MerkleProof { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct MerkleProofTarget { /// The Merkle digest of each sibling subtree, staying from the bottommost layer. pub siblings: Vec, diff --git a/plonky2/src/hash/merkle_tree.rs b/plonky2/src/hash/merkle_tree.rs index f49d9f19..67fe7968 100644 --- a/plonky2/src/hash/merkle_tree.rs +++ b/plonky2/src/hash/merkle_tree.rs @@ -36,7 +36,7 @@ impl> MerkleCap { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct MerkleTree> { /// The data in the leaves of the Merkle tree. pub leaves: Vec>, diff --git a/plonky2/src/iop/ext_target.rs b/plonky2/src/iop/ext_target.rs index 08bdcba0..21eb3e55 100644 --- a/plonky2/src/iop/ext_target.rs +++ b/plonky2/src/iop/ext_target.rs @@ -12,6 +12,12 @@ use crate::plonk::circuit_builder::CircuitBuilder; #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct ExtensionTarget(pub [Target; D]); +impl Default for ExtensionTarget { + fn default() -> Self { + Self([Target::default(); D]) + } +} + impl ExtensionTarget { pub fn to_target_array(&self) -> [Target; D] { self.0 diff --git a/plonky2/src/iop/generator.rs b/plonky2/src/iop/generator.rs index a65d1748..dbe7f475 100644 --- a/plonky2/src/iop/generator.rs +++ b/plonky2/src/iop/generator.rs @@ -1,5 +1,6 @@ use alloc::vec; use alloc::vec::Vec; +use core::any::Any; use core::fmt::Debug; use core::marker::PhantomData; @@ -12,6 +13,7 @@ use crate::iop::wire::Wire; use crate::iop::witness::{PartialWitness, PartitionWitness, Witness, WitnessWrite}; use crate::plonk::circuit_data::{CommonCircuitData, ProverOnlyCircuitData}; use crate::plonk::config::GenericConfig; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Given a `PartitionWitness` that has only inputs set, populates the rest of the witness using the /// given set of generators. @@ -58,7 +60,7 @@ pub(crate) fn generate_partial_witness< continue; } - let finished = generators[generator_idx].run(&witness, &mut buffer); + let finished = generators[generator_idx].0.run(&witness, &mut buffer); if finished { generator_is_expired[generator_idx] = true; remaining_generators -= 1; @@ -98,6 +100,8 @@ pub(crate) fn generate_partial_witness< /// A generator participates in the generation of the witness. pub trait WitnessGenerator: 'static + Send + Sync + Debug { + fn id(&self) -> String; + /// Targets to be "watched" by this generator. Whenever a target in the watch list is populated, /// the generator will be queued to run. fn watch_list(&self) -> Vec; @@ -106,6 +110,52 @@ pub trait WitnessGenerator: 'static + Send + Sync + Debug { /// flag is true, the generator will never be run again, otherwise it will be queued for another /// run next time a target in its watch list is populated. fn run(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues) -> bool; + + fn serialize(&self, dst: &mut Vec) -> IoResult<()>; + + fn deserialize(src: &mut Buffer) -> IoResult + where + Self: Sized; +} + +pub trait AnyWitnessGenerator: WitnessGenerator { + fn as_any(&self) -> &dyn Any; +} + +impl, F: Field> AnyWitnessGenerator for T { + fn as_any(&self) -> &dyn Any { + self + } +} + +/// A wrapper around an `Box`. +pub struct WitnessGeneratorRef(pub(crate) Box>); + +impl WitnessGeneratorRef { + pub fn new>(generator: G) -> WitnessGeneratorRef { + WitnessGeneratorRef(Box::new(generator)) + } +} + +impl PartialEq for WitnessGeneratorRef { + fn eq(&self, other: &Self) -> bool { + let mut buf1 = Vec::new(); + let mut buf2 = Vec::new(); + self.0.serialize(&mut buf1).unwrap(); + other.0.serialize(&mut buf2).unwrap(); + + buf1 == buf2 + } +} + +impl Eq for WitnessGeneratorRef {} + +impl Debug for WitnessGeneratorRef { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut buf = Vec::new(); + self.0.serialize(&mut buf).unwrap(); + write!(f, "{:?}", buf) + } } /// Values generated by a generator invocation. @@ -158,6 +208,8 @@ impl GeneratedValues { /// A generator which runs once after a list of dependencies is present in the witness. pub trait SimpleGenerator: 'static + Send + Sync + Debug { + fn id(&self) -> String; + fn dependencies(&self) -> Vec; fn run_once(&self, witness: &PartitionWitness, out_buffer: &mut GeneratedValues); @@ -171,6 +223,12 @@ pub trait SimpleGenerator: 'static + Send + Sync + Debug { _phantom: PhantomData, } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()>; + + fn deserialize(src: &mut Buffer) -> IoResult + where + Self: Sized; } #[derive(Debug)] @@ -180,6 +238,10 @@ pub struct SimpleGeneratorAdapter + ?Sized> { } impl> WitnessGenerator for SimpleGeneratorAdapter { + fn id(&self) -> String { + self.inner.id() + } + fn watch_list(&self) -> Vec { self.inner.dependencies() } @@ -192,16 +254,31 @@ impl> WitnessGenerator for SimpleGeneratorAd false } } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + self.inner.serialize(dst) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + Ok(Self { + inner: SG::deserialize(src)?, + _phantom: PhantomData, + }) + } } /// A generator which copies one wire to another. -#[derive(Debug)] +#[derive(Debug, Default)] pub(crate) struct CopyGenerator { pub(crate) src: Target, pub(crate) dst: Target, } impl SimpleGenerator for CopyGenerator { + fn id(&self) -> String { + "CopyGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.src] } @@ -210,15 +287,30 @@ impl SimpleGenerator for CopyGenerator { let value = witness.get_target(self.src); out_buffer.set_target(self.dst, value); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.src)?; + dst.write_target(self.dst) + } + + fn deserialize(source: &mut Buffer) -> IoResult { + let src = source.read_target()?; + let dst = source.read_target()?; + Ok(Self { src, dst }) + } } /// A generator for including a random value -#[derive(Debug)] +#[derive(Debug, Default)] pub(crate) struct RandomValueGenerator { pub(crate) target: Target, } impl SimpleGenerator for RandomValueGenerator { + fn id(&self) -> String { + "RandomValueGenerator".to_string() + } + fn dependencies(&self) -> Vec { Vec::new() } @@ -227,16 +319,29 @@ impl SimpleGenerator for RandomValueGenerator { let random_value = F::rand(); out_buffer.set_target(self.target, random_value); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.target) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let target = src.read_target()?; + Ok(Self { target }) + } } /// A generator for testing if a value equals zero -#[derive(Debug)] +#[derive(Debug, Default)] pub(crate) struct NonzeroTestGenerator { pub(crate) to_test: Target, pub(crate) dummy: Target, } impl SimpleGenerator for NonzeroTestGenerator { + fn id(&self) -> String { + "NonzeroTestGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![self.to_test] } @@ -252,10 +357,21 @@ impl SimpleGenerator for NonzeroTestGenerator { out_buffer.set_target(self.dummy, dummy_value); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target(self.to_test)?; + dst.write_target(self.dummy) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let to_test = src.read_target()?; + let dummy = src.read_target()?; + Ok(Self { to_test, dummy }) + } } /// Generator used to fill an extra constant. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub(crate) struct ConstantGenerator { pub row: usize, pub constant_index: usize, @@ -269,7 +385,11 @@ impl ConstantGenerator { } } -impl SimpleGenerator for ConstantGenerator { +impl SimpleGenerator for ConstantGenerator { + fn id(&self) -> String { + "ConstantGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![] } @@ -277,4 +397,24 @@ impl SimpleGenerator for ConstantGenerator { fn run_once(&self, _witness: &PartitionWitness, out_buffer: &mut GeneratedValues) { out_buffer.set_target(Target::wire(self.row, self.wire_index), self.constant); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_usize(self.row)?; + dst.write_usize(self.constant_index)?; + dst.write_usize(self.wire_index)?; + dst.write_field(self.constant) + } + + fn deserialize(src: &mut Buffer) -> IoResult { + let row = src.read_usize()?; + let constant_index = src.read_usize()?; + let wire_index = src.read_usize()?; + let constant = src.read_field()?; + Ok(Self { + row, + constant_index, + wire_index, + constant, + }) + } } diff --git a/plonky2/src/iop/target.rs b/plonky2/src/iop/target.rs index 15be6943..9f1ab96b 100644 --- a/plonky2/src/iop/target.rs +++ b/plonky2/src/iop/target.rs @@ -17,6 +17,12 @@ pub enum Target { }, } +impl Default for Target { + fn default() -> Self { + Self::VirtualTarget { index: 0 } + } +} + impl Target { pub fn wire(row: usize, column: usize) -> Self { Self::Wire(Wire { row, column }) @@ -49,7 +55,7 @@ impl Target { } /// A `Target` which has already been constrained such that it can only be 0 or 1. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] #[allow(clippy::manual_non_exhaustive)] pub struct BoolTarget { pub target: Target, diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index 15c01ab0..851e23a8 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::collections::BTreeMap; use alloc::vec; use alloc::vec::Vec; @@ -33,7 +32,7 @@ use crate::hash::merkle_proofs::MerkleProofTarget; use crate::hash::merkle_tree::MerkleCap; use crate::iop::ext_target::ExtensionTarget; use crate::iop::generator::{ - ConstantGenerator, CopyGenerator, RandomValueGenerator, SimpleGenerator, WitnessGenerator, + ConstantGenerator, CopyGenerator, RandomValueGenerator, SimpleGenerator, WitnessGeneratorRef, }; use crate::iop::target::{BoolTarget, Target}; use crate::iop::wire::Wire; @@ -77,7 +76,7 @@ pub struct CircuitBuilder, const D: usize> { context_log: ContextTree, /// Generators used to generate the witness. - generators: Vec>>, + generators: Vec>, constants_to_targets: HashMap, targets_to_constants: HashMap, @@ -367,12 +366,13 @@ impl, const D: usize> CircuitBuilder { self.connect(x, one); } - pub fn add_generators(&mut self, generators: Vec>>) { + pub fn add_generators(&mut self, generators: Vec>) { self.generators.extend(generators); } pub fn add_simple_generator>(&mut self, generator: G) { - self.generators.push(Box::new(generator.adapter())); + self.generators + .push(WitnessGeneratorRef::new(generator.adapter())); } /// Returns a routable target with a value of 0. @@ -865,7 +865,7 @@ impl, const D: usize> CircuitBuilder { // Index generator indices by their watched targets. let mut generator_indices_by_watches = BTreeMap::new(); for (i, generator) in self.generators.iter().enumerate() { - for watch in generator.watch_list() { + for watch in generator.0.watch_list() { let watch_index = forest.target_index(watch); let watch_rep_index = forest.parents[watch_index]; generator_indices_by_watches diff --git a/plonky2/src/plonk/circuit_data.rs b/plonky2/src/plonk/circuit_data.rs index 2346b9db..7bbf8971 100644 --- a/plonky2/src/plonk/circuit_data.rs +++ b/plonky2/src/plonk/circuit_data.rs @@ -1,4 +1,3 @@ -use alloc::boxed::Box; use alloc::collections::BTreeMap; use alloc::vec; use alloc::vec::Vec; @@ -22,7 +21,7 @@ use crate::hash::hash_types::{HashOutTarget, MerkleCapTarget, RichField}; use crate::hash::hashing::HashConfig; use crate::hash::merkle_tree::MerkleCap; use crate::iop::ext_target::ExtensionTarget; -use crate::iop::generator::WitnessGenerator; +use crate::iop::generator::WitnessGeneratorRef; use crate::iop::target::Target; use crate::iop::witness::PartialWitness; use crate::plonk::circuit_builder::CircuitBuilder; @@ -31,6 +30,9 @@ use crate::plonk::plonk_common::PlonkOracle; use crate::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs}; use crate::plonk::prover::prove; use crate::plonk::verifier::verify; +use crate::util::gate_serialization::GateSerializer; +use crate::util::generator_serialization::WitnessGeneratorSerializer; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; use crate::util::timing::TimingTree; #[derive(Clone, Debug, Eq, PartialEq)] @@ -107,6 +109,7 @@ impl CircuitConfig { } /// Circuit data required by the prover or the verifier. +#[derive(Eq, PartialEq, Debug)] pub struct CircuitData, C: GenericConfig, const D: usize> { pub prover_only: ProverOnlyCircuitData, pub verifier_only: VerifierOnlyCircuitData, @@ -116,6 +119,25 @@ pub struct CircuitData, C: GenericConfig, impl, C: GenericConfig, const D: usize> CircuitData { + pub fn to_bytes( + &self, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_circuit_data(self, gate_serializer, generator_serializer)?; + Ok(buffer) + } + + pub fn from_bytes( + bytes: &[u8], + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let mut buffer = Buffer::new(bytes.to_vec()); + buffer.read_circuit_data(gate_serializer, generator_serializer) + } + pub fn prove(&self, inputs: PartialWitness) -> Result> where [(); C::HCO::WIDTH]:, @@ -214,6 +236,25 @@ pub struct ProverCircuitData< impl, C: GenericConfig, const D: usize> ProverCircuitData { + pub fn to_bytes( + &self, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_prover_circuit_data(self, gate_serializer, generator_serializer)?; + Ok(buffer) + } + + pub fn from_bytes( + bytes: &[u8], + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult { + let mut buffer = Buffer::new(bytes.to_vec()); + buffer.read_prover_circuit_data(gate_serializer, generator_serializer) + } + pub fn prove(&self, inputs: PartialWitness) -> Result> where [(); C::HCO::WIDTH]:, @@ -242,6 +283,20 @@ pub struct VerifierCircuitData< impl, C: GenericConfig, const D: usize> VerifierCircuitData { + pub fn to_bytes(&self, gate_serializer: &dyn GateSerializer) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_verifier_circuit_data(self, gate_serializer)?; + Ok(buffer) + } + + pub fn from_bytes( + bytes: Vec, + gate_serializer: &dyn GateSerializer, + ) -> IoResult { + let mut buffer = Buffer::new(bytes); + buffer.read_verifier_circuit_data(gate_serializer) + } + pub fn verify(&self, proof_with_pis: ProofWithPublicInputs) -> Result<()> where [(); C::HCO::WIDTH]:, @@ -263,12 +318,13 @@ impl, C: GenericConfig, const D: usize> } /// Circuit data required by the prover, but not the verifier. +#[derive(Eq, PartialEq, Debug)] pub struct ProverOnlyCircuitData< F: RichField + Extendable, C: GenericConfig, const D: usize, > { - pub generators: Vec>>, + pub generators: Vec>, /// Generator indices (within the `Vec` above), indexed by the representative of each target /// they watch. pub generator_indices_by_watches: BTreeMap>, @@ -300,6 +356,19 @@ pub struct VerifierOnlyCircuitData, const D: usize> { pub circuit_digest: <>::Hasher as Hasher>::Hash, } +impl, const D: usize> VerifierOnlyCircuitData { + pub fn to_bytes(&self) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_verifier_only_circuit_data(self)?; + Ok(buffer) + } + + pub fn from_bytes(bytes: Vec) -> IoResult { + let mut buffer = Buffer::new(bytes); + buffer.read_verifier_only_circuit_data() + } +} + /// Circuit data required by both the prover and the verifier. #[derive(Debug, Clone, Eq, PartialEq)] pub struct CommonCircuitData, const D: usize> { @@ -332,6 +401,20 @@ pub struct CommonCircuitData, const D: usize> { } impl, const D: usize> CommonCircuitData { + pub fn to_bytes(&self, gate_serializer: &dyn GateSerializer) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_common_circuit_data(self, gate_serializer)?; + Ok(buffer) + } + + pub fn from_bytes( + bytes: Vec, + gate_serializer: &dyn GateSerializer, + ) -> IoResult { + let mut buffer = Buffer::new(bytes); + buffer.read_common_circuit_data(gate_serializer) + } + pub const fn degree_bits(&self) -> usize { self.fri_params.degree_bits } @@ -503,7 +586,7 @@ impl, const D: usize> CommonCircuitData { /// is intentionally missing certain fields, such as `CircuitConfig`, because we support only a /// limited form of dynamic inner circuits. We can't practically make things like the wire count /// dynamic, at least not without setting a maximum wire count and paying for the worst case. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct VerifierCircuitTarget { /// A commitment to each constant polynomial and each permutation polynomial. pub constants_sigmas_cap: MerkleCapTarget, diff --git a/plonky2/src/plonk/proof.rs b/plonky2/src/plonk/proof.rs index 6332252f..90a7ea86 100644 --- a/plonky2/src/plonk/proof.rs +++ b/plonky2/src/plonk/proof.rs @@ -41,7 +41,7 @@ pub struct Proof, C: GenericConfig, const pub opening_proof: FriProof, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ProofTarget { pub wires_cap: MerkleCapTarget, pub plonk_zs_partial_products_cap: MerkleCapTarget, @@ -305,13 +305,13 @@ pub(crate) struct FriInferredElements, const D: usi pub Vec, ); -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ProofWithPublicInputsTarget { pub proof: ProofTarget, pub public_inputs: Vec, } -#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)] /// The purported values of each polynomial at a single point. pub struct OpeningSet, const D: usize> { pub constants: Vec, @@ -377,7 +377,7 @@ impl, const D: usize> OpeningSet { } /// The purported values of each polynomial at a single point. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct OpeningSetTarget { pub constants: Vec>, pub plonk_sigmas: Vec>, diff --git a/plonky2/src/recursion/cyclic_recursion.rs b/plonky2/src/recursion/cyclic_recursion.rs index c973ba60..7b584e4d 100644 --- a/plonky2/src/recursion/cyclic_recursion.rs +++ b/plonky2/src/recursion/cyclic_recursion.rs @@ -13,6 +13,7 @@ use crate::plonk::circuit_data::{ }; use crate::plonk::config::{AlgebraicHasher, GenericConfig}; use crate::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; impl, const D: usize> VerifierOnlyCircuitData { fn from_slice(slice: &[C::F], common_data: &CommonCircuitData) -> Result @@ -41,6 +42,23 @@ impl, const D: usize> VerifierOnlyCircuitData { } impl VerifierCircuitTarget { + pub fn to_bytes(&self) -> IoResult> { + let mut buffer = Vec::new(); + buffer.write_target_merkle_cap(&self.constants_sigmas_cap)?; + buffer.write_target_hash(&self.circuit_digest)?; + Ok(buffer) + } + + pub fn from_bytes(bytes: Vec) -> IoResult { + let mut buffer = Buffer::new(bytes); + let constants_sigmas_cap = buffer.read_target_merkle_cap()?; + let circuit_digest = buffer.read_target_hash()?; + Ok(Self { + constants_sigmas_cap, + circuit_digest, + }) + } + fn from_slice, const D: usize>( slice: &[Target], common_data: &CommonCircuitData, diff --git a/plonky2/src/recursion/dummy_circuit.rs b/plonky2/src/recursion/dummy_circuit.rs index b0536b9c..b052cdd5 100644 --- a/plonky2/src/recursion/dummy_circuit.rs +++ b/plonky2/src/recursion/dummy_circuit.rs @@ -3,11 +3,15 @@ use alloc::vec::Vec; use hashbrown::HashMap; use plonky2_field::extension::Extendable; +use plonky2_field::polynomial::PolynomialCoeffs; use plonky2_util::ceil_div_usize; +use crate::fri::proof::{FriProof, FriProofTarget}; +use crate::gadgets::polynomial::PolynomialCoeffsExtTarget; use crate::gates::noop::NoopGate; -use crate::hash::hash_types::RichField; +use crate::hash::hash_types::{HashOutTarget, MerkleCapTarget, RichField}; use crate::hash::hashing::HashConfig; +use crate::hash::merkle_tree::MerkleCap; use crate::iop::generator::{GeneratedValues, SimpleGenerator}; use crate::iop::target::Target; use crate::iop::witness::{PartialWitness, PartitionWitness, WitnessWrite}; @@ -15,8 +19,12 @@ use crate::plonk::circuit_builder::CircuitBuilder; use crate::plonk::circuit_data::{ CircuitData, CommonCircuitData, VerifierCircuitTarget, VerifierOnlyCircuitData, }; -use crate::plonk::config::{AlgebraicHasher, GenericConfig}; -use crate::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; +use crate::plonk::config::{AlgebraicHasher, GenericConfig, GenericHashOut, Hasher}; +use crate::plonk::proof::{ + OpeningSet, OpeningSetTarget, Proof, ProofTarget, ProofWithPublicInputs, + ProofWithPublicInputsTarget, +}; +use crate::util::serialization::{Buffer, IoResult, Read, Write}; /// Creates a dummy proof which is suitable for use as a base proof in a cyclic recursion tree. /// Such a base proof will not actually be verified, so most of its data is arbitrary. However, its @@ -157,12 +165,101 @@ where pub(crate) verifier_data: VerifierOnlyCircuitData, } +impl Default for DummyProofGenerator +where + F: RichField + Extendable, + C: GenericConfig, +{ + fn default() -> Self { + let proof_with_pis_target = ProofWithPublicInputsTarget { + proof: ProofTarget { + wires_cap: MerkleCapTarget(vec![]), + plonk_zs_partial_products_cap: MerkleCapTarget(vec![]), + quotient_polys_cap: MerkleCapTarget(vec![]), + openings: OpeningSetTarget::default(), + opening_proof: FriProofTarget { + commit_phase_merkle_caps: vec![], + query_round_proofs: vec![], + final_poly: PolynomialCoeffsExtTarget(vec![]), + pow_witness: Target::default(), + }, + }, + public_inputs: vec![], + }; + + let proof_with_pis = ProofWithPublicInputs { + proof: Proof { + wires_cap: MerkleCap(vec![]), + plonk_zs_partial_products_cap: MerkleCap(vec![]), + quotient_polys_cap: MerkleCap(vec![]), + openings: OpeningSet::default(), + opening_proof: FriProof { + commit_phase_merkle_caps: vec![], + query_round_proofs: vec![], + final_poly: PolynomialCoeffs { coeffs: vec![] }, + pow_witness: F::ZERO, + }, + }, + public_inputs: vec![], + }; + + let verifier_data_target = VerifierCircuitTarget { + constants_sigmas_cap: MerkleCapTarget(vec![]), + circuit_digest: HashOutTarget { + elements: [Target::default(); 4], + }, + }; + + let verifier_data = VerifierOnlyCircuitData { + constants_sigmas_cap: MerkleCap(vec![]), + circuit_digest: + <>::Hasher as Hasher>::Hash::from_bytes( + &vec![0; <>::Hasher as Hasher>::HASH_SIZE], + ), + }; + + Self { + proof_with_pis_target, + proof_with_pis, + verifier_data_target, + verifier_data, + } + } +} + +impl DummyProofGenerator +where + F: RichField + Extendable, + C: GenericConfig + 'static, + C::Hasher: AlgebraicHasher, +{ + pub fn deserialize_with_circuit_data( + src: &mut Buffer, + cd: &CommonCircuitData, + ) -> IoResult { + let proof_with_pis_target = src.read_target_proof_with_public_inputs()?; + let proof_with_pis = src.read_proof_with_public_inputs(cd)?; + let verifier_data_target = src.read_target_verifier_circuit()?; + let verifier_data = src.read_verifier_only_circuit_data()?; + Ok(Self { + proof_with_pis_target, + proof_with_pis, + verifier_data_target, + verifier_data, + }) + } +} + impl SimpleGenerator for DummyProofGenerator where F: RichField + Extendable, C: GenericConfig + 'static, C::Hasher: AlgebraicHasher, { + fn id(&self) -> String { + "DummyProofGenerator".to_string() + } + fn dependencies(&self) -> Vec { vec![] } @@ -171,4 +268,15 @@ where out_buffer.set_proof_with_pis_target(&self.proof_with_pis_target, &self.proof_with_pis); out_buffer.set_verifier_data_target(&self.verifier_data_target, &self.verifier_data); } + + fn serialize(&self, dst: &mut Vec) -> IoResult<()> { + dst.write_target_proof_with_public_inputs(&self.proof_with_pis_target)?; + dst.write_proof_with_public_inputs(&self.proof_with_pis)?; + dst.write_target_verifier_circuit(&self.verifier_data_target)?; + dst.write_verifier_only_circuit_data(&self.verifier_data) + } + + fn deserialize(_src: &mut Buffer) -> IoResult { + panic!() + } } diff --git a/plonky2/src/util/gate_serialization.rs b/plonky2/src/util/gate_serialization.rs new file mode 100644 index 00000000..3df74049 --- /dev/null +++ b/plonky2/src/util/gate_serialization.rs @@ -0,0 +1,101 @@ +use plonky2_field::extension::Extendable; + +use crate::gates::gate::GateRef; +use crate::hash::hash_types::RichField; +use crate::util::serialization::{Buffer, IoResult}; + +pub trait GateSerializer, const D: usize> { + fn read_gate(&self, buf: &mut Buffer) -> IoResult>; + fn write_gate(&self, buf: &mut Vec, gate: &GateRef) -> IoResult<()>; +} + +#[macro_export] +macro_rules! read_gate_impl { + ($buf:expr, $tag:expr, $($gate_types:ty),+) => {{ + let tag = $tag; + let buf = $buf; + let mut i = 0..; + $(if tag == i.next().unwrap() { + let gate = <$gate_types as $crate::gates::gate::Gate>::deserialize(buf)?; + Ok($crate::gates::gate::GateRef::::new(gate)) + } else)* + { + Err($crate::util::serialization::IoError) + } + }} +} + +#[macro_export] +macro_rules! get_gate_tag_impl { + ($gate:expr, $($gate_types:ty),+) => {{ + let gate_any = $gate.0.as_any(); + let mut i = 0..; + $(if let (tag, true) = (i.next().unwrap(), gate_any.is::<$gate_types>()) { + Ok(tag) + } else)* + { + log::log!(log::Level::Error, "attempted to serialize gate with id `{}` which is unsupported by this gate serializer", $gate.0.id()); + Err($crate::util::serialization::IoError) + } + }}; +} + +#[macro_export] +macro_rules! impl_gate_serializer { + ($target:ty, $($gate_types:ty),+) => { + fn read_gate(&self, buf: &mut $crate::util::serialization::Buffer) -> $crate::util::serialization::IoResult<$crate::gates::gate::GateRef> { + let tag = $crate::util::serialization::Read::read_u32(buf)?; + read_gate_impl!(buf, tag, $($gate_types),+) + } + + fn write_gate(&self, buf: &mut Vec, gate: &$crate::gates::gate::GateRef) -> $crate::util::serialization::IoResult<()> { + let tag = get_gate_tag_impl!(gate, $($gate_types),+)?; + + $crate::util::serialization::Write::write_u32(buf, tag)?; + gate.0.serialize(buf)?; + Ok(()) + } + }; +} + +pub mod default { + use plonky2_field::extension::Extendable; + + use crate::gates::arithmetic_base::ArithmeticGate; + use crate::gates::arithmetic_extension::ArithmeticExtensionGate; + use crate::gates::base_sum::BaseSumGate; + use crate::gates::constant::ConstantGate; + use crate::gates::coset_interpolation::CosetInterpolationGate; + use crate::gates::exponentiation::ExponentiationGate; + use crate::gates::multiplication_extension::MulExtensionGate; + use crate::gates::noop::NoopGate; + use crate::gates::poseidon::PoseidonGate; + use crate::gates::poseidon_mds::PoseidonMdsGate; + use crate::gates::public_input::PublicInputGate; + use crate::gates::random_access::RandomAccessGate; + use crate::gates::reducing::ReducingGate; + use crate::gates::reducing_extension::ReducingExtensionGate; + use crate::hash::hash_types::RichField; + use crate::util::gate_serialization::GateSerializer; + + pub struct DefaultGateSerializer; + impl, const D: usize> GateSerializer for DefaultGateSerializer { + impl_gate_serializer! { + DefaultGateSerializer, + ArithmeticGate, + ArithmeticExtensionGate, + BaseSumGate<2>, + ConstantGate, + CosetInterpolationGate, + ExponentiationGate, + MulExtensionGate, + NoopGate, + PoseidonMdsGate, + PoseidonGate, + PublicInputGate, + RandomAccessGate, + ReducingExtensionGate, + ReducingGate + } + } +} diff --git a/plonky2/src/util/generator_serialization.rs b/plonky2/src/util/generator_serialization.rs new file mode 100644 index 00000000..4020e993 --- /dev/null +++ b/plonky2/src/util/generator_serialization.rs @@ -0,0 +1,156 @@ +//! A module to help with WitnessGeneratorRef serialization + +use plonky2_field::extension::Extendable; + +use crate::hash::hash_types::RichField; +use crate::iop::generator::WitnessGeneratorRef; +use crate::plonk::circuit_data::CommonCircuitData; +use crate::util::serialization::{Buffer, IoResult}; + +pub trait WitnessGeneratorSerializer, const D: usize> { + fn read_generator( + &self, + buf: &mut Buffer, + common: &CommonCircuitData, + ) -> IoResult>; + fn write_generator( + &self, + buf: &mut Vec, + generator: &WitnessGeneratorRef, + ) -> IoResult<()>; +} + +#[macro_export] +macro_rules! read_generator_impl { + ($buf:expr, $tag:expr, $common:expr, $($generator_types:ty),+) => {{ + let tag = $tag; + let buf = $buf; + let mut i = 0..; + + if tag == 0 { + let generator: $crate::recursion::dummy_circuit::DummyProofGenerator = + $crate::recursion::dummy_circuit::DummyProofGenerator::deserialize_with_circuit_data(buf, $common)?; + return Ok($crate::iop::generator::WitnessGeneratorRef::::new( + $crate::iop::generator::SimpleGenerator::::adapter(generator), + )); + } + + $(if tag == i.next().unwrap() { + let generator = + <$generator_types as $crate::iop::generator::SimpleGenerator>::deserialize(buf)?; + Ok($crate::iop::generator::WitnessGeneratorRef::::new( + $crate::iop::generator::SimpleGenerator::::adapter(generator), + )) + } else)* + { + Err($crate::util::serialization::IoError) + } + }}; +} + +#[macro_export] +macro_rules! get_generator_tag_impl { + ($generator:expr, $($generator_types:ty),+) => {{ + let mut i = 0..; + $(if let (tag, true) = (i.next().unwrap(), $generator.0.id() == $crate::iop::generator::SimpleGenerator::::id(&<$generator_types>::default())) { + Ok(tag) + } else)* + { + log::log!(log::Level::Error, "attempted to serialize generator with id {} which is unsupported by this generator serializer", $generator.0.id()); + Err($crate::util::serialization::IoError) + } + }}; +} + +#[macro_export] +macro_rules! impl_generator_serializer { + ($target:ty, $($generator_types:ty),+) => { + fn read_generator( + &self, + buf: &mut $crate::util::serialization::Buffer, + common: &$crate::plonk::circuit_data::CommonCircuitData, + ) -> $crate::util::serialization::IoResult<$crate::iop::generator::WitnessGeneratorRef> { + let tag = $crate::util::serialization::Read::read_u32(buf)?; + read_generator_impl!(buf, tag, common, $($generator_types),+) + } + + fn write_generator( + &self, + buf: &mut Vec, + generator: &$crate::iop::generator::WitnessGeneratorRef, + ) -> $crate::util::serialization::IoResult<()> { + let tag = get_generator_tag_impl!(generator, $($generator_types),+)?; + + $crate::util::serialization::Write::write_u32(buf, tag)?; + generator.0.serialize(buf)?; + Ok(()) + } + }; +} + +pub mod default { + use core::marker::PhantomData; + + use plonky2_field::extension::Extendable; + + use crate::gadgets::arithmetic::EqualityGenerator; + use crate::gadgets::arithmetic_extension::QuotientGeneratorExtension; + use crate::gadgets::range_check::LowHighGenerator; + use crate::gadgets::split_base::BaseSumGenerator; + use crate::gadgets::split_join::{SplitGenerator, WireSplitGenerator}; + use crate::gates::arithmetic_base::ArithmeticBaseGenerator; + use crate::gates::arithmetic_extension::ArithmeticExtensionGenerator; + use crate::gates::base_sum::BaseSplitGenerator; + use crate::gates::coset_interpolation::InterpolationGenerator; + use crate::gates::exponentiation::ExponentiationGenerator; + use crate::gates::multiplication_extension::MulExtensionGenerator; + use crate::gates::poseidon::PoseidonGenerator; + use crate::gates::poseidon_mds::PoseidonMdsGenerator; + use crate::gates::random_access::RandomAccessGenerator; + use crate::gates::reducing::ReducingGenerator; + use crate::gates::reducing_extension::ReducingGenerator as ReducingExtensionGenerator; + use crate::hash::hash_types::RichField; + use crate::iop::generator::{ + ConstantGenerator, CopyGenerator, NonzeroTestGenerator, RandomValueGenerator, + }; + use crate::plonk::config::{AlgebraicHasher, GenericConfig}; + use crate::recursion::dummy_circuit::DummyProofGenerator; + use crate::util::generator_serialization::WitnessGeneratorSerializer; + + pub struct DefaultGeneratorSerializer, const D: usize> { + pub _phantom: PhantomData, + } + + impl WitnessGeneratorSerializer for DefaultGeneratorSerializer + where + F: RichField + Extendable, + C: GenericConfig + 'static, + C::Hasher: AlgebraicHasher, + { + impl_generator_serializer! { + DefaultGateSerializer, + DummyProofGenerator, + ArithmeticBaseGenerator, + ArithmeticExtensionGenerator, + BaseSplitGenerator<2>, + BaseSumGenerator<2>, + ConstantGenerator, + CopyGenerator, + EqualityGenerator, + ExponentiationGenerator, + InterpolationGenerator, + LowHighGenerator, + MulExtensionGenerator, + NonzeroTestGenerator, + PoseidonGenerator, + PoseidonMdsGenerator, + QuotientGeneratorExtension, + RandomAccessGenerator, + RandomValueGenerator, + ReducingGenerator, + ReducingExtensionGenerator, + SplitGenerator, + WireSplitGenerator + } + } +} diff --git a/plonky2/src/util/mod.rs b/plonky2/src/util/mod.rs index 19f3cb74..be4fab4d 100644 --- a/plonky2/src/util/mod.rs +++ b/plonky2/src/util/mod.rs @@ -10,6 +10,10 @@ use crate::field::types::Field; pub(crate) mod context_tree; pub(crate) mod partial_products; +#[macro_use] +pub mod gate_serialization; +#[macro_use] +pub mod generator_serialization; pub mod reducing; pub mod serialization; pub mod strided_view; diff --git a/plonky2/src/util/serialization.rs b/plonky2/src/util/serialization.rs index 5ef93835..488cbd61 100644 --- a/plonky2/src/util/serialization.rs +++ b/plonky2/src/util/serialization.rs @@ -1,27 +1,45 @@ +use alloc::collections::BTreeMap; use alloc::vec; use alloc::vec::Vec; use core::convert::Infallible; use core::fmt::{Debug, Display, Formatter}; use core::mem::size_of; +use core::ops::Range; use hashbrown::HashMap; +use super::gate_serialization::GateSerializer; +use super::generator_serialization::WitnessGeneratorSerializer; use crate::field::extension::{Extendable, FieldExtension}; use crate::field::polynomial::PolynomialCoeffs; use crate::field::types::{Field64, PrimeField64}; +use crate::fri::oracle::PolynomialBatch; use crate::fri::proof::{ - CompressedFriProof, CompressedFriQueryRounds, FriInitialTreeProof, FriProof, FriQueryRound, - FriQueryStep, + CompressedFriProof, CompressedFriQueryRounds, FriInitialTreeProof, FriInitialTreeProofTarget, + FriProof, FriProofTarget, FriQueryRound, FriQueryRoundTarget, FriQueryStep, FriQueryStepTarget, }; -use crate::hash::hash_types::RichField; +use crate::fri::reduction_strategies::FriReductionStrategy; +use crate::fri::{FriConfig, FriParams}; +use crate::gadgets::polynomial::PolynomialCoeffsExtTarget; +use crate::gates::gate::GateRef; +use crate::gates::selectors::SelectorsInfo; +use crate::hash::hash_types::{HashOutTarget, MerkleCapTarget, RichField}; use crate::hash::hashing::HashConfig; -use crate::hash::merkle_proofs::MerkleProof; -use crate::hash::merkle_tree::MerkleCap; -use crate::plonk::circuit_data::CommonCircuitData; +use crate::hash::merkle_proofs::{MerkleProof, MerkleProofTarget}; +use crate::hash::merkle_tree::{MerkleCap, MerkleTree}; +use crate::iop::ext_target::ExtensionTarget; +use crate::iop::generator::WitnessGeneratorRef; +use crate::iop::target::{BoolTarget, Target}; +use crate::iop::wire::Wire; +use crate::plonk::circuit_data::{ + CircuitConfig, CircuitData, CommonCircuitData, ProverCircuitData, ProverOnlyCircuitData, + VerifierCircuitData, VerifierCircuitTarget, VerifierOnlyCircuitData, +}; use crate::plonk::config::{GenericConfig, GenericHashOut, Hasher}; use crate::plonk::plonk_common::salt_size; use crate::plonk::proof::{ - CompressedProof, CompressedProofWithPublicInputs, OpeningSet, Proof, ProofWithPublicInputs, + CompressedProof, CompressedProofWithPublicInputs, OpeningSet, OpeningSetTarget, Proof, + ProofTarget, ProofWithPublicInputs, ProofWithPublicInputsTarget, }; /// A no_std compatible variant of `std::io::Error` @@ -53,6 +71,32 @@ pub trait Read { /// Reads exactly the length of `bytes` from `self` and writes it to `bytes`. fn read_exact(&mut self, bytes: &mut [u8]) -> IoResult<()>; + /// Reads a `bool` value from `self`. + #[inline] + fn read_bool(&mut self) -> IoResult { + let i = self.read_u8()?; + match i { + 0 => Ok(false), + 1 => Ok(true), + _ => Err(IoError), + } + } + + /// Reads a `BoolTarget` value from `self`. + #[inline] + fn read_target_bool(&mut self) -> IoResult { + Ok(BoolTarget::new_unsafe(self.read_target()?)) + } + + /// Reads a vector of `BoolTarget` from `self`. + #[inline] + fn read_target_bool_vec(&mut self) -> IoResult> { + let length = self.read_usize()?; + (0..length) + .map(|_| self.read_target_bool()) + .collect::, _>>() + } + /// Reads a `u8` value from `self`. #[inline] fn read_u8(&mut self) -> IoResult { @@ -69,6 +113,26 @@ pub trait Read { Ok(u32::from_le_bytes(buf)) } + /// Reads a `usize` value from `self`. + #[inline] + fn read_usize(&mut self) -> IoResult { + let mut buf = [0; std::mem::size_of::()]; + self.read_exact(&mut buf)?; + Ok(u64::from_le_bytes(buf) as usize) + } + + /// Reads a vector of `usize` value from `self`. + #[inline] + fn read_usize_vec(&mut self) -> IoResult> { + let len = self.read_usize()?; + let mut res = Vec::with_capacity(len); + for _ in 0..len { + res.push(self.read_usize()?); + } + + Ok(res) + } + /// Reads a element from the field `F` with size less than `2^64` from `self.` #[inline] fn read_field(&mut self) -> IoResult @@ -118,6 +182,49 @@ pub trait Read { (0..length).map(|_| self.read_field_ext::()).collect() } + /// Reads a Target from `self.` + #[inline] + fn read_target(&mut self) -> IoResult { + let is_wire = self.read_bool()?; + if is_wire { + let row = self.read_usize()?; + let column = self.read_usize()?; + Ok(Target::wire(row, column)) + } else { + let index = self.read_usize()?; + Ok(Target::VirtualTarget { index }) + } + } + + /// Reads an ExtensionTarget from `self`. + #[inline] + fn read_target_ext(&mut self) -> IoResult> { + let mut res = [Target::wire(0, 0); D]; + for r in res.iter_mut() { + *r = self.read_target()?; + } + + Ok(ExtensionTarget(res)) + } + + /// Reads a vector of Target from `self`. + #[inline] + fn read_target_vec(&mut self) -> IoResult> { + let length = self.read_usize()?; + (0..length) + .map(|_| self.read_target()) + .collect::, _>>() + } + + /// Reads a vector of ExtensionTarget from `self`. + #[inline] + fn read_target_ext_vec(&mut self) -> IoResult>> { + let length = self.read_usize()?; + (0..length) + .map(|_| self.read_target_ext::()) + .collect::, _>>() + } + /// Reads a hash value from `self`. #[inline] fn read_hash(&mut self) -> IoResult @@ -131,6 +238,30 @@ pub trait Read { Ok(H::Hash::from_bytes(&buf)) } + /// Reads a HashOutTarget value from `self`. + #[inline] + fn read_target_hash(&mut self) -> IoResult { + let mut elements = [Target::wire(0, 0); 4]; + for e in elements.iter_mut() { + *e = self.read_target()?; + } + + Ok(HashOutTarget { elements }) + } + + /// Reads a vector of Hash from `self`. + #[inline] + fn read_hash_vec(&mut self, length: usize) -> IoResult> + where + F: RichField, + HC: HashConfig, + H: Hasher, + { + (0..length) + .map(|_| self.read_hash::()) + .collect::, _>>() + } + /// Reads a value of type [`MerkleCap`] from `self` with the given `cap_height`. #[inline] fn read_merkle_cap(&mut self, cap_height: usize) -> IoResult> @@ -147,6 +278,43 @@ pub trait Read { )) } + /// Reads a value of type [`MerkleCapTarget`] from `self`. + #[inline] + fn read_target_merkle_cap(&mut self) -> IoResult { + let length = self.read_usize()?; + Ok(MerkleCapTarget( + (0..length) + .map(|_| self.read_target_hash()) + .collect::, _>>()?, + )) + } + + /// Reads a value of type [`MerkleTree`] from `self`. + #[inline] + fn read_merkle_tree(&mut self) -> IoResult> + where + F: RichField, + HC: HashConfig, + H: Hasher, + { + let leaves_len = self.read_usize()?; + let mut leaves = Vec::with_capacity(leaves_len); + for _ in 0..leaves_len { + let leaf_len = self.read_usize()?; + leaves.push(self.read_field_vec(leaf_len)?); + } + + let digests_len = self.read_usize()?; + let digests = self.read_hash_vec::(digests_len)?; + let cap_height = self.read_usize()?; + let cap = self.read_merkle_cap::(cap_height)?; + Ok(MerkleTree { + leaves, + digests, + cap, + }) + } + /// Reads a value of type [`OpeningSet`] from `self` with the given `common_data`. #[inline] fn read_opening_set( @@ -179,6 +347,28 @@ pub trait Read { }) } + /// Reads a value of type [`OpeningSetTarget`] from `self`. + #[inline] + fn read_target_opening_set(&mut self) -> IoResult> { + let constants = self.read_target_ext_vec::()?; + let plonk_sigmas = self.read_target_ext_vec::()?; + let wires = self.read_target_ext_vec::()?; + let plonk_zs = self.read_target_ext_vec::()?; + let plonk_zs_next = self.read_target_ext_vec::()?; + let partial_products = self.read_target_ext_vec::()?; + let quotient_polys = self.read_target_ext_vec::()?; + + Ok(OpeningSetTarget { + constants, + plonk_sigmas, + wires, + plonk_zs, + plonk_zs_next, + partial_products, + quotient_polys, + }) + } + /// Reads a value of type [`MerkleProof`] from `self`. #[inline] fn read_merkle_proof(&mut self) -> IoResult> @@ -195,6 +385,17 @@ pub trait Read { }) } + /// Reads a value of type [`MerkleProofTarget`] from `self`. + #[inline] + fn read_target_merkle_proof(&mut self) -> IoResult { + let length = self.read_u8()?; + Ok(MerkleProofTarget { + siblings: (0..length) + .map(|_| self.read_target_hash()) + .collect::>()?, + }) + } + /// Reads a value of type [`FriInitialTreeProof`] from `self` with the given `common_data`. #[inline] fn read_fri_initial_proof( @@ -232,6 +433,19 @@ pub trait Read { Ok(FriInitialTreeProof { evals_proofs }) } + /// Reads a value of type [`FriInitialTreeProofTarget`] from `self`. + #[inline] + fn read_target_fri_initial_proof(&mut self) -> IoResult { + let len = self.read_usize()?; + let mut evals_proofs = Vec::with_capacity(len); + + for _ in 0..len { + evals_proofs.push((self.read_target_vec()?, self.read_target_merkle_proof()?)); + } + + Ok(FriInitialTreeProofTarget { evals_proofs }) + } + /// Reads a value of type [`FriQueryStep`] from `self` with the given `arity` and `compressed` /// flag. #[inline] @@ -252,6 +466,17 @@ pub trait Read { }) } + /// Reads a value of type [`FriQueryStepTarget`] from `self`. + #[inline] + fn read_target_fri_query_step(&mut self) -> IoResult> { + let evals = self.read_target_ext_vec::()?; + let merkle_proof = self.read_target_merkle_proof()?; + Ok(FriQueryStepTarget { + evals, + merkle_proof, + }) + } + /// Reads a vector of [`FriQueryRound`]s from `self` with `common_data`. #[inline] #[allow(clippy::type_complexity)] @@ -281,6 +506,27 @@ pub trait Read { Ok(fqrs) } + /// Reads a vector of [`FriQueryRoundTarget`]s from `self`. + #[inline] + fn read_target_fri_query_rounds( + &mut self, + ) -> IoResult>> { + let num_query_rounds = self.read_usize()?; + let mut fqrs = Vec::with_capacity(num_query_rounds); + for _ in 0..num_query_rounds { + let initial_trees_proof = self.read_target_fri_initial_proof()?; + let num_steps = self.read_usize()?; + let steps = (0..num_steps) + .map(|_| self.read_target_fri_query_step::()) + .collect::, _>>()?; + fqrs.push(FriQueryRoundTarget { + initial_trees_proof, + steps, + }) + } + Ok(fqrs) + } + /// Reads a value of type [`FriProof`] from `self` with `common_data`. #[inline] fn read_fri_proof( @@ -308,6 +554,348 @@ pub trait Read { }) } + /// Reads a value of type [`FriProofTarget`] from `self`. + #[inline] + fn read_target_fri_proof(&mut self) -> IoResult> { + let length = self.read_usize()?; + let commit_phase_merkle_caps = (0..length) + .map(|_| self.read_target_merkle_cap()) + .collect::, _>>()?; + let query_round_proofs = self.read_target_fri_query_rounds::()?; + let final_poly = PolynomialCoeffsExtTarget(self.read_target_ext_vec::()?); + let pow_witness = self.read_target()?; + + Ok(FriProofTarget { + commit_phase_merkle_caps, + query_round_proofs, + final_poly, + pow_witness, + }) + } + + fn read_fri_reduction_strategy(&mut self) -> IoResult { + let variant = self.read_u8()?; + match variant { + 0 => { + let arities = self.read_usize_vec()?; + Ok(FriReductionStrategy::Fixed(arities)) + } + 1 => { + let arity_bits = self.read_usize()?; + let final_poly_bits = self.read_usize()?; + + Ok(FriReductionStrategy::ConstantArityBits( + arity_bits, + final_poly_bits, + )) + } + 2 => { + let is_some = self.read_u8()?; + match is_some { + 0 => Ok(FriReductionStrategy::MinSize(None)), + 1 => { + let max = self.read_usize()?; + Ok(FriReductionStrategy::MinSize(Some(max))) + } + _ => Err(IoError), + } + } + _ => Err(IoError), + } + } + + fn read_fri_config(&mut self) -> IoResult { + let rate_bits = self.read_usize()?; + let cap_height = self.read_usize()?; + let num_query_rounds = self.read_usize()?; + let proof_of_work_bits = self.read_u32()?; + let reduction_strategy = self.read_fri_reduction_strategy()?; + + Ok(FriConfig { + rate_bits, + cap_height, + num_query_rounds, + proof_of_work_bits, + reduction_strategy, + }) + } + + fn read_circuit_config(&mut self) -> IoResult { + let num_wires = self.read_usize()?; + let num_routed_wires = self.read_usize()?; + let num_constants = self.read_usize()?; + let security_bits = self.read_usize()?; + let num_challenges = self.read_usize()?; + let max_quotient_degree_factor = self.read_usize()?; + let use_base_arithmetic_gate = self.read_bool()?; + let zero_knowledge = self.read_bool()?; + let fri_config = self.read_fri_config()?; + + Ok(CircuitConfig { + num_wires, + num_routed_wires, + num_constants, + security_bits, + num_challenges, + max_quotient_degree_factor, + use_base_arithmetic_gate, + zero_knowledge, + fri_config, + }) + } + + fn read_fri_params(&mut self) -> IoResult { + let config = self.read_fri_config()?; + let reduction_arity_bits = self.read_usize_vec()?; + let degree_bits = self.read_usize()?; + let hiding = self.read_bool()?; + + Ok(FriParams { + config, + reduction_arity_bits, + degree_bits, + hiding, + }) + } + + fn read_gate, const D: usize>( + &mut self, + gate_serializer: &dyn GateSerializer, + ) -> IoResult>; + + fn read_generator, const D: usize>( + &mut self, + generator_serializer: &dyn WitnessGeneratorSerializer, + common_data: &CommonCircuitData, + ) -> IoResult>; + + fn read_selectors_info(&mut self) -> IoResult { + let selector_indices = self.read_usize_vec()?; + let groups_len = self.read_usize()?; + let mut groups = Vec::with_capacity(groups_len); + for _ in 0..groups_len { + let start = self.read_usize()?; + let end = self.read_usize()?; + groups.push(Range { start, end }); + } + + Ok(SelectorsInfo { + selector_indices, + groups, + }) + } + + fn read_polynomial_batch< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + ) -> IoResult> { + let poly_len = self.read_usize()?; + let mut polynomials = Vec::with_capacity(poly_len); + for _ in 0..poly_len { + let plen = self.read_usize()?; + polynomials.push(PolynomialCoeffs::new(self.read_field_vec(plen)?)); + } + + let merkle_tree = self.read_merkle_tree()?; + let degree_log = self.read_usize()?; + let rate_bits = self.read_usize()?; + let blinding = self.read_bool()?; + + Ok(PolynomialBatch { + polynomials, + merkle_tree, + degree_log, + rate_bits, + blinding, + }) + } + + fn read_common_circuit_data, const D: usize>( + &mut self, + gate_serializer: &dyn GateSerializer, + ) -> IoResult> { + let config = self.read_circuit_config()?; + let fri_params = self.read_fri_params()?; + + let gates_len = self.read_usize()?; + let mut gates = Vec::with_capacity(gates_len); + for _ in 0..gates_len { + let gate = self.read_gate::(gate_serializer)?; + gates.push(gate); + } + + let selectors_info = self.read_selectors_info()?; + let quotient_degree_factor = self.read_usize()?; + let num_gate_constraints = self.read_usize()?; + let num_constants = self.read_usize()?; + let num_public_inputs = self.read_usize()?; + + let k_is_len = self.read_usize()?; + let k_is = self.read_field_vec(k_is_len)?; + + let num_partial_products = self.read_usize()?; + + Ok(CommonCircuitData { + config, + fri_params, + gates, + selectors_info, + quotient_degree_factor, + num_gate_constraints, + num_constants, + num_public_inputs, + k_is, + num_partial_products, + }) + } + + fn read_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult> { + let common = self.read_common_circuit_data(gate_serializer)?; + let prover_only = self.read_prover_only_circuit_data(generator_serializer, &common)?; + let verifier_only = self.read_verifier_only_circuit_data()?; + Ok(CircuitData { + prover_only, + verifier_only, + common, + }) + } + + fn read_prover_only_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + generator_serializer: &dyn WitnessGeneratorSerializer, + cd: &CommonCircuitData, + ) -> IoResult> { + let gen_len = self.read_usize()?; + let mut generators = Vec::with_capacity(gen_len); + for _ in 0..gen_len { + generators.push(self.read_generator(generator_serializer, cd)?); + } + let map_len = self.read_usize()?; + let mut generator_indices_by_watches = BTreeMap::new(); + for _ in 0..map_len { + let k = self.read_usize()?; + generator_indices_by_watches.insert(k, self.read_usize_vec()?); + } + + let constants_sigmas_commitment = self.read_polynomial_batch()?; + let sigmas_len = self.read_usize()?; + let mut sigmas = Vec::with_capacity(sigmas_len); + for _ in 0..sigmas_len { + let sigma_len = self.read_usize()?; + sigmas.push(self.read_field_vec(sigma_len)?); + } + + let subgroup_len = self.read_usize()?; + let subgroup = self.read_field_vec(subgroup_len)?; + + let public_inputs = self.read_target_vec()?; + + let representative_map = self.read_usize_vec()?; + + let is_some = self.read_bool()?; + let fft_root_table = match is_some { + true => { + let table_len = self.read_usize()?; + let mut table = Vec::with_capacity(table_len); + for _ in 0..table_len { + let len = self.read_usize()?; + table.push(self.read_field_vec(len)?); + } + Some(table) + } + false => None, + }; + + let circuit_digest = + self.read_hash::>::HCO, >::Hasher>()?; + + Ok(ProverOnlyCircuitData { + generators, + generator_indices_by_watches, + constants_sigmas_commitment, + sigmas, + subgroup, + public_inputs, + representative_map, + fft_root_table, + circuit_digest, + }) + } + + fn read_prover_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult> { + let common = self.read_common_circuit_data(gate_serializer)?; + let prover_only = self.read_prover_only_circuit_data(generator_serializer, &common)?; + Ok(ProverCircuitData { + prover_only, + common, + }) + } + + fn read_verifier_only_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + ) -> IoResult> { + let height = self.read_usize()?; + let constants_sigmas_cap = self.read_merkle_cap(height)?; + let circuit_digest = + self.read_hash::>::HCO, >::Hasher>()?; + Ok(VerifierOnlyCircuitData { + constants_sigmas_cap, + circuit_digest, + }) + } + + fn read_verifier_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + gate_serializer: &dyn GateSerializer, + ) -> IoResult> { + let verifier_only = self.read_verifier_only_circuit_data()?; + let common = self.read_common_circuit_data(gate_serializer)?; + Ok(VerifierCircuitData { + verifier_only, + common, + }) + } + + fn read_target_verifier_circuit(&mut self) -> IoResult { + let constants_sigmas_cap = self.read_target_merkle_cap()?; + let circuit_digest = self.read_target_hash()?; + Ok(VerifierCircuitTarget { + constants_sigmas_cap, + circuit_digest, + }) + } + /// Reads a value of type [`Proof`] from `self` with `common_data`. #[inline] fn read_proof( @@ -333,6 +921,23 @@ pub trait Read { }) } + /// Reads a value of type [`ProofTarget`] from `self`. + #[inline] + fn read_target_proof(&mut self) -> IoResult> { + let wires_cap = self.read_target_merkle_cap()?; + let plonk_zs_partial_products_cap = self.read_target_merkle_cap()?; + let quotient_polys_cap = self.read_target_merkle_cap()?; + let openings = self.read_target_opening_set::()?; + let opening_proof = self.read_target_fri_proof::()?; + Ok(ProofTarget { + wires_cap, + plonk_zs_partial_products_cap, + quotient_polys_cap, + openings, + opening_proof, + }) + } + /// Reads a value of type [`ProofWithPublicInputs`] from `self` with `common_data`. #[inline] fn read_proof_with_public_inputs( @@ -345,13 +950,27 @@ pub trait Read { C: GenericConfig, { let proof = self.read_proof(common_data)?; - let public_inputs = self.read_field_vec(self.remaining() / size_of::())?; + let pi_len = self.read_usize()?; + let public_inputs = self.read_field_vec(pi_len)?; Ok(ProofWithPublicInputs { proof, public_inputs, }) } + /// Reads a value of type [`ProofWithPublicInputsTarget`] from `self`. + #[inline] + fn read_target_proof_with_public_inputs( + &mut self, + ) -> IoResult> { + let proof = self.read_target_proof()?; + let public_inputs = self.read_target_vec()?; + Ok(ProofWithPublicInputsTarget { + proof, + public_inputs, + }) + } + /// Reads a value of type [`CompressedFriQueryRounds`] from `self` with `common_data`. #[inline] fn read_compressed_fri_query_rounds( @@ -480,6 +1099,29 @@ pub trait Write { /// Writes all `bytes` to `self`. fn write_all(&mut self, bytes: &[u8]) -> IoResult<()>; + /// Writes a bool `x` to `self`. + #[inline] + fn write_bool(&mut self, x: bool) -> IoResult<()> { + self.write_u8(u8::from(x)) + } + + /// Writes a target bool `x` to `self`. + #[inline] + fn write_target_bool(&mut self, x: BoolTarget) -> IoResult<()> { + self.write_target(x.target) + } + + /// Writes a vector of BoolTarget `v` to `self.` + #[inline] + fn write_target_bool_vec(&mut self, v: &[BoolTarget]) -> IoResult<()> { + self.write_usize(v.len())?; + for &elem in v.iter() { + self.write_target_bool(elem)?; + } + + Ok(()) + } + /// Writes a byte `x` to `self`. #[inline] fn write_u8(&mut self, x: u8) -> IoResult<()> { @@ -492,6 +1134,23 @@ pub trait Write { self.write_all(&x.to_le_bytes()) } + /// Writes a word `x` to `self.` + #[inline] + fn write_usize(&mut self, x: usize) -> IoResult<()> { + self.write_all(&(x as u64).to_le_bytes()) + } + + /// Writes a vector of words `v` to `self.` + #[inline] + fn write_usize_vec(&mut self, v: &[usize]) -> IoResult<()> { + self.write_usize(v.len())?; + for &elem in v.iter() { + self.write_usize(elem)?; + } + + Ok(()) + } + /// Writes an element `x` from the field `F` to `self`. #[inline] fn write_field(&mut self, x: F) -> IoResult<()> @@ -537,6 +1196,56 @@ pub trait Write { Ok(()) } + /// Writes a Target `x` to `self.` + #[inline] + fn write_target(&mut self, x: Target) -> IoResult<()> { + match x { + Target::Wire(Wire { row, column }) => { + self.write_bool(true)?; + self.write_usize(row)?; + self.write_usize(column)?; + } + Target::VirtualTarget { index } => { + self.write_bool(false)?; + self.write_usize(index)?; + } + }; + + Ok(()) + } + + /// Writes an ExtensionTarget `x` to `self.` + #[inline] + fn write_target_ext(&mut self, x: ExtensionTarget) -> IoResult<()> { + for &elem in x.0.iter() { + self.write_target(elem)?; + } + + Ok(()) + } + + /// Writes a vector of Target `v` to `self.` + #[inline] + fn write_target_vec(&mut self, v: &[Target]) -> IoResult<()> { + self.write_usize(v.len())?; + for &elem in v.iter() { + self.write_target(elem)?; + } + + Ok(()) + } + + /// Writes a vector of ExtensionTarget `v` to `self.` + #[inline] + fn write_target_ext_vec(&mut self, v: &[ExtensionTarget]) -> IoResult<()> { + self.write_usize(v.len())?; + for &elem in v.iter() { + self.write_target_ext(elem)?; + } + + Ok(()) + } + /// Writes a hash `h` to `self`. #[inline] fn write_hash(&mut self, h: H::Hash) -> IoResult<()> @@ -548,6 +1257,32 @@ pub trait Write { self.write_all(&h.to_bytes()) } + /// Writes a HashOutTarget `h` to `self`. + #[inline] + fn write_target_hash(&mut self, h: &HashOutTarget) -> IoResult<()> { + for r in h.elements.iter() { + self.write_target(*r)?; + } + + Ok(()) + } + + /// Writes a vector of Hash `v` to `self.` + #[inline] + fn write_hash_vec(&mut self, v: &[H::Hash]) -> IoResult<()> + where + F: RichField, + HC: HashConfig, + H: Hasher, + { + self.write_usize(v.len())?; + for &elem in v.iter() { + self.write_hash::(elem)?; + } + + Ok(()) + } + /// Writes `cap`, a value of type [`MerkleCap`], to `self`. #[inline] fn write_merkle_cap(&mut self, cap: &MerkleCap) -> IoResult<()> @@ -562,6 +1297,36 @@ pub trait Write { Ok(()) } + /// Writes `cap`, a value of type [`MerkleCapTarget`], to `self`. + #[inline] + fn write_target_merkle_cap(&mut self, cap: &MerkleCapTarget) -> IoResult<()> { + self.write_usize(cap.0.len())?; + for a in &cap.0 { + self.write_target_hash(a)?; + } + Ok(()) + } + + /// Writes `tree`, a value of type [`MerkleTree`], to `self`. + #[inline] + fn write_merkle_tree(&mut self, tree: &MerkleTree) -> IoResult<()> + where + F: RichField, + HC: HashConfig, + H: Hasher, + { + self.write_usize(tree.leaves.len())?; + for i in 0..tree.leaves.len() { + self.write_usize(tree.leaves[i].len())?; + self.write_field_vec(&tree.leaves[i])?; + } + self.write_hash_vec::(&tree.digests)?; + self.write_usize(tree.cap.height())?; + self.write_merkle_cap(&tree.cap)?; + + Ok(()) + } + /// Writes a value `os` of type [`OpeningSet`] to `self.` #[inline] fn write_opening_set(&mut self, os: &OpeningSet) -> IoResult<()> @@ -577,6 +1342,21 @@ pub trait Write { self.write_field_ext_vec::(&os.quotient_polys) } + /// Writes a value `os` of type [`OpeningSet`] to `self.` + #[inline] + fn write_target_opening_set( + &mut self, + os: &OpeningSetTarget, + ) -> IoResult<()> { + self.write_target_ext_vec::(&os.constants)?; + self.write_target_ext_vec::(&os.plonk_sigmas)?; + self.write_target_ext_vec::(&os.wires)?; + self.write_target_ext_vec::(&os.plonk_zs)?; + self.write_target_ext_vec::(&os.plonk_zs_next)?; + self.write_target_ext_vec::(&os.partial_products)?; + self.write_target_ext_vec::(&os.quotient_polys) + } + /// Writes a value `p` of type [`MerkleProof`] to `self.` #[inline] fn write_merkle_proof(&mut self, p: &MerkleProof) -> IoResult<()> @@ -597,6 +1377,21 @@ pub trait Write { Ok(()) } + /// Writes a value `pt` of type [`MerkleProofTarget`] to `self.` + #[inline] + fn write_target_merkle_proof(&mut self, pt: &MerkleProofTarget) -> IoResult<()> { + let length = pt.siblings.len(); + self.write_u8( + length + .try_into() + .expect("Merkle proof length must fit in u8."), + )?; + for h in &pt.siblings { + self.write_target_hash(h)?; + } + Ok(()) + } + /// Writes a value `fitp` of type [`FriInitialTreeProof`] to `self.` #[inline] fn write_fri_initial_proof( @@ -614,6 +1409,20 @@ pub trait Write { Ok(()) } + /// Writes a value `fitpt` of type [`FriInitialTreeProofTarget`] to `self.` + #[inline] + fn write_target_fri_initial_proof( + &mut self, + fitpt: &FriInitialTreeProofTarget, + ) -> IoResult<()> { + self.write_usize(fitpt.evals_proofs.len())?; + for (v, p) in &fitpt.evals_proofs { + self.write_target_vec(v)?; + self.write_target_merkle_proof(p)?; + } + Ok(()) + } + /// Writes a value `fqs` of type [`FriQueryStep`] to `self.` #[inline] fn write_fri_query_step( @@ -628,6 +1437,16 @@ pub trait Write { self.write_merkle_proof(&fqs.merkle_proof) } + /// Writes a value `fqst` of type [`FriQueryStepTarget`] to `self.` + #[inline] + fn write_target_fri_query_step( + &mut self, + fqst: &FriQueryStepTarget, + ) -> IoResult<()> { + self.write_target_ext_vec(&fqst.evals)?; + self.write_target_merkle_proof(&fqst.merkle_proof) + } + /// Writes a value `fqrs` of type [`FriQueryRound`] to `self.` #[inline] fn write_fri_query_rounds( @@ -647,7 +1466,24 @@ pub trait Write { Ok(()) } - /// Writes a value `fq` of type [`FriProof`] to `self.` + /// Writes a value `fqrst` of type [`FriQueryRoundTarget`] to `self.` + #[inline] + fn write_target_fri_query_rounds( + &mut self, + fqrst: &[FriQueryRoundTarget], + ) -> IoResult<()> { + self.write_usize(fqrst.len())?; + for fqr in fqrst { + self.write_target_fri_initial_proof(&fqr.initial_trees_proof)?; + self.write_usize(fqr.steps.len())?; + for fqs in &fqr.steps { + self.write_target_fri_query_step::(fqs)?; + } + } + Ok(()) + } + + /// Writes a value `fp` of type [`FriProof`] to `self.` #[inline] fn write_fri_proof( &mut self, @@ -665,6 +1501,339 @@ pub trait Write { self.write_field(fp.pow_witness) } + /// Writes a value `fpt` of type [`FriProofTarget`] to `self.` + #[inline] + fn write_target_fri_proof(&mut self, fpt: &FriProofTarget) -> IoResult<()> { + self.write_usize(fpt.commit_phase_merkle_caps.len())?; + for cap in &fpt.commit_phase_merkle_caps { + self.write_target_merkle_cap(cap)?; + } + self.write_target_fri_query_rounds::(&fpt.query_round_proofs)?; + self.write_target_ext_vec::(&fpt.final_poly.0)?; + self.write_target(fpt.pow_witness) + } + + fn write_fri_reduction_strategy( + &mut self, + reduction_strategy: &FriReductionStrategy, + ) -> IoResult<()> { + match reduction_strategy { + FriReductionStrategy::Fixed(seq) => { + self.write_u8(0)?; + self.write_usize_vec(seq.as_slice())?; + + Ok(()) + } + FriReductionStrategy::ConstantArityBits(arity_bits, final_poly_bits) => { + self.write_u8(1)?; + self.write_usize(*arity_bits)?; + self.write_usize(*final_poly_bits)?; + + Ok(()) + } + FriReductionStrategy::MinSize(max) => { + self.write_u8(2)?; + if let Some(max) = max { + self.write_u8(1)?; + self.write_usize(*max)?; + } else { + self.write_u8(0)?; + } + + Ok(()) + } + } + } + + fn write_fri_config(&mut self, config: &FriConfig) -> IoResult<()> { + let FriConfig { + rate_bits, + cap_height, + num_query_rounds, + proof_of_work_bits, + reduction_strategy, + } = &config; + + self.write_usize(*rate_bits)?; + self.write_usize(*cap_height)?; + self.write_usize(*num_query_rounds)?; + self.write_u32(*proof_of_work_bits)?; + self.write_fri_reduction_strategy(reduction_strategy)?; + + Ok(()) + } + + fn write_fri_params(&mut self, fri_params: &FriParams) -> IoResult<()> { + let FriParams { + config, + reduction_arity_bits, + degree_bits, + hiding, + } = fri_params; + + self.write_fri_config(config)?; + self.write_usize_vec(reduction_arity_bits.as_slice())?; + self.write_usize(*degree_bits)?; + self.write_bool(*hiding)?; + + Ok(()) + } + + fn write_circuit_config(&mut self, config: &CircuitConfig) -> IoResult<()> { + let CircuitConfig { + num_wires, + num_routed_wires, + num_constants, + security_bits, + num_challenges, + max_quotient_degree_factor, + use_base_arithmetic_gate, + zero_knowledge, + fri_config, + } = config; + + self.write_usize(*num_wires)?; + self.write_usize(*num_routed_wires)?; + self.write_usize(*num_constants)?; + self.write_usize(*security_bits)?; + self.write_usize(*num_challenges)?; + self.write_usize(*max_quotient_degree_factor)?; + self.write_bool(*use_base_arithmetic_gate)?; + self.write_bool(*zero_knowledge)?; + self.write_fri_config(fri_config)?; + + Ok(()) + } + + fn write_gate, const D: usize>( + &mut self, + gate: &GateRef, + gate_serializer: &dyn GateSerializer, + ) -> IoResult<()>; + + fn write_generator, const D: usize>( + &mut self, + generator: &WitnessGeneratorRef, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()>; + + fn write_selectors_info(&mut self, selectors_info: &SelectorsInfo) -> IoResult<()> { + let SelectorsInfo { + selector_indices, + groups, + } = selectors_info; + + self.write_usize_vec(selector_indices.as_slice())?; + self.write_usize(groups.len())?; + for group in groups.iter() { + self.write_usize(group.start)?; + self.write_usize(group.end)?; + } + Ok(()) + } + + fn write_polynomial_batch< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + poly_batch: &PolynomialBatch, + ) -> IoResult<()> { + self.write_usize(poly_batch.polynomials.len())?; + for i in 0..poly_batch.polynomials.len() { + self.write_usize(poly_batch.polynomials[i].coeffs.len())?; + self.write_field_vec(&poly_batch.polynomials[i].coeffs)?; + } + self.write_merkle_tree(&poly_batch.merkle_tree)?; + self.write_usize(poly_batch.degree_log)?; + self.write_usize(poly_batch.rate_bits)?; + self.write_bool(poly_batch.blinding)?; + + Ok(()) + } + + fn write_common_circuit_data, const D: usize>( + &mut self, + common_data: &CommonCircuitData, + gate_serializer: &dyn GateSerializer, + ) -> IoResult<()> { + let CommonCircuitData { + config, + fri_params, + gates, + selectors_info, + quotient_degree_factor, + num_gate_constraints, + num_constants, + num_public_inputs, + k_is, + num_partial_products, + } = common_data; + + self.write_circuit_config(config)?; + self.write_fri_params(fri_params)?; + + self.write_usize(gates.len())?; + for gate in gates.iter() { + self.write_gate::(gate, gate_serializer)?; + } + + self.write_selectors_info(selectors_info)?; + self.write_usize(*quotient_degree_factor)?; + self.write_usize(*num_gate_constraints)?; + self.write_usize(*num_constants)?; + self.write_usize(*num_public_inputs)?; + + self.write_usize(k_is.len())?; + self.write_field_vec(k_is.as_slice())?; + + self.write_usize(*num_partial_products)?; + + Ok(()) + } + + fn write_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + circuit_data: &CircuitData, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + self.write_common_circuit_data(&circuit_data.common, gate_serializer)?; + self.write_prover_only_circuit_data(&circuit_data.prover_only, generator_serializer)?; + self.write_verifier_only_circuit_data(&circuit_data.verifier_only) + } + + fn write_prover_only_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + prover_only_circuit_data: &ProverOnlyCircuitData, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + let ProverOnlyCircuitData { + generators, + generator_indices_by_watches, + constants_sigmas_commitment, + sigmas, + subgroup, + public_inputs, + representative_map, + fft_root_table, + circuit_digest, + } = prover_only_circuit_data; + + self.write_usize(generators.len())?; + for generator in generators.iter() { + self.write_generator::(generator, generator_serializer)?; + } + + self.write_usize(generator_indices_by_watches.len())?; + for (k, v) in generator_indices_by_watches { + self.write_usize(*k)?; + self.write_usize_vec(v)?; + } + + self.write_polynomial_batch(constants_sigmas_commitment)?; + self.write_usize(sigmas.len())?; + for i in 0..sigmas.len() { + self.write_usize(sigmas[i].len())?; + self.write_field_vec(&sigmas[i])?; + } + self.write_usize(subgroup.len())?; + self.write_field_vec(subgroup)?; + self.write_target_vec(public_inputs)?; + self.write_usize_vec(representative_map)?; + + match fft_root_table { + Some(table) => { + self.write_bool(true)?; + self.write_usize(table.len())?; + for i in 0..table.len() { + self.write_usize(table[i].len())?; + self.write_field_vec(&table[i])?; + } + } + None => self.write_bool(false)?, + } + + self.write_hash::>::HCO, >::Hasher>( + *circuit_digest, + )?; + + Ok(()) + } + + fn write_prover_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + prover_circuit_data: &ProverCircuitData, + gate_serializer: &dyn GateSerializer, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + self.write_common_circuit_data(&prover_circuit_data.common, gate_serializer)?; + self.write_prover_only_circuit_data(&prover_circuit_data.prover_only, generator_serializer) + } + + fn write_verifier_only_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + verifier_only_circuit_data: &VerifierOnlyCircuitData, + ) -> IoResult<()> { + let VerifierOnlyCircuitData { + constants_sigmas_cap, + circuit_digest, + } = verifier_only_circuit_data; + + self.write_usize(constants_sigmas_cap.height())?; + self.write_merkle_cap(constants_sigmas_cap)?; + self.write_hash::>::HCO, >::Hasher>( + *circuit_digest, + )?; + + Ok(()) + } + + fn write_verifier_circuit_data< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + >( + &mut self, + verifier_circuit_data: &VerifierCircuitData, + gate_serializer: &dyn GateSerializer, + ) -> IoResult<()> { + self.write_verifier_only_circuit_data(&verifier_circuit_data.verifier_only)?; + self.write_common_circuit_data(&verifier_circuit_data.common, gate_serializer) + } + + fn write_target_verifier_circuit( + &mut self, + verifier_circuit: &VerifierCircuitTarget, + ) -> IoResult<()> { + let VerifierCircuitTarget { + constants_sigmas_cap, + circuit_digest, + } = verifier_circuit; + + self.write_target_merkle_cap(constants_sigmas_cap)?; + self.write_target_hash(circuit_digest)?; + + Ok(()) + } + /// Writes a value `proof` of type [`Proof`] to `self.` #[inline] fn write_proof(&mut self, proof: &Proof) -> IoResult<()> @@ -679,6 +1848,16 @@ pub trait Write { self.write_fri_proof::(&proof.opening_proof) } + /// Writes a value `proof` of type [`Proof`] to `self.` + #[inline] + fn write_target_proof(&mut self, proof: &ProofTarget) -> IoResult<()> { + self.write_target_merkle_cap(&proof.wires_cap)?; + self.write_target_merkle_cap(&proof.plonk_zs_partial_products_cap)?; + self.write_target_merkle_cap(&proof.quotient_polys_cap)?; + self.write_target_opening_set(&proof.openings)?; + self.write_target_fri_proof::(&proof.opening_proof) + } + /// Writes a value `proof_with_pis` of type [`ProofWithPublicInputs`] to `self.` #[inline] fn write_proof_with_public_inputs( @@ -694,9 +1873,24 @@ pub trait Write { public_inputs, } = proof_with_pis; self.write_proof(proof)?; + self.write_usize(public_inputs.len())?; self.write_field_vec(public_inputs) } + /// Writes a value `proof_with_pis` of type [`ProofWithPublicInputsTarget`] to `self.` + #[inline] + fn write_target_proof_with_public_inputs( + &mut self, + proof_with_pis: &ProofWithPublicInputsTarget, + ) -> IoResult<()> { + let ProofWithPublicInputsTarget { + proof, + public_inputs, + } = proof_with_pis; + self.write_target_proof(proof)?; + self.write_target_vec(public_inputs) + } + /// Writes a value `cfqrs` of type [`CompressedFriQueryRounds`] to `self.` #[inline] fn write_compressed_fri_query_rounds( @@ -787,6 +1981,22 @@ impl Write for Vec { self.extend_from_slice(bytes); Ok(()) } + + fn write_gate, const D: usize>( + &mut self, + gate: &GateRef, + gate_serializer: &dyn GateSerializer, + ) -> IoResult<()> { + gate_serializer.write_gate(self, gate) + } + + fn write_generator, const D: usize>( + &mut self, + generator: &WitnessGeneratorRef, + generator_serializer: &dyn WitnessGeneratorSerializer, + ) -> IoResult<()> { + generator_serializer.write_generator(self, generator) + } } /// Buffer @@ -805,10 +2015,22 @@ impl Buffer { Self { bytes, pos: 0 } } + /// Returns the inner position. + #[inline] + pub fn pos(&self) -> usize { + self.pos + } + /// Returns the inner buffer. #[inline] - pub fn bytes(self) -> Vec { - self.bytes + pub fn bytes(&self) -> Vec { + self.bytes.clone() + } + + /// Returns the inner unread buffer. + #[inline] + pub fn unread_bytes(&self) -> Vec { + self.bytes[self.pos..].to_vec() } } @@ -832,4 +2054,19 @@ impl Read for Buffer { Ok(()) } } + + fn read_gate, const D: usize>( + &mut self, + gate_serializer: &dyn GateSerializer, + ) -> IoResult> { + gate_serializer.read_gate(self) + } + + fn read_generator, const D: usize>( + &mut self, + generator_serializer: &dyn WitnessGeneratorSerializer, + common_data: &CommonCircuitData, + ) -> IoResult> { + generator_serializer.read_generator(self, common_data) + } } From 0e465c1ccf6f1415e89d7d827da8fca4dbc32b52 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Sun, 2 Apr 2023 11:35:54 -0400 Subject: [PATCH 10/20] Customize range specification for AllRecursiveCircuits --- evm/src/fixed_recursive_verifier.rs | 12 ++++++------ evm/tests/empty_txn_list.rs | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/evm/src/fixed_recursive_verifier.rs b/evm/src/fixed_recursive_verifier.rs index 8b8cf284..d85f42c4 100644 --- a/evm/src/fixed_recursive_verifier.rs +++ b/evm/src/fixed_recursive_verifier.rs @@ -339,41 +339,41 @@ where /// Preprocess all recursive circuits used by the system. pub fn new( all_stark: &AllStark, - degree_bits_range: Range, + degree_bits_ranges: &[Range; NUM_TABLES], stark_config: &StarkConfig, ) -> Self { let cpu = RecursiveCircuitsForTable::new( Table::Cpu, &all_stark.cpu_stark, - degree_bits_range.clone(), + degree_bits_ranges[0].clone(), &all_stark.cross_table_lookups, stark_config, ); let keccak = RecursiveCircuitsForTable::new( Table::Keccak, &all_stark.keccak_stark, - degree_bits_range.clone(), + degree_bits_ranges[1].clone(), &all_stark.cross_table_lookups, stark_config, ); let keccak_sponge = RecursiveCircuitsForTable::new( Table::KeccakSponge, &all_stark.keccak_sponge_stark, - degree_bits_range.clone(), + degree_bits_ranges[2].clone(), &all_stark.cross_table_lookups, stark_config, ); let logic = RecursiveCircuitsForTable::new( Table::Logic, &all_stark.logic_stark, - degree_bits_range.clone(), + degree_bits_ranges[3].clone(), &all_stark.cross_table_lookups, stark_config, ); let memory = RecursiveCircuitsForTable::new( Table::Memory, &all_stark.memory_stark, - degree_bits_range, + degree_bits_ranges[4].clone(), &all_stark.cross_table_lookups, stark_config, ); diff --git a/evm/tests/empty_txn_list.rs b/evm/tests/empty_txn_list.rs index fae2f656..66367ac6 100644 --- a/evm/tests/empty_txn_list.rs +++ b/evm/tests/empty_txn_list.rs @@ -96,7 +96,11 @@ fn test_empty_txn_list() -> anyhow::Result<()> { verify_proof(&all_stark, proof, &config)?; - let all_circuits = AllRecursiveCircuits::::new(&all_stark, 9..18, &config); + let all_circuits = AllRecursiveCircuits::::new( + &all_stark, + &[9..15, 9..15, 9..10, 9..12, 9..18], // Minimal ranges to prove an empty list + &config, + ); { let gate_serializer = DefaultGateSerializer; From 5de5bfb5e496b5f9c29608ca036d14691fa5a69f Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Tue, 4 Apr 2023 15:23:19 -0400 Subject: [PATCH 11/20] Move serialization files into dedicated module --- evm/src/fixed_recursive_verifier.rs | 6 +++--- evm/src/recursive_verifier.rs | 6 +++--- evm/tests/empty_txn_list.rs | 3 +-- plonky2/examples/bench_recursion.rs | 2 +- plonky2/src/plonk/circuit_data.rs | 6 +++--- plonky2/src/util/mod.rs | 5 ----- .../util/{ => serialization}/gate_serialization.rs | 6 +++++- .../{ => serialization}/generator_serialization.rs | 4 ++-- .../util/{serialization.rs => serialization/mod.rs} | 12 ++++++++++-- 9 files changed, 28 insertions(+), 22 deletions(-) rename plonky2/src/util/{ => serialization}/gate_serialization.rs (92%) rename plonky2/src/util/{ => serialization}/generator_serialization.rs (98%) rename plonky2/src/util/{serialization.rs => serialization/mod.rs} (99%) diff --git a/evm/src/fixed_recursive_verifier.rs b/evm/src/fixed_recursive_verifier.rs index d85f42c4..2e6f01aa 100644 --- a/evm/src/fixed_recursive_verifier.rs +++ b/evm/src/fixed_recursive_verifier.rs @@ -20,9 +20,9 @@ use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher}; use plonky2::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; use plonky2::recursion::cyclic_recursion::check_cyclic_proof_verifier_data; use plonky2::recursion::dummy_circuit::cyclic_base_proof; -use plonky2::util::gate_serialization::GateSerializer; -use plonky2::util::generator_serialization::WitnessGeneratorSerializer; -use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; +use plonky2::util::serialization::{ + Buffer, GateSerializer, IoResult, Read, WitnessGeneratorSerializer, Write, +}; use plonky2::util::timing::TimingTree; use plonky2_util::log2_ceil; diff --git a/evm/src/recursive_verifier.rs b/evm/src/recursive_verifier.rs index 5f4c5538..9da9281a 100644 --- a/evm/src/recursive_verifier.rs +++ b/evm/src/recursive_verifier.rs @@ -18,10 +18,10 @@ use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::circuit_data::{CircuitConfig, CircuitData, VerifierCircuitData}; use plonky2::plonk::config::{AlgebraicHasher, GenericConfig}; use plonky2::plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget}; -use plonky2::util::gate_serialization::GateSerializer; -use plonky2::util::generator_serialization::WitnessGeneratorSerializer; use plonky2::util::reducing::ReducingFactorTarget; -use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; +use plonky2::util::serialization::{ + Buffer, GateSerializer, IoResult, Read, WitnessGeneratorSerializer, Write, +}; use plonky2::with_context; use plonky2_util::log2_ceil; diff --git a/evm/tests/empty_txn_list.rs b/evm/tests/empty_txn_list.rs index 66367ac6..ec2d999b 100644 --- a/evm/tests/empty_txn_list.rs +++ b/evm/tests/empty_txn_list.rs @@ -10,8 +10,7 @@ use keccak_hash::keccak; use log::info; use plonky2::field::goldilocks_field::GoldilocksField; use plonky2::plonk::config::PoseidonGoldilocksConfig; -use plonky2::util::gate_serialization::default::DefaultGateSerializer; -use plonky2::util::generator_serialization::default::DefaultGeneratorSerializer; +use plonky2::util::serialization::{DefaultGateSerializer, DefaultGeneratorSerializer}; use plonky2::util::timing::TimingTree; use plonky2_evm::all_stark::AllStark; use plonky2_evm::config::StarkConfig; diff --git a/plonky2/examples/bench_recursion.rs b/plonky2/examples/bench_recursion.rs index c5635a1d..a6fe9c37 100644 --- a/plonky2/examples/bench_recursion.rs +++ b/plonky2/examples/bench_recursion.rs @@ -22,7 +22,7 @@ use plonky2::plonk::circuit_data::{CircuitConfig, CommonCircuitData, VerifierOnl use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, PoseidonGoldilocksConfig}; use plonky2::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs}; use plonky2::plonk::prover::prove; -use plonky2::util::gate_serialization::default::DefaultGateSerializer; +use plonky2::util::serialization::DefaultGateSerializer; use plonky2::util::timing::TimingTree; use plonky2_field::extension::Extendable; use plonky2_maybe_rayon::rayon; diff --git a/plonky2/src/plonk/circuit_data.rs b/plonky2/src/plonk/circuit_data.rs index 7bbf8971..fa9af818 100644 --- a/plonky2/src/plonk/circuit_data.rs +++ b/plonky2/src/plonk/circuit_data.rs @@ -30,9 +30,9 @@ use crate::plonk::plonk_common::PlonkOracle; use crate::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs}; use crate::plonk::prover::prove; use crate::plonk::verifier::verify; -use crate::util::gate_serialization::GateSerializer; -use crate::util::generator_serialization::WitnessGeneratorSerializer; -use crate::util::serialization::{Buffer, IoResult, Read, Write}; +use crate::util::serialization::{ + Buffer, GateSerializer, IoResult, Read, WitnessGeneratorSerializer, Write, +}; use crate::util::timing::TimingTree; #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/plonky2/src/util/mod.rs b/plonky2/src/util/mod.rs index be4fab4d..dfc32fd8 100644 --- a/plonky2/src/util/mod.rs +++ b/plonky2/src/util/mod.rs @@ -9,11 +9,6 @@ use crate::field::types::Field; pub(crate) mod context_tree; pub(crate) mod partial_products; - -#[macro_use] -pub mod gate_serialization; -#[macro_use] -pub mod generator_serialization; pub mod reducing; pub mod serialization; pub mod strided_view; diff --git a/plonky2/src/util/gate_serialization.rs b/plonky2/src/util/serialization/gate_serialization.rs similarity index 92% rename from plonky2/src/util/gate_serialization.rs rename to plonky2/src/util/serialization/gate_serialization.rs index 3df74049..351fa76b 100644 --- a/plonky2/src/util/gate_serialization.rs +++ b/plonky2/src/util/serialization/gate_serialization.rs @@ -41,6 +41,10 @@ macro_rules! get_gate_tag_impl { } #[macro_export] +/// Macro implementing the `GateSerializer` trait. +/// To serialize a list of gates used for a circuit, +/// this macro should be called with a struct on which to implement +/// this as first argument, followed by all the targeted gates. macro_rules! impl_gate_serializer { ($target:ty, $($gate_types:ty),+) => { fn read_gate(&self, buf: &mut $crate::util::serialization::Buffer) -> $crate::util::serialization::IoResult<$crate::gates::gate::GateRef> { @@ -76,7 +80,7 @@ pub mod default { use crate::gates::reducing::ReducingGate; use crate::gates::reducing_extension::ReducingExtensionGate; use crate::hash::hash_types::RichField; - use crate::util::gate_serialization::GateSerializer; + use crate::util::serialization::GateSerializer; pub struct DefaultGateSerializer; impl, const D: usize> GateSerializer for DefaultGateSerializer { diff --git a/plonky2/src/util/generator_serialization.rs b/plonky2/src/util/serialization/generator_serialization.rs similarity index 98% rename from plonky2/src/util/generator_serialization.rs rename to plonky2/src/util/serialization/generator_serialization.rs index 4020e993..6566a897 100644 --- a/plonky2/src/util/generator_serialization.rs +++ b/plonky2/src/util/serialization/generator_serialization.rs @@ -115,7 +115,7 @@ pub mod default { }; use crate::plonk::config::{AlgebraicHasher, GenericConfig}; use crate::recursion::dummy_circuit::DummyProofGenerator; - use crate::util::generator_serialization::WitnessGeneratorSerializer; + use crate::util::serialization::WitnessGeneratorSerializer; pub struct DefaultGeneratorSerializer, const D: usize> { pub _phantom: PhantomData, @@ -128,7 +128,7 @@ pub mod default { C::Hasher: AlgebraicHasher, { impl_generator_serializer! { - DefaultGateSerializer, + DefaultGeneratorSerializer, DummyProofGenerator, ArithmeticBaseGenerator, ArithmeticExtensionGenerator, diff --git a/plonky2/src/util/serialization.rs b/plonky2/src/util/serialization/mod.rs similarity index 99% rename from plonky2/src/util/serialization.rs rename to plonky2/src/util/serialization/mod.rs index 488cbd61..5a92afb5 100644 --- a/plonky2/src/util/serialization.rs +++ b/plonky2/src/util/serialization/mod.rs @@ -1,3 +1,9 @@ +#[macro_use] +pub mod generator_serialization; + +#[macro_use] +pub mod gate_serialization; + use alloc::collections::BTreeMap; use alloc::vec; use alloc::vec::Vec; @@ -6,10 +12,12 @@ use core::fmt::{Debug, Display, Formatter}; use core::mem::size_of; use core::ops::Range; +pub use gate_serialization::default::DefaultGateSerializer; +pub use gate_serialization::GateSerializer; +pub use generator_serialization::default::DefaultGeneratorSerializer; +pub use generator_serialization::WitnessGeneratorSerializer; use hashbrown::HashMap; -use super::gate_serialization::GateSerializer; -use super::generator_serialization::WitnessGeneratorSerializer; use crate::field::extension::{Extendable, FieldExtension}; use crate::field::polynomial::PolynomialCoeffs; use crate::field::types::{Field64, PrimeField64}; From bf02a3e87dd9cfbceaaa429c1c7f4200787ba90a Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Wed, 12 Apr 2023 12:34:47 -0400 Subject: [PATCH 12/20] Make generators public --- plonky2/src/gadgets/arithmetic.rs | 2 +- plonky2/src/gadgets/arithmetic_extension.rs | 2 +- plonky2/src/gadgets/mod.rs | 2 +- plonky2/src/gadgets/range_check.rs | 2 +- plonky2/src/gadgets/split_base.rs | 2 +- plonky2/src/gadgets/split_join.rs | 4 ++-- plonky2/src/gates/arithmetic_base.rs | 2 +- plonky2/src/gates/arithmetic_extension.rs | 2 +- plonky2/src/gates/coset_interpolation.rs | 2 +- plonky2/src/gates/exponentiation.rs | 2 +- plonky2/src/gates/multiplication_extension.rs | 2 +- plonky2/src/gates/poseidon.rs | 2 +- plonky2/src/gates/poseidon_mds.rs | 2 +- plonky2/src/gates/random_access.rs | 2 +- plonky2/src/gates/reducing.rs | 2 +- plonky2/src/gates/reducing_extension.rs | 2 +- plonky2/src/iop/generator.rs | 10 +++++----- plonky2/src/recursion/dummy_circuit.rs | 2 +- .../src/util/serialization/generator_serialization.rs | 8 ++++++++ 19 files changed, 31 insertions(+), 23 deletions(-) diff --git a/plonky2/src/gadgets/arithmetic.rs b/plonky2/src/gadgets/arithmetic.rs index 9a89e5a3..ed9e7c4a 100644 --- a/plonky2/src/gadgets/arithmetic.rs +++ b/plonky2/src/gadgets/arithmetic.rs @@ -372,7 +372,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug, Default)] -pub(crate) struct EqualityGenerator { +pub struct EqualityGenerator { x: Target, y: Target, equal: BoolTarget, diff --git a/plonky2/src/gadgets/arithmetic_extension.rs b/plonky2/src/gadgets/arithmetic_extension.rs index 69a5668c..ccb84a40 100644 --- a/plonky2/src/gadgets/arithmetic_extension.rs +++ b/plonky2/src/gadgets/arithmetic_extension.rs @@ -495,7 +495,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug, Default)] -pub(crate) struct QuotientGeneratorExtension { +pub struct QuotientGeneratorExtension { numerator: ExtensionTarget, denominator: ExtensionTarget, quotient: ExtensionTarget, diff --git a/plonky2/src/gadgets/mod.rs b/plonky2/src/gadgets/mod.rs index 6309eb3d..bac94475 100644 --- a/plonky2/src/gadgets/mod.rs +++ b/plonky2/src/gadgets/mod.rs @@ -7,4 +7,4 @@ pub mod random_access; pub mod range_check; pub mod select; pub mod split_base; -pub(crate) mod split_join; +pub mod split_join; diff --git a/plonky2/src/gadgets/range_check.rs b/plonky2/src/gadgets/range_check.rs index 144ae5dc..bdd1942c 100644 --- a/plonky2/src/gadgets/range_check.rs +++ b/plonky2/src/gadgets/range_check.rs @@ -53,7 +53,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug, Default)] -pub(crate) struct LowHighGenerator { +pub struct LowHighGenerator { integer: Target, n_log: usize, low: Target, diff --git a/plonky2/src/gadgets/split_base.rs b/plonky2/src/gadgets/split_base.rs index ace3284d..c2919315 100644 --- a/plonky2/src/gadgets/split_base.rs +++ b/plonky2/src/gadgets/split_base.rs @@ -81,7 +81,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug, Default)] -pub(crate) struct BaseSumGenerator { +pub struct BaseSumGenerator { row: usize, limbs: Vec, } diff --git a/plonky2/src/gadgets/split_join.rs b/plonky2/src/gadgets/split_join.rs index 4e39a2be..e3eda241 100644 --- a/plonky2/src/gadgets/split_join.rs +++ b/plonky2/src/gadgets/split_join.rs @@ -57,7 +57,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug, Default)] -pub(crate) struct SplitGenerator { +pub struct SplitGenerator { integer: Target, bits: Vec, } @@ -99,7 +99,7 @@ impl SimpleGenerator for SplitGenerator { } #[derive(Debug, Default)] -pub(crate) struct WireSplitGenerator { +pub struct WireSplitGenerator { integer: Target, gates: Vec, num_limbs: usize, diff --git a/plonky2/src/gates/arithmetic_base.rs b/plonky2/src/gates/arithmetic_base.rs index aa9f2d86..7ed25328 100644 --- a/plonky2/src/gates/arithmetic_base.rs +++ b/plonky2/src/gates/arithmetic_base.rs @@ -181,7 +181,7 @@ impl, const D: usize> PackedEvaluableBase for } #[derive(Clone, Debug, Default)] -pub(crate) struct ArithmeticBaseGenerator, const D: usize> { +pub struct ArithmeticBaseGenerator, const D: usize> { row: usize, const_0: F, const_1: F, diff --git a/plonky2/src/gates/arithmetic_extension.rs b/plonky2/src/gates/arithmetic_extension.rs index 36274dfd..ebe7a650 100644 --- a/plonky2/src/gates/arithmetic_extension.rs +++ b/plonky2/src/gates/arithmetic_extension.rs @@ -165,7 +165,7 @@ impl, const D: usize> Gate for ArithmeticExte } #[derive(Clone, Debug, Default)] -pub(crate) struct ArithmeticExtensionGenerator, const D: usize> { +pub struct ArithmeticExtensionGenerator, const D: usize> { row: usize, const_0: F, const_1: F, diff --git a/plonky2/src/gates/coset_interpolation.rs b/plonky2/src/gates/coset_interpolation.rs index 6ec0eae5..ff6d9918 100644 --- a/plonky2/src/gates/coset_interpolation.rs +++ b/plonky2/src/gates/coset_interpolation.rs @@ -387,7 +387,7 @@ impl, const D: usize> Gate for CosetInterpola } #[derive(Debug, Default)] -pub(crate) struct InterpolationGenerator, const D: usize> { +pub struct InterpolationGenerator, const D: usize> { row: usize, gate: CosetInterpolationGate, interpolation_domain: Vec, diff --git a/plonky2/src/gates/exponentiation.rs b/plonky2/src/gates/exponentiation.rs index 64c685dc..eefc7ba7 100644 --- a/plonky2/src/gates/exponentiation.rs +++ b/plonky2/src/gates/exponentiation.rs @@ -238,7 +238,7 @@ impl, const D: usize> PackedEvaluableBase } #[derive(Debug, Default)] -pub(crate) struct ExponentiationGenerator, const D: usize> { +pub struct ExponentiationGenerator, const D: usize> { row: usize, gate: ExponentiationGate, } diff --git a/plonky2/src/gates/multiplication_extension.rs b/plonky2/src/gates/multiplication_extension.rs index c82c30a1..7e1c1924 100644 --- a/plonky2/src/gates/multiplication_extension.rs +++ b/plonky2/src/gates/multiplication_extension.rs @@ -152,7 +152,7 @@ impl, const D: usize> Gate for MulExtensionGa } #[derive(Clone, Debug, Default)] -pub(crate) struct MulExtensionGenerator, const D: usize> { +pub struct MulExtensionGenerator, const D: usize> { row: usize, const_0: F, i: usize, diff --git a/plonky2/src/gates/poseidon.rs b/plonky2/src/gates/poseidon.rs index af82a608..caab7faf 100644 --- a/plonky2/src/gates/poseidon.rs +++ b/plonky2/src/gates/poseidon.rs @@ -410,7 +410,7 @@ impl, const D: usize> Gate for PoseidonGate + Poseidon, const D: usize> { +pub struct PoseidonGenerator + Poseidon, const D: usize> { row: usize, _phantom: PhantomData, } diff --git a/plonky2/src/gates/poseidon_mds.rs b/plonky2/src/gates/poseidon_mds.rs index 409d0325..a3b4c927 100644 --- a/plonky2/src/gates/poseidon_mds.rs +++ b/plonky2/src/gates/poseidon_mds.rs @@ -210,7 +210,7 @@ impl + Poseidon, const D: usize> Gate for Pos } #[derive(Clone, Debug, Default)] -pub(crate) struct PoseidonMdsGenerator { +pub struct PoseidonMdsGenerator { row: usize, } diff --git a/plonky2/src/gates/random_access.rs b/plonky2/src/gates/random_access.rs index 6d520786..7f651bab 100644 --- a/plonky2/src/gates/random_access.rs +++ b/plonky2/src/gates/random_access.rs @@ -339,7 +339,7 @@ impl, const D: usize> PackedEvaluableBase } #[derive(Debug, Default)] -pub(crate) struct RandomAccessGenerator, const D: usize> { +pub struct RandomAccessGenerator, const D: usize> { row: usize, gate: RandomAccessGate, copy: usize, diff --git a/plonky2/src/gates/reducing.rs b/plonky2/src/gates/reducing.rs index 43549210..b9bd025a 100644 --- a/plonky2/src/gates/reducing.rs +++ b/plonky2/src/gates/reducing.rs @@ -178,7 +178,7 @@ impl, const D: usize> Gate for ReducingGate { +pub struct ReducingGenerator { row: usize, gate: ReducingGate, } diff --git a/plonky2/src/gates/reducing_extension.rs b/plonky2/src/gates/reducing_extension.rs index ce6a9725..11541ec2 100644 --- a/plonky2/src/gates/reducing_extension.rs +++ b/plonky2/src/gates/reducing_extension.rs @@ -178,7 +178,7 @@ impl, const D: usize> Gate for ReducingExtens } #[derive(Debug, Default)] -pub(crate) struct ReducingGenerator { +pub struct ReducingGenerator { row: usize, gate: ReducingExtensionGate, } diff --git a/plonky2/src/iop/generator.rs b/plonky2/src/iop/generator.rs index dbe7f475..165b5ada 100644 --- a/plonky2/src/iop/generator.rs +++ b/plonky2/src/iop/generator.rs @@ -129,7 +129,7 @@ impl, F: Field> AnyWitnessGenerator for T { } /// A wrapper around an `Box`. -pub struct WitnessGeneratorRef(pub(crate) Box>); +pub struct WitnessGeneratorRef(pub Box>); impl WitnessGeneratorRef { pub fn new>(generator: G) -> WitnessGeneratorRef { @@ -269,7 +269,7 @@ impl> WitnessGenerator for SimpleGeneratorAd /// A generator which copies one wire to another. #[derive(Debug, Default)] -pub(crate) struct CopyGenerator { +pub struct CopyGenerator { pub(crate) src: Target, pub(crate) dst: Target, } @@ -302,7 +302,7 @@ impl SimpleGenerator for CopyGenerator { /// A generator for including a random value #[derive(Debug, Default)] -pub(crate) struct RandomValueGenerator { +pub struct RandomValueGenerator { pub(crate) target: Target, } @@ -332,7 +332,7 @@ impl SimpleGenerator for RandomValueGenerator { /// A generator for testing if a value equals zero #[derive(Debug, Default)] -pub(crate) struct NonzeroTestGenerator { +pub struct NonzeroTestGenerator { pub(crate) to_test: Target, pub(crate) dummy: Target, } @@ -372,7 +372,7 @@ impl SimpleGenerator for NonzeroTestGenerator { /// Generator used to fill an extra constant. #[derive(Debug, Clone, Default)] -pub(crate) struct ConstantGenerator { +pub struct ConstantGenerator { pub row: usize, pub constant_index: usize, pub wire_index: usize, diff --git a/plonky2/src/recursion/dummy_circuit.rs b/plonky2/src/recursion/dummy_circuit.rs index b052cdd5..79bfff15 100644 --- a/plonky2/src/recursion/dummy_circuit.rs +++ b/plonky2/src/recursion/dummy_circuit.rs @@ -154,7 +154,7 @@ impl, const D: usize> CircuitBuilder { } #[derive(Debug)] -pub(crate) struct DummyProofGenerator +pub struct DummyProofGenerator where F: RichField + Extendable, C: GenericConfig, diff --git a/plonky2/src/util/serialization/generator_serialization.rs b/plonky2/src/util/serialization/generator_serialization.rs index 6566a897..5fab57e1 100644 --- a/plonky2/src/util/serialization/generator_serialization.rs +++ b/plonky2/src/util/serialization/generator_serialization.rs @@ -63,6 +63,14 @@ macro_rules! get_generator_tag_impl { } #[macro_export] +/// Macro implementing the `WitnessGeneratorSerializer` trait. +/// To serialize a list of generators used for a circuit, +/// this macro should be called with a struct on which to implement +/// this as first argument, followed by all the targeted generators. +/// +/// ***NOTE:*** If you need to include `DummyProofGenerator`, you **MUST** +/// place it at the *beginning* of the generators list, right after +/// the serializer struct. macro_rules! impl_generator_serializer { ($target:ty, $($generator_types:ty),+) => { fn read_generator( From 2a9c5cfd328409c37ebaee94886f7e8929d2c64e Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Wed, 12 Apr 2023 12:35:09 -0400 Subject: [PATCH 13/20] Add serialization check in square_root example --- plonky2/examples/square_root.rs | 60 ++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/plonky2/examples/square_root.rs b/plonky2/examples/square_root.rs index 7cf294c6..6ac9eddd 100644 --- a/plonky2/examples/square_root.rs +++ b/plonky2/examples/square_root.rs @@ -4,14 +4,23 @@ use core::marker::PhantomData; use anyhow::Result; use plonky2::field::types::{PrimeField, Sample}; +use plonky2::gates::arithmetic_base::ArithmeticBaseGenerator; +use plonky2::gates::poseidon::PoseidonGenerator; +use plonky2::gates::poseidon_mds::PoseidonMdsGenerator; use plonky2::hash::hash_types::RichField; -use plonky2::iop::generator::{GeneratedValues, SimpleGenerator}; +use plonky2::iop::generator::{ + ConstantGenerator, GeneratedValues, RandomValueGenerator, SimpleGenerator, +}; use plonky2::iop::target::Target; use plonky2::iop::witness::{PartialWitness, PartitionWitness, Witness, WitnessWrite}; use plonky2::plonk::circuit_builder::CircuitBuilder; -use plonky2::plonk::circuit_data::CircuitConfig; -use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; -use plonky2::util::serialization::{Buffer, IoResult, Read, Write}; +use plonky2::plonk::circuit_data::{CircuitConfig, CircuitData}; +use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, PoseidonGoldilocksConfig}; +use plonky2::recursion::dummy_circuit::DummyProofGenerator; +use plonky2::util::serialization::{ + Buffer, DefaultGateSerializer, IoResult, Read, WitnessGeneratorSerializer, Write, +}; +use plonky2::{get_generator_tag_impl, impl_generator_serializer, read_generator_impl}; use plonky2_field::extension::Extendable; /// A generator used by the prover to calculate the square root (`x`) of a given value @@ -59,6 +68,28 @@ impl, const D: usize> SimpleGenerator } } +pub struct CustomGeneratorSerializer, const D: usize> { + pub _phantom: PhantomData, +} + +impl WitnessGeneratorSerializer for CustomGeneratorSerializer +where + F: RichField + Extendable, + C: GenericConfig + 'static, + C::Hasher: AlgebraicHasher, +{ + impl_generator_serializer! { + CustomGeneratorSerializer, + DummyProofGenerator, + ArithmeticBaseGenerator, + ConstantGenerator, + PoseidonGenerator, + PoseidonMdsGenerator, + RandomValueGenerator, + SquareRootGenerator + } +} + /// An example of using Plonky2 to prove a statement of the form /// "I know the square root of this field element." fn main() -> Result<()> { @@ -99,5 +130,26 @@ fn main() -> Result<()> { let x_squared_actual = proof.public_inputs[0]; println!("Field element (square): {x_squared_actual}"); + // Test serialization + { + let gate_serializer = DefaultGateSerializer; + let generator_serializer = CustomGeneratorSerializer { + _phantom: PhantomData::, + }; + + let data_bytes = data + .to_bytes(&gate_serializer, &generator_serializer) + .map_err(|_| anyhow::Error::msg("CircuitData serialization failed."))?; + + let data_from_bytes = CircuitData::::from_bytes( + &data_bytes, + &gate_serializer, + &generator_serializer, + ) + .map_err(|_| anyhow::Error::msg("CircuitData deserialization failed."))?; + + assert_eq!(data, data_from_bytes); + } + data.verify(proof) } From 723f197d0e954a72de2eb355a62b9f6a484356f9 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Thu, 20 Apr 2023 08:36:54 +0200 Subject: [PATCH 14/20] Cleanup --- plonky2/src/gates/gate.rs | 3 ++- plonky2/src/iop/generator.rs | 29 ++++++----------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/plonky2/src/gates/gate.rs b/plonky2/src/gates/gate.rs index 9821106c..43c1179a 100644 --- a/plonky2/src/gates/gate.rs +++ b/plonky2/src/gates/gate.rs @@ -198,6 +198,7 @@ pub trait Gate, const D: usize>: 'static + Send + S } } +/// A wrapper trait over a `Gate`, to allow for gate serialization. pub trait AnyGate, const D: usize>: Gate { fn as_any(&self) -> &dyn Any; } @@ -208,7 +209,7 @@ impl, F: RichField + Extendable, const D: usize> AnyGate } } -/// A wrapper around an `Rc` which implements `PartialEq`, `Eq` and `Hash` based on gate IDs. +/// A wrapper around an `Arc` which implements `PartialEq`, `Eq` and `Hash` based on gate IDs. #[derive(Clone)] pub struct GateRef, const D: usize>(pub(crate) Arc>); diff --git a/plonky2/src/iop/generator.rs b/plonky2/src/iop/generator.rs index 165b5ada..16a23e26 100644 --- a/plonky2/src/iop/generator.rs +++ b/plonky2/src/iop/generator.rs @@ -1,6 +1,5 @@ use alloc::vec; use alloc::vec::Vec; -use core::any::Any; use core::fmt::Debug; use core::marker::PhantomData; @@ -118,33 +117,19 @@ pub trait WitnessGenerator: 'static + Send + Sync + Debug { Self: Sized; } -pub trait AnyWitnessGenerator: WitnessGenerator { - fn as_any(&self) -> &dyn Any; -} - -impl, F: Field> AnyWitnessGenerator for T { - fn as_any(&self) -> &dyn Any { - self - } -} - -/// A wrapper around an `Box`. -pub struct WitnessGeneratorRef(pub Box>); +/// A wrapper around an `Box` which implements `PartialEq` +/// and `Eq` based on generator IDs. +pub struct WitnessGeneratorRef(pub Box>); impl WitnessGeneratorRef { - pub fn new>(generator: G) -> WitnessGeneratorRef { + pub fn new>(generator: G) -> WitnessGeneratorRef { WitnessGeneratorRef(Box::new(generator)) } } impl PartialEq for WitnessGeneratorRef { fn eq(&self, other: &Self) -> bool { - let mut buf1 = Vec::new(); - let mut buf2 = Vec::new(); - self.0.serialize(&mut buf1).unwrap(); - other.0.serialize(&mut buf2).unwrap(); - - buf1 == buf2 + self.0.id() == other.0.id() } } @@ -152,9 +137,7 @@ impl Eq for WitnessGeneratorRef {} impl Debug for WitnessGeneratorRef { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut buf = Vec::new(); - self.0.serialize(&mut buf).unwrap(); - write!(f, "{:?}", buf) + write!(f, "{}", self.0.id()) } } From d5060ecd60471c78fa30f1e7b24fae39353c093e Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Fri, 21 Apr 2023 18:00:52 -0700 Subject: [PATCH 15/20] precompile optimizations --- .../kernel/asm/core/precompiles/bn_add.asm | 33 +++++++++++-------- .../kernel/asm/core/precompiles/bn_mul.asm | 26 ++++++++------- .../cpu/kernel/asm/core/precompiles/ecrec.asm | 33 +++++++++++-------- 3 files changed, 53 insertions(+), 39 deletions(-) diff --git a/evm/src/cpu/kernel/asm/core/precompiles/bn_add.asm b/evm/src/cpu/kernel/asm/core/precompiles/bn_add.asm index ca8bbb5a..c03c9259 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/bn_add.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/bn_add.asm @@ -11,25 +11,30 @@ global precompile_bn_add: %charge_gas_const(@BN_ADD_GAS) // Load x0, y0, x1, y1 from the call data using `mload_packing`. + PUSH bn_add_return + // stack: bn_add_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 96, 32) GET_CONTEXT - %stack (ctx, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 96, 32, bn_add_contd, kexit_info) - %jump(mload_packing) -bn_add_contd: + // stack: ctx, @SEGMENT_CALLDATA, 96, 32, bn_add_return, kexit_info + %mload_packing + // stack: y1, bn_add_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 64, 32) GET_CONTEXT - %stack (ctx, y1, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 64, 32, bn_add_contd2, y1, kexit_info) - %jump(mload_packing) -bn_add_contd2: + // stack: ctx, @SEGMENT_CALLDATA, 64, 32, y1, bn_add_return, kexit_info + %mload_packing + // stack: x1, y1, bn_add_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 32, 32) GET_CONTEXT - %stack (ctx, x1, y1, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 32, 32, bn_add_contd3, x1, y1, kexit_info) - %jump(mload_packing) -bn_add_contd3: + // stack: ctx, @SEGMENT_CALLDATA, 32, 32, x1, y1, bn_add_return, kexit_info + %mload_packing + // stack: y0, x1, y1, bn_add_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 0, 32) GET_CONTEXT - %stack (ctx, y0, x1, y1, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 0, 32, bn_add_contd4, y0, x1, y1, kexit_info) - %jump(mload_packing) -bn_add_contd4: - %stack (x0, y0, x1, y1, kexit_info) -> (x0, y0, x1, y1, bn_add_contd5, kexit_info) + // stack: ctx, @SEGMENT_CALLDATA, 0, 32, y0, x1, y1, bn_add_return, kexit_info + %mload_packing + // stack: x0, y0, x1, y1, bn_add_return, kexit_info %jump(bn_add) -bn_add_contd5: +bn_add_return: // stack: x, y, kexit_info DUP2 %eq_const(@U256_MAX) // bn_add returns (U256_MAX, U256_MAX) on bad input. DUP2 %eq_const(@U256_MAX) // bn_add returns (U256_MAX, U256_MAX) on bad input. diff --git a/evm/src/cpu/kernel/asm/core/precompiles/bn_mul.asm b/evm/src/cpu/kernel/asm/core/precompiles/bn_mul.asm index 554849ab..4e71954d 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/bn_mul.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/bn_mul.asm @@ -11,21 +11,25 @@ global precompile_bn_mul: %charge_gas_const(@BN_MUL_GAS) // Load x, y, n from the call data using `mload_packing`. + PUSH bn_mul_return + // stack: bn_mul_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 64, 32) GET_CONTEXT - %stack (ctx, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 64, 32, bn_mul_contd, kexit_info) - %jump(mload_packing) -bn_mul_contd: + // stack: ctx, @SEGMENT_CALLDATA, 64, 32, bn_mul_return, kexit_info + %mload_packing + // stack: n, bn_mul_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 32, 32) GET_CONTEXT - %stack (ctx, n, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 32, 32, bn_mul_contd2, n, kexit_info) - %jump(mload_packing) -bn_mul_contd2: + // stack: ctx, @SEGMENT_CALLDATA, 32, 32, n, bn_mul_return, kexit_info + %mload_packing + // stack: y, n, bn_mul_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 0, 32) GET_CONTEXT - %stack (ctx, y, n, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 0, 32, bn_mul_contd3, y, n, kexit_info) - %jump(mload_packing) -bn_mul_contd3: - %stack (x, y, n, kexit_info) -> (x, y, n, bn_mul_contd4, kexit_info) + // stack: ctx, @SEGMENT_CALLDATA, 0, 32, y, n, bn_mul_return, kexit_info + %mload_packing + // stack: x, y, n, bn_mul_return, kexit_info %jump(bn_mul) -bn_mul_contd4: +bn_mul_return: // stack: Px, Py, kexit_info DUP2 %eq_const(@U256_MAX) // bn_mul returns (U256_MAX, U256_MAX) on bad input. DUP2 %eq_const(@U256_MAX) // bn_mul returns (U256_MAX, U256_MAX) on bad input. diff --git a/evm/src/cpu/kernel/asm/core/precompiles/ecrec.asm b/evm/src/cpu/kernel/asm/core/precompiles/ecrec.asm index e4a03a99..b59301d7 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/ecrec.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/ecrec.asm @@ -11,25 +11,30 @@ global precompile_ecrec: %charge_gas_const(@ECREC_GAS) // Load hash, v, r, s from the call data using `mload_packing`. + PUSH ecrec_return + // stack: ecrec_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 96, 32) GET_CONTEXT - %stack (ctx, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 96, 32, ecrec_contd, kexit_info) - %jump(mload_packing) -ecrec_contd: + // stack: ctx, @SEGMENT_CALLDATA, 96, 32, ecrec_return, kexit_info + %mload_packing + // stack: s, ecrec_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 64, 32) GET_CONTEXT - %stack (ctx, s, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 64, 32, ecrec_contd2, s, kexit_info) - %jump(mload_packing) -ecrec_contd2: + // stack: ctx, @SEGMENT_CALLDATA, 64, 32, s, ecrec_return, kexit_info + %mload_packing + // stack: r, s, ecrec_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 32, 32) GET_CONTEXT - %stack (ctx, r, s, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 32, 32, ecrec_contd3, r, s, kexit_info) - %jump(mload_packing) -ecrec_contd3: + // stack: ctx, @SEGMENT_CALLDATA, 32, 32, r, s, ecrec_return, kexit_info + %mload_packing + // stack: v, r, s, ecrec_return, kexit_info + %stack () -> (@SEGMENT_CALLDATA, 0, 32) GET_CONTEXT - %stack (ctx, v, r, s, kexit_info) -> (ctx, @SEGMENT_CALLDATA, 0, 32, ecrec_contd4, v, r, s, kexit_info) - %jump(mload_packing) -ecrec_contd4: - %stack (hash, v, r, s, kexit_info) -> (hash, v, r, s, ecrec_contd5, kexit_info) + // stack: ctx, @SEGMENT_CALLDATA, 0, 32, v, r, s, ecrec_return, kexit_info + %mload_packing + // stack: hash, v, r, s, ecrec_return, kexit_info %jump(ecrecover) -ecrec_contd5: +ecrec_return: // stack: address, kexit_info DUP1 %eq_const(@U256_MAX) %jumpi(ecrec_bad_input) // ecrecover returns U256_MAX on bad input. From 472face2a512005f54085d9e738e20d9473387c3 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Mon, 24 Apr 2023 07:17:47 +0200 Subject: [PATCH 16/20] EIP-3860: Limit and meter initcode (#999) * EIP3860 * Contract creation tx * Minor --- evm/src/cpu/kernel/asm/core/create.asm | 21 +++++++++++++++++-- evm/src/cpu/kernel/asm/core/intrinsic_gas.asm | 14 +++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/evm/src/cpu/kernel/asm/core/create.asm b/evm/src/cpu/kernel/asm/core/create.asm index 6045454b..5a942854 100644 --- a/evm/src/cpu/kernel/asm/core/create.asm +++ b/evm/src/cpu/kernel/asm/core/create.asm @@ -10,7 +10,10 @@ global sys_create: %checked_mem_expansion // stack: kexit_info, value, code_offset, code_len %charge_gas_const(@GAS_CREATE) - // TODO: If using EIP-3860, we should limit and charge gas on `code_len`. + // stack: kexit_info, value, code_offset, code_len + DUP4 + // stack: code_len, kexit_info, value, code_offset, code_len + %check_initcode_size %stack (kexit_info, value, code_offset, code_len) -> (sys_create_got_address, value, code_offset, code_len, kexit_info) @@ -39,7 +42,11 @@ global sys_create2: // stack: kexit_info, value, code_offset, code_len, salt DUP4 %num_bytes_to_num_words %mul_const(@GAS_KECCAK256WORD) %add_const(@GAS_CREATE) %charge_gas - // TODO: If using EIP-3860, we should limit and charge gas on `code_len`. + // stack: kexit_info, value, code_offset, code_len, salt + DUP4 + // stack: code_len, kexit_info, value, code_offset, code_len, salt + %check_initcode_size + SWAP4 %stack (salt) -> (salt, create_common) @@ -189,3 +196,13 @@ set_codehash: %mstore_trie_data // stack: retdest JUMP + +// Check and charge gas cost for initcode size. See EIP-3860. +// Pre stack: code_size, kexit_info +// Post stack: kexit_info +%macro check_initcode_size + DUP1 %gt_const(@MAX_INITCODE_SIZE) %jumpi(fault_exception) + // stack: code_size, kexit_info + %num_bytes_to_num_words %mul_const(@INITCODE_WORD_COST) + %charge_gas +%endmacro diff --git a/evm/src/cpu/kernel/asm/core/intrinsic_gas.asm b/evm/src/cpu/kernel/asm/core/intrinsic_gas.asm index 9e8a7f80..87737302 100644 --- a/evm/src/cpu/kernel/asm/core/intrinsic_gas.asm +++ b/evm/src/cpu/kernel/asm/core/intrinsic_gas.asm @@ -45,7 +45,21 @@ count_zeros_finish: // stack: gas_txndata, retdest %is_contract_creation + DUP1 %mul_const(@GAS_TXCREATE) + // stack: gas_creation, is_creation, gas_txndata, retdest + SWAP1 + // stack: is_creation, gas_creation, gas_txndata, retdest + DUP1 + // stack: is_creation, is_creation, gas_creation, gas_txndata, retdest + %mload_txn_field(@TXN_FIELD_DATA_LEN) %gt_const(@MAX_INITCODE_SIZE) + // stack: initcode_size > max, is_creation, is_creation, gas_creation, gas_txndata, retdest + MUL // Cheaper than AND + %assert_zero + // stack: is_creation, gas_creation, gas_txndata, retdest + %mload_txn_field(@TXN_FIELD_DATA_LEN) %num_bytes_to_num_words + // stack: initcode_words, is_creation, gas_creation, gas_txndata, retdest + %mul_const(@INITCODE_WORD_COST) MUL ADD // stack: gas_creation, gas_txndata, retdest PUSH @GAS_TRANSACTION From a4b714e64d0adaa23ccd1b849591f1d03371fa12 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Mon, 24 Apr 2023 07:55:04 +0200 Subject: [PATCH 17/20] EIP-3541: Reject new contract code starting with the 0xEF byte (#1003) * EIP-3541: Reject new contract code starting with the 0xEF byte * Panic instead * PR feedback --- evm/src/cpu/kernel/asm/core/create.asm | 4 +++- evm/src/cpu/kernel/asm/core/process_txn.asm | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/evm/src/cpu/kernel/asm/core/create.asm b/evm/src/cpu/kernel/asm/core/create.asm index 5a942854..0bcddecf 100644 --- a/evm/src/cpu/kernel/asm/core/create.asm +++ b/evm/src/cpu/kernel/asm/core/create.asm @@ -137,9 +137,11 @@ after_constructor: // stack: new_ctx, leftover_gas, success, address, kexit_info POP - // TODO: EIP-3541: Reject new contract code starting with the 0xEF byte // TODO: Skip blocks below if success is false. + // EIP-3541: Reject new contract code starting with the 0xEF byte + PUSH 0 %mload_current(@SEGMENT_RETURNDATA) %eq_const(0xEF) %jumpi(fault_exception) + // Charge gas for the code size. SWAP3 // stack: kexit_info, success, address, leftover_gas diff --git a/evm/src/cpu/kernel/asm/core/process_txn.asm b/evm/src/cpu/kernel/asm/core/process_txn.asm index 6c466749..3e16bbd4 100644 --- a/evm/src/cpu/kernel/asm/core/process_txn.asm +++ b/evm/src/cpu/kernel/asm/core/process_txn.asm @@ -144,6 +144,10 @@ process_contract_creation_txn_after_code_loaded: global process_contract_creation_txn_after_constructor: // stack: success, leftover_gas, new_ctx, address, retdest POP // TODO: Success will go into the receipt when we support that. + + // EIP-3541: Reject new contract code starting with the 0xEF byte + PUSH 0 %mload_current(@SEGMENT_RETURNDATA) %eq_const(0xEF) %assert_zero // TODO: need to revert changes here. + // stack: leftover_gas, new_ctx, address, retdest %returndatasize // Size of the code. // stack: code_size, leftover_gas, new_ctx, address, retdest From b7e93511e46b32e148b2b2dc9e21d8cebedd81cb Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Mon, 24 Apr 2023 09:07:00 +0200 Subject: [PATCH 18/20] New contract hook (#1002) * New contract hook * Minor * PR feedback --- evm/src/cpu/kernel/asm/core/create.asm | 20 ++++++++++++- evm/src/cpu/kernel/asm/core/process_txn.asm | 13 +++++++++ evm/src/generation/state.rs | 32 ++++++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/evm/src/cpu/kernel/asm/core/create.asm b/evm/src/cpu/kernel/asm/core/create.asm index 0bcddecf..2edd9bbe 100644 --- a/evm/src/cpu/kernel/asm/core/create.asm +++ b/evm/src/cpu/kernel/asm/core/create.asm @@ -159,6 +159,7 @@ after_constructor: %stack (size, ctx) -> (ctx, @SEGMENT_RETURNDATA, 0, size) // context, segment, offset, len KECCAK_GENERAL // stack: codehash, leftover_gas, success, address, kexit_info + %observe_new_contract DUP4 // stack: address, codehash, leftover_gas, success, address, kexit_info %set_codehash @@ -189,7 +190,7 @@ after_constructor: // Pre stack: addr, codehash, redest // Post stack: (empty) // TODO: Should it be copy-on-write (with make_account_copy) instead of mutating the trie? -set_codehash: +global set_codehash: // stack: addr, codehash, retdest %mpt_read_state_trie // stack: account_ptr, codehash, retdest @@ -208,3 +209,20 @@ set_codehash: %num_bytes_to_num_words %mul_const(@INITCODE_WORD_COST) %charge_gas %endmacro + + +// This should be called whenever a new contract is created. +// It does nothing, but just provides a single hook where code can react to newly created contracts. +// When called, the code corresponding to `codehash` should be stored in the return data. +// Pre stack: codehash, retdest +// Post stack: codehash +global observe_new_contract: + // stack codehash, retdest + SWAP1 JUMP + +%macro observe_new_contract + %stack (codehash) -> (codehash, %%after) + %jump(observe_new_contract) +%%after: + // stack: codehash +%endmacro diff --git a/evm/src/cpu/kernel/asm/core/process_txn.asm b/evm/src/cpu/kernel/asm/core/process_txn.asm index 3e16bbd4..a7ccf864 100644 --- a/evm/src/cpu/kernel/asm/core/process_txn.asm +++ b/evm/src/cpu/kernel/asm/core/process_txn.asm @@ -158,6 +158,19 @@ global process_contract_creation_txn_after_constructor: DUP2 DUP2 LT %jumpi(panic) // TODO: need to revert changes here. // stack: leftover_gas, codedeposit_cost, new_ctx, address, retdest SUB + + // Store the code hash of the new contract. + // stack: leftover_gas, new_ctx, address, retdest + GET_CONTEXT + %returndatasize + %stack (size, ctx) -> (ctx, @SEGMENT_RETURNDATA, 0, size) // context, segment, offset, len + KECCAK_GENERAL + // stack: codehash, leftover_gas, new_ctx, address, retdest + %observe_new_contract + DUP4 + // stack: address, codehash, leftover_gas, new_ctx, address, retdest + %set_codehash + // stack: leftover_gas, new_ctx, address, retdest %pay_coinbase_and_refund_sender // TODO: Delete accounts in self-destruct list and empty touched addresses. diff --git a/evm/src/generation/state.rs b/evm/src/generation/state.rs index 49c11611..c0c03e28 100644 --- a/evm/src/generation/state.rs +++ b/evm/src/generation/state.rs @@ -5,10 +5,12 @@ use keccak_hash::keccak; use plonky2::field::types::Field; use crate::cpu::kernel::aggregator::KERNEL; +use crate::cpu::kernel::constants::context_metadata::ContextMetadata; use crate::generation::mpt::all_mpt_prover_inputs_reversed; use crate::generation::rlp::all_rlp_prover_inputs_reversed; use crate::generation::GenerationInputs; -use crate::witness::memory::MemoryState; +use crate::memory::segments::Segment; +use crate::witness::memory::{MemoryAddress, MemoryState}; use crate::witness::state::RegistersState; use crate::witness::traces::{TraceCheckpoint, Traces}; use crate::witness::util::stack_peek; @@ -83,6 +85,10 @@ impl GenerationState { let tip_h256 = H256::from_uint(&tip_u256); let tip_h160 = H160::from(tip_h256); self.observe_address(tip_h160); + } else if dst == KERNEL.global_labels["observe_new_contract"] { + let tip_u256 = stack_peek(self, 0).expect("Empty stack"); + let tip_h256 = H256::from_uint(&tip_u256); + self.observe_contract(tip_h256); } } @@ -93,6 +99,30 @@ impl GenerationState { self.state_key_to_address.insert(state_key, address); } + /// Observe the given code hash and store the associated code. + /// When called, the code corresponding to `codehash` should be stored in the return data. + pub fn observe_contract(&mut self, codehash: H256) { + if self.inputs.contract_code.contains_key(&codehash) { + return; // Return early if the code hash has already been observed. + } + + let ctx = self.registers.context; + let returndata_size_addr = MemoryAddress::new( + ctx, + Segment::ContextMetadata, + ContextMetadata::ReturndataSize as usize, + ); + let returndata_size = self.memory.get(returndata_size_addr).as_usize(); + let code = self.memory.contexts[ctx].segments[Segment::Returndata as usize].content + [..returndata_size] + .iter() + .map(|x| x.as_u32() as u8) + .collect::>(); + debug_assert_eq!(keccak(&code), codehash); + + self.inputs.contract_code.insert(codehash, code); + } + pub fn checkpoint(&self) -> GenerationStateCheckpoint { GenerationStateCheckpoint { registers: self.registers, From 1eba893e61e6e09e9402d86be7b38b38ae52149b Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 24 Apr 2023 11:25:38 -0700 Subject: [PATCH 19/20] mload_packing macro --- evm/src/cpu/kernel/asm/memory/packing.asm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/evm/src/cpu/kernel/asm/memory/packing.asm b/evm/src/cpu/kernel/asm/memory/packing.asm index f12c7b17..8f03ea3a 100644 --- a/evm/src/cpu/kernel/asm/memory/packing.asm +++ b/evm/src/cpu/kernel/asm/memory/packing.asm @@ -43,6 +43,12 @@ mload_packing_return: %stack (packed_value, addr: 3, len, retdest) -> (retdest, packed_value) JUMP +%macro mload_packing + %stack (addr: 3, len) -> (addr, len, %%after) + %jump(mload_packing) +%%after: +%endmacro + // Pre stack: context, segment, offset, value, len, retdest // Post stack: offset' global mstore_unpacking: From 67a3edb2f16dac392257c7879363d8490a9e5239 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Wed, 26 Apr 2023 06:26:41 +0200 Subject: [PATCH 20/20] Precompiles exist (#1008) * Precompiles exist * Fix --- .../cpu/kernel/asm/core/precompiles/main.asm | 4 +--- evm/src/cpu/kernel/asm/core/util.asm | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/evm/src/cpu/kernel/asm/core/precompiles/main.asm b/evm/src/cpu/kernel/asm/core/precompiles/main.asm index df9b77ec..ec33cea8 100644 --- a/evm/src/cpu/kernel/asm/core/precompiles/main.asm +++ b/evm/src/cpu/kernel/asm/core/precompiles/main.asm @@ -35,9 +35,7 @@ global pop_and_return_success: // stack: retdest %mload_txn_field(@TXN_FIELD_TO) // stack: addr, retdest - DUP1 %ge_const(@ECREC) DUP2 %le_const(@BLAKE2_F) - // stack: addr<=9, addr>=1, addr, retdest - MUL // Cheaper than AND + DUP1 %is_precompile %jumpi(handle_precompiles_from_eoa) // stack: addr, retdest POP diff --git a/evm/src/cpu/kernel/asm/core/util.asm b/evm/src/cpu/kernel/asm/core/util.asm index a8e41a7b..04989459 100644 --- a/evm/src/cpu/kernel/asm/core/util.asm +++ b/evm/src/cpu/kernel/asm/core/util.asm @@ -28,11 +28,24 @@ // stack: to == 0 %endmacro +%macro is_precompile + // stack: addr + DUP1 %ge_const(@ECREC) SWAP1 %le_const(@BLAKE2_F) + // stack: addr>=1, addr<=9 + MUL // Cheaper than AND +%endmacro + // Returns 1 if the account is non-existent, 0 otherwise. %macro is_non_existent // stack: addr - %mpt_read_state_trie - ISZERO + DUP1 + // stack: addr, addr + %mpt_read_state_trie ISZERO + SWAP1 + // stack: addr, zero_state_trie + %is_precompile ISZERO + // stack: not_precompile, zero_state_trie + MUL // Cheaper than AND %endmacro // Returns 1 if the account is empty, 0 otherwise. @@ -65,5 +78,5 @@ // stack: addr DUP1 %is_non_existent SWAP1 %is_empty - ADD // OR + OR %endmacro