From f23159872c7f43a8ee4c199c7221fc7f2144cd9b Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Tue, 17 Dec 2024 21:26:23 +0100 Subject: [PATCH 01/54] Update Linea Besu to 24.12-delivery41 (#1668) Signed-off-by: Fabio Di Fabio --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9dff1f5f6..f6f87cceb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=0.8.0-rc8 -besuVersion=24.12-delivery40 +besuVersion=24.12-delivery41 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ From ffd428fdd5fd7b5fcf618c7a7d2864e81f19f4bc Mon Sep 17 00:00:00 2001 From: David Pearce Date: Wed, 18 Dec 2024 21:19:57 +1300 Subject: [PATCH 02/54] fix: use self hosted runner for blockchain tests (#1620) * Update Gradle to v8.11.1 This updates the gradle wrapper (i.e. gradlew) to version 8.11.1. This is currently the latest version of gradle. * Reduce `REFERENCE_TESTS_PARALLELISM` This number is set too high for the given runner. I've reduced it to just `1` for now to try and get things working again. Subsequently we can try incrementing this to find the sweet spot. * Specify `GOMEMLIMIT` * Tweak memory settings This tweaks the memory settings to facilitate better performance on the CI server. In fact, it lowers the amount of memory available. This is because we don't want Java and Go competing for the same amount of memory. Furthermore, we now know that all of the tests can be completed on a machine with just 32Gb RAM. --- .../workflows/reference-blockchain-tests.yml | 8 ++-- gradle/wrapper/gradle-wrapper.jar | Bin 60756 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 35 +++++++++++------- gradlew.bat | 21 ++++++----- reference-tests/build.gradle | 2 +- 6 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 3fc3dc799..10b559598 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -43,7 +43,7 @@ jobs: run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd .. - name: Generate block chain reference tests - run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true + run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.caching=true env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: fields,expand,expand,expand @@ -63,10 +63,10 @@ jobs: run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json - name: Run reference blockchain tests - run: ./gradlew referenceBlockchainTests -x spotlessCheck - timeout-minutes: 180 + run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck + timeout-minutes: 360 env: - REFERENCE_TESTS_PARALLELISM: 7 + REFERENCE_TESTS_PARALLELISM: 2 JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f090a2944b7473328c07c9755baa3196..e6441136f3d4ba8a0da8d277868979cfbc8ad796 100644 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n@00IL3?^hro$gg*4VI_WAaTyVM5Foj~O|-84 z$;06hMwt*rV;^8iB z1~&0XWpYJmG?Ts^K9PC62H*`G}xom%S%yq|xvG~FIfP=9*f zZoDRJBm*Y0aId=qJ?7dyb)6)JGWGwe)MHeNSzhi)Ko6J<-m@v=a%NsP537lHe0R* z`If4$aaBA#S=w!2z&m>{lpTy^Lm^mg*3?M&7HFv}7K6x*cukLIGX;bQG|QWdn{%_6 zHnwBKr84#B7Z+AnBXa16a?or^R?+>$4`}{*a_>IhbjvyTtWkHw)|ay)ahWUd-qq$~ zMbh6roVsj;_qnC-R{G+Cy6bApVOinSU-;(DxUEl!i2)1EeQ9`hrfqj(nKI7?Z>Xur zoJz-a`PxkYit1HEbv|jy%~DO^13J-ut986EEG=66S}D3!L}Efp;Bez~7tNq{QsUMm zh9~(HYg1pA*=37C0}n4g&bFbQ+?-h-W}onYeE{q;cIy%eZK9wZjSwGvT+&Cgv z?~{9p(;bY_1+k|wkt_|N!@J~aoY@|U_RGoWX<;p{Nu*D*&_phw`8jYkMNpRTWx1H* z>J-Mi_!`M468#5Aix$$u1M@rJEIOc?k^QBc?T(#=n&*5eS#u*Y)?L8Ha$9wRWdH^3D4|Ps)Y?m0q~SiKiSfEkJ!=^`lJ(%W3o|CZ zSrZL-Xxc{OrmsQD&s~zPfNJOpSZUl%V8tdG%ei}lQkM+z@-4etFPR>GOH9+Y_F<3=~SXln9Kb-o~f>2a6Xz@AS3cn^;c_>lUwlK(n>z?A>NbC z`Ud8^aQy>wy=$)w;JZzA)_*Y$Z5hU=KAG&htLw1Uh00yE!|Nu{EZkch zY9O6x7Y??>!7pUNME*d!=R#s)ghr|R#41l!c?~=3CS8&zr6*aA7n9*)*PWBV2w+&I zpW1-9fr3j{VTcls1>ua}F*bbju_Xq%^v;-W~paSqlf zolj*dt`BBjHI)H9{zrkBo=B%>8}4jeBO~kWqO!~Thi!I1H(in=n^fS%nuL=X2+s!p}HfTU#NBGiwEBF^^tKU zbhhv+0dE-sbK$>J#t-J!B$TMgN@Wh5wTtK2BG}4BGfsZOoRUS#G8Cxv|6EI*n&Xxq zt{&OxCC+BNqz$9b0WM7_PyBJEVObHFh%%`~!@MNZlo*oXDCwDcFwT~Rls!aApL<)^ zbBftGKKBRhB!{?fX@l2_y~%ygNFfF(XJzHh#?`WlSL{1lKT*gJM zs>bd^H9NCxqxn(IOky5k-wALFowQr(gw%|`0991u#9jXQh?4l|l>pd6a&rx|v=fPJ z1mutj{YzpJ_gsClbWFk(G}bSlFi-6@mwoQh-XeD*j@~huW4(8ub%^I|azA)h2t#yG z7e_V_<4jlM3D(I+qX}yEtqj)cpzN*oCdYHa!nm%0t^wHm)EmFP*|FMw!tb@&`G-u~ zK)=Sf6z+BiTAI}}i{*_Ac$ffr*Wrv$F7_0gJkjx;@)XjYSh`RjAgrCck`x!zP>Ifu z&%he4P|S)H*(9oB4uvH67^0}I-_ye_!w)u3v2+EY>eD3#8QR24<;7?*hj8k~rS)~7 zSXs5ww)T(0eHSp$hEIBnW|Iun<_i`}VE0Nc$|-R}wlSIs5pV{g_Dar(Zz<4X3`W?K z6&CAIl4U(Qk-tTcK{|zYF6QG5ArrEB!;5s?tW7 zrE3hcFY&k)+)e{+YOJ0X2uDE_hd2{|m_dC}kgEKqiE9Q^A-+>2UonB+L@v3$9?AYw zVQv?X*pK;X4Ovc6Ev5Gbg{{Eu*7{N3#0@9oMI~}KnObQE#Y{&3mM4`w%wN+xrKYgD zB-ay0Q}m{QI;iY`s1Z^NqIkjrTlf`B)B#MajZ#9u41oRBC1oM1vq0i|F59> z#StM@bHt|#`2)cpl_rWB($DNJ3Lap}QM-+A$3pe}NyP(@+i1>o^fe-oxX#Bt`mcQc zb?pD4W%#ep|3%CHAYnr*^M6Czg>~L4?l16H1OozM{P*en298b+`i4$|w$|4AHbzqB zHpYUsHZET$Z0ztC;U+0*+amF!@PI%^oUIZy{`L{%O^i{Xk}X0&nl)n~tVEpcAJSJ} zverw15zP1P-O8h9nd!&hj$zuwjg?DoxYIw{jWM zW5_pj+wFy8Tsa9g<7Qa21WaV&;ejoYflRKcz?#fSH_)@*QVlN2l4(QNk| z4aPnv&mrS&0|6NHq05XQw$J^RR9T{3SOcMKCXIR1iSf+xJ0E_Wv?jEc*I#ZPzyJN2 zUG0UOXHl+PikM*&g$U@g+KbG-RY>uaIl&DEtw_Q=FYq?etc!;hEC_}UX{eyh%dw2V zTTSlap&5>PY{6I#(6`j-9`D&I#|YPP8a;(sOzgeKDWsLa!i-$frD>zr-oid!Hf&yS z!i^cr&7tN}OOGmX2)`8k?Tn!!4=tz~3hCTq_9CdiV!NIblUDxHh(FJ$zs)B2(t5@u z-`^RA1ShrLCkg0)OhfoM;4Z{&oZmAec$qV@ zGQ(7(!CBk<5;Ar%DLJ0p0!ResC#U<+3i<|vib1?{5gCebG7$F7URKZXuX-2WgF>YJ^i zMhHDBsh9PDU8dlZ$yJKtc6JA#y!y$57%sE>4Nt+wF1lfNIWyA`=hF=9Gj%sRwi@vd z%2eVV3y&dvAgyuJ=eNJR+*080dbO_t@BFJO<@&#yqTK&+xc|FRR;p;KVk@J3$S{p` zGaMj6isho#%m)?pOG^G0mzOAw0z?!AEMsv=0T>WWcE>??WS=fII$t$(^PDPMU(P>o z_*0s^W#|x)%tx8jIgZY~A2yG;US0m2ZOQt6yJqW@XNY_>_R7(Nxb8Ged6BdYW6{prd!|zuX$@Q2o6Ona8zzYC1u!+2!Y$Jc9a;wy+pXt}o6~Bu1oF1c zp7Y|SBTNi@=I(K%A60PMjM#sfH$y*c{xUgeSpi#HB`?|`!Tb&-qJ3;vxS!TIzuTZs-&%#bAkAyw9m4PJgvey zM5?up*b}eDEY+#@tKec)-c(#QF0P?MRlD1+7%Yk*jW;)`f;0a-ZJ6CQA?E%>i2Dt7T9?s|9ZF|KP4;CNWvaVKZ+Qeut;Jith_y{v*Ny6Co6!8MZx;Wgo z=qAi%&S;8J{iyD&>3CLCQdTX*$+Rx1AwA*D_J^0>suTgBMBb=*hefV+Ars#mmr+YsI3#!F@Xc1t4F-gB@6aoyT+5O(qMz*zG<9Qq*f0w^V!03rpr*-WLH}; zfM{xSPJeu6D(%8HU%0GEa%waFHE$G?FH^kMS-&I3)ycx|iv{T6Wx}9$$D&6{%1N_8 z_CLw)_9+O4&u94##vI9b-HHm_95m)fa??q07`DniVjAy`t7;)4NpeyAY(aAk(+T_O z1om+b5K2g_B&b2DCTK<>SE$Ode1DopAi)xaJjU>**AJK3hZrnhEQ9E`2=|HHe<^tv z63e(bn#fMWuz>4erc47}!J>U58%<&N<6AOAewyzNTqi7hJc|X{782&cM zHZYclNbBwU6673=!ClmxMfkC$(CykGR@10F!zN1Se83LR&a~$Ht&>~43OX22mt7tcZUpa;9@q}KDX3O&Ugp6< zLZLfIMO5;pTee1vNyVC$FGxzK2f>0Z-6hM82zKg44nWo|n}$Zk6&;5ry3`(JFEX$q zK&KivAe${e^5ZGc3a9hOt|!UOE&OocpVryE$Y4sPcs4rJ>>Kbi2_subQ9($2VN(3o zb~tEzMsHaBmBtaHAyES+d3A(qURgiskSSwUc9CfJ@99&MKp2sooSYZu+-0t0+L*!I zYagjOlPgx|lep9tiU%ts&McF6b0VE57%E0Ho%2oi?=Ks+5%aj#au^OBwNwhec zta6QAeQI^V!dF1C)>RHAmB`HnxyqWx?td@4sd15zPd*Fc9hpDXP23kbBenBxGeD$k z;%0VBQEJ-C)&dTAw_yW@k0u?IUk*NrkJ)(XEeI z9Y>6Vel>#s_v@=@0<{4A{pl=9cQ&Iah0iD0H`q)7NeCIRz8zx;! z^OO;1+IqoQNak&pV`qKW+K0^Hqp!~gSohcyS)?^P`JNZXw@gc6{A3OLZ?@1Uc^I2v z+X!^R*HCm3{7JPq{8*Tn>5;B|X7n4QQ0Bs79uTU%nbqOJh`nX(BVj!#f;#J+WZxx4 z_yM&1Y`2XzhfqkIMO7tB3raJKQS+H5F%o83bM+hxbQ zeeJm=Dvix$2j|b4?mDacb67v-1^lTp${z=jc1=j~QD>7c*@+1?py>%Kj%Ejp7Y-!? z8iYRUlGVrQPandAaxFfks53@2EC#0)%mrnmGRn&>=$H$S8q|kE_iWko4`^vCS2aWg z#!`RHUGyOt*k?bBYu3*j3u0gB#v(3tsije zgIuNNWNtrOkx@Pzs;A9un+2LX!zw+p3_NX^Sh09HZAf>m8l@O*rXy_82aWT$Q>iyy zqO7Of)D=wcSn!0+467&!Hl))eff=$aneB?R!YykdKW@k^_uR!+Q1tR)+IJb`-6=jj zymzA>Sv4>Z&g&WWu#|~GcP7qP&m*w-S$)7Xr;(duqCTe7p8H3k5>Y-n8438+%^9~K z3r^LIT_K{i7DgEJjIocw_6d0!<;wKT`X;&vv+&msmhAAnIe!OTdybPctzcEzBy88_ zWO{6i4YT%e4^WQZB)KHCvA(0tS zHu_Bg+6Ko%a9~$EjRB90`P(2~6uI@SFibxct{H#o&y40MdiXblu@VFXbhz>Nko;7R z70Ntmm-FePqhb%9gL+7U8@(ch|JfH5Fm)5${8|`Lef>LttM_iww6LW2X61ldBmG0z zax3y)njFe>j*T{i0s8D4=L>X^j0)({R5lMGVS#7(2C9@AxL&C-lZQx~czI7Iv+{%1 z2hEG>RzX4S8x3v#9sgGAnPzptM)g&LB}@%E>fy0vGSa(&q0ch|=ncKjNrK z`jA~jObJhrJ^ri|-)J^HUyeZXz~XkBp$VhcTEcTdc#a2EUOGVX?@mYx#Vy*!qO$Jv zQ4rgOJ~M*o-_Wptam=~krnmG*p^j!JAqoQ%+YsDFW7Cc9M%YPiBOrVcD^RY>m9Pd< zu}#9M?K{+;UIO!D9qOpq9yxUquQRmQNMo0pT`@$pVt=rMvyX)ph(-CCJLvUJy71DI zBk7oc7)-%ngdj~s@76Yse3L^gV0 z2==qfp&Q~L(+%RHP0n}+xH#k(hPRx(!AdBM$JCfJ5*C=K3ts>P?@@SZ_+{U2qFZb>4kZ{Go37{# zSQc+-dq*a-Vy4?taS&{Ht|MLRiS)Sn14JOONyXqPNnpq&2y~)6wEG0oNy>qvod$FF z`9o&?&6uZjhZ4_*5qWVrEfu(>_n2Xi2{@Gz9MZ8!YmjYvIMasE9yVQL10NBrTCczq zcTY1q^PF2l!Eraguf{+PtHV3=2A?Cu&NN&a8V(y;q(^_mFc6)%Yfn&X&~Pq zU1?qCj^LF(EQB1F`8NxNjyV%fde}dEa(Hx=r7$~ts2dzDwyi6ByBAIx$NllB4%K=O z$AHz1<2bTUb>(MCVPpK(E9wlLElo(aSd(Os)^Raum`d(g9Vd_+Bf&V;l=@mM=cC>) z)9b0enb)u_7V!!E_bl>u5nf&Rl|2r=2F3rHMdb7y9E}}F82^$Rf+P8%dKnOeKh1vs zhH^P*4Ydr^$)$h@4KVzxrHyy#cKmWEa9P5DJ|- zG;!Qi35Tp7XNj60=$!S6U#!(${6hyh7d4q=pF{`0t|N^|L^d8pD{O9@tF~W;#Je*P z&ah%W!KOIN;SyAEhAeTafJ4uEL`(RtnovM+cb(O#>xQnk?dzAjG^~4$dFn^<@-Na3 z395;wBnS{t*H;Jef2eE!2}u5Ns{AHj>WYZDgQJt8v%x?9{MXqJsGP|l%OiZqQ1aB! z%E=*Ig`(!tHh>}4_z5IMpg{49UvD*Pp9!pxt_gdAW%sIf3k6CTycOT1McPl=_#0?8 zVjz8Hj*Vy9c5-krd-{BQ{6Xy|P$6LJvMuX$* zA+@I_66_ET5l2&gk9n4$1M3LN8(yEViRx&mtd#LD}AqEs?RW=xKC(OCWH;~>(X6h!uDxXIPH06xh z*`F4cVlbDP`A)-fzf>MuScYsmq&1LUMGaQ3bRm6i7OsJ|%uhTDT zlvZA1M}nz*SalJWNT|`dBm1$xlaA>CCiQ zK`xD-RuEn>-`Z?M{1%@wewf#8?F|(@1e0+T4>nmlSRrNK5f)BJ2H*$q(H>zGD0>eL zQ!tl_Wk)k*e6v^m*{~A;@6+JGeWU-q9>?+L_#UNT%G?4&BnOgvm9@o7l?ov~XL+et zbGT)|G7)KAeqb=wHSPk+J1bdg7N3$vp(ekjI1D9V$G5Cj!=R2w=3*4!z*J-r-cyeb zd(i2KmX!|Lhey!snRw z?#$Gu%S^SQEKt&kep)up#j&9}e+3=JJBS(s>MH+|=R(`8xK{mmndWo_r`-w1#SeRD&YtAJ#GiVI*TkQZ}&aq<+bU2+coU3!jCI6E+Ad_xFW*ghnZ$q zAoF*i&3n1j#?B8x;kjSJD${1jdRB;)R*)Ao!9bd|C7{;iqDo|T&>KSh6*hCD!rwv= zyK#F@2+cv3=|S1Kef(E6Niv8kyLVLX&e=U;{0x{$tDfShqkjUME>f8d(5nzSkY6@! z^-0>DM)wa&%m#UF1F?zR`8Y3X#tA!*7Q$P3lZJ%*KNlrk_uaPkxw~ zxZ1qlE;Zo;nb@!SMazSjM>;34ROOoygo%SF);LL>rRonWwR>bmSd1XD^~sGSu$Gg# zFZ`|yKU0%!v07dz^v(tY%;So(e`o{ZYTX`hm;@b0%8|H>VW`*cr8R%3n|ehw2`(9B+V72`>SY}9^8oh$En80mZK9T4abVG*to;E z1_S6bgDOW?!Oy1LwYy=w3q~KKdbNtyH#d24PFjX)KYMY93{3-mPP-H>@M-_>N~DDu zENh~reh?JBAK=TFN-SfDfT^=+{w4ea2KNWXq2Y<;?(gf(FgVp8Zp-oEjKzB%2Iqj;48GmY3h=bcdYJ}~&4tS`Q1sb=^emaW$IC$|R+r-8V- zf0$gGE(CS_n4s>oicVk)MfvVg#I>iDvf~Ov8bk}sSxluG!6#^Z_zhB&U^`eIi1@j( z^CK$z^stBHtaDDHxn+R;3u+>Lil^}fj?7eaGB z&5nl^STqcaBxI@v>%zG|j))G(rVa4aY=B@^2{TFkW~YP!8!9TG#(-nOf^^X-%m9{Z zCC?iC`G-^RcBSCuk=Z`(FaUUe?hf3{0C>>$?Vs z`2Uud9M+T&KB6o4o9kvdi^Q=Bw!asPdxbe#W-Oaa#_NP(qpyF@bVxv5D5))srkU#m zj_KA+#7sqDn*Ipf!F5Byco4HOSd!Ui$l94|IbW%Ny(s1>f4|Mv^#NfB31N~kya9!k zWCGL-$0ZQztBate^fd>R!hXY_N9ZjYp3V~4_V z#eB)Kjr8yW=+oG)BuNdZG?jaZlw+l_ma8aET(s+-x+=F-t#Qoiuu1i`^x8Sj>b^U} zs^z<()YMFP7CmjUC@M=&lA5W7t&cxTlzJAts*%PBDAPuqcV5o7HEnqjif_7xGt)F% zGx2b4w{@!tE)$p=l3&?Bf#`+!-RLOleeRk3 z7#pF|w@6_sBmn1nECqdunmG^}pr5(ZJQVvAt$6p3H(16~;vO>?sTE`Y+mq5YP&PBo zvq!7#W$Gewy`;%6o^!Dtjz~x)T}Bdk*BS#=EY=ODD&B=V6TD2z^hj1m5^d6s)D*wk zu$z~D7QuZ2b?5`p)E8e2_L38v3WE{V`bVk;6fl#o2`) z99JsWhh?$oVRn@$S#)uK&8DL8>An0&S<%V8hnGD7Z^;Y(%6;^9!7kDQ5bjR_V+~wp zfx4m3z6CWmmZ<8gDGUyg3>t8wgJ5NkkiEm^(sedCicP^&3D%}6LtIUq>mXCAt{9eF zNXL$kGcoUTf_Lhm`t;hD-SE)m=iBnxRU(NyL}f6~1uH)`K!hmYZjLI%H}AmEF5RZt z06$wn63GHnApHXZZJ}s^s)j9(BM6e*7IBK6Bq(!)d~zR#rbxK9NVIlgquoMq z=eGZ9NR!SEqP6=9UQg#@!rtbbSBUM#ynF);zKX+|!Zm}*{H z+j=d?aZ2!?@EL7C~%B?6ouCKLnO$uWn;Y6Xz zX8dSwj732u(o*U3F$F=7xwxm>E-B+SVZH;O-4XPuPkLSt_?S0)lb7EEg)Mglk0#eS z9@jl(OnH4juMxY+*r03VDfPx_IM!Lmc(5hOI;`?d37f>jPP$?9jQQIQU@i4vuG6MagEoJrQ=RD7xt@8E;c zeGV*+Pt+t$@pt!|McETOE$9k=_C!70uhwRS9X#b%ZK z%q(TIUXSS^F0`4Cx?Rk07C6wI4!UVPeI~-fxY6`YH$kABdOuiRtl73MqG|~AzZ@iL&^s?24iS;RK_pdlWkhcF z@Wv-Om(Aealfg)D^adlXh9Nvf~Uf@y;g3Y)i(YP zEXDnb1V}1pJT5ZWyw=1i+0fni9yINurD=EqH^ciOwLUGi)C%Da)tyt=zq2P7pV5-G zR7!oq28-Fgn5pW|nlu^b!S1Z#r7!Wtr{5J5PQ>pd+2P7RSD?>(U7-|Y z7ZQ5lhYIl_IF<9?T9^IPK<(Hp;l5bl5tF9>X-zG14_7PfsA>6<$~A338iYRT{a@r_ zuXBaT=`T5x3=s&3=RYx6NgG>No4?5KFBVjE(swfcivcIpPQFx5l+O;fiGsOrl5teR z_Cm+;PW}O0Dwe_(4Z@XZ)O0W-v2X><&L*<~*q3dg;bQW3g7)a#3KiQP>+qj|qo*Hk z?57>f2?f@`=Fj^nkDKeRkN2d$Z@2eNKpHo}ksj-$`QKb6n?*$^*%Fb3_Kbf1(*W9K>{L$mud2WHJ=j0^=g30Xhg8$#g^?36`p1fm;;1@0Lrx+8t`?vN0ZorM zSW?rhjCE8$C|@p^sXdx z|NOHHg+fL;HIlqyLp~SSdIF`TnSHehNCU9t89yr@)FY<~hu+X`tjg(aSVae$wDG*C zq$nY(Y494R)hD!i1|IIyP*&PD_c2FPgeY)&mX1qujB1VHPG9`yFQpLFVQ0>EKS@Bp zAfP5`C(sWGLI?AC{XEjLKR4FVNw(4+9b?kba95ukgR1H?w<8F7)G+6&(zUhIE5Ef% z=fFkL3QKA~M@h{nzjRq!Y_t!%U66#L8!(2-GgFxkD1=JRRqk=n%G(yHKn%^&$dW>; zSjAcjETMz1%205se$iH_)ZCpfg_LwvnsZQAUCS#^FExp8O4CrJb6>JquNV@qPq~3A zZ<6dOU#6|8+fcgiA#~MDmcpIEaUO02L5#T$HV0$EMD94HT_eXLZ2Zi&(! z&5E>%&|FZ`)CN10tM%tLSPD*~r#--K(H-CZqIOb99_;m|D5wdgJ<1iOJz@h2Zkq?} z%8_KXb&hf=2Wza(Wgc;3v3TN*;HTU*q2?#z&tLn_U0Nt!y>Oo>+2T)He6%XuP;fgn z-G!#h$Y2`9>Jtf}hbVrm6D70|ERzLAU>3zoWhJmjWfgM^))T+2u$~5>HF9jQDkrXR z=IzX36)V75PrFjkQ%TO+iqKGCQ-DDXbaE;C#}!-CoWQx&v*vHfyI>$HNRbpvm<`O( zlx9NBWD6_e&J%Ous4yp~s6)Ghni!I6)0W;9(9$y1wWu`$gs<$9Mcf$L*piP zPR0Av*2%ul`W;?-1_-5Zy0~}?`e@Y5A&0H!^ApyVTT}BiOm4GeFo$_oPlDEyeGBbh z1h3q&Dx~GmUS|3@4V36&$2uO8!Yp&^pD7J5&TN{?xphf*-js1fP?B|`>p_K>lh{ij zP(?H%e}AIP?_i^f&Li=FDSQ`2_NWxL+BB=nQr=$ zHojMlXNGauvvwPU>ZLq!`bX-5F4jBJ&So{kE5+ms9UEYD{66!|k~3vsP+mE}x!>%P za98bAU0!h0&ka4EoiDvBM#CP#dRNdXJcb*(%=<(g+M@<)DZ!@v1V>;54En?igcHR2 zhubQMq}VSOK)onqHfczM7YA@s=9*ow;k;8)&?J3@0JiGcP! zP#00KZ1t)GyZeRJ=f0^gc+58lc4Qh*S7RqPIC6GugG1gXe$LIQMRCo8cHf^qXgAa2 z`}t>u2Cq1CbSEpLr~E=c7~=Qkc9-vLE%(v9N*&HF`(d~(0`iukl5aQ9u4rUvc8%m) zr2GwZN4!s;{SB87lJB;veebPmqE}tSpT>+`t?<457Q9iV$th%i__Z1kOMAswFldD6 ztbOvO337S5o#ZZgN2G99_AVqPv!?Gmt3pzgD+Hp3QPQ`9qJ(g=kjvD+fUSS3upJn! zqoG7acIKEFRX~S}3|{EWT$kdz#zrDlJU(rPkxjws_iyLKU8+v|*oS_W*-guAb&Pj1 z35Z`3z<&Jb@2Mwz=KXucNYdY#SNO$tcVFr9KdKm|%^e-TXzs6M`PBper%ajkrIyUe zp$vVxVs9*>Vp4_1NC~Zg)WOCPmOxI1V34QlG4!aSFOH{QqSVq1^1)- z0P!Z?tT&E-ll(pwf0?=F=yOzik=@nh1Clxr9}Vij89z)ePDSCYAqw?lVI?v?+&*zH z)p$CScFI8rrwId~`}9YWPFu0cW1Sf@vRELs&cbntRU6QfPK-SO*mqu|u~}8AJ!Q$z znzu}50O=YbjwKCuSVBs6&CZR#0FTu)3{}qJJYX(>QPr4$RqWiwX3NT~;>cLn*_&1H zaKpIW)JVJ>b{uo2oq>oQt3y=zJjb%fU@wLqM{SyaC6x2snMx-}ivfU<1- znu1Lh;i$3Tf$Kh5Uk))G!D1UhE8pvx&nO~w^fG)BC&L!_hQk%^p`Kp@F{cz>80W&T ziOK=Sq3fdRu*V0=S53rcIfWFazI}Twj63CG(jOB;$*b`*#B9uEnBM`hDk*EwSRdwP8?5T?xGUKs=5N83XsR*)a4|ijz|c{4tIU+4j^A5C<#5 z*$c_d=5ml~%pGxw#?*q9N7aRwPux5EyqHVkdJO=5J>84!X6P>DS8PTTz>7C#FO?k#edkntG+fJk8ZMn?pmJSO@`x-QHq;7^h6GEXLXo1TCNhH z8ZDH{*NLAjo3WM`xeb=X{((uv3H(8&r8fJJg_uSs_%hOH%JDD?hu*2NvWGYD+j)&` zz#_1%O1wF^o5ryt?O0n;`lHbzp0wQ?rcbW(F1+h7_EZZ9{>rePvLAPVZ_R|n@;b$;UchU=0j<6k8G9QuQf@76oiE*4 zXOLQ&n3$NR#p4<5NJMVC*S);5x2)eRbaAM%VxWu9ohlT;pGEk7;002enCbQ>2r-us z3#bpXP9g|mE`65VrN`+3mC)M(eMj~~eOf)do<@l+fMiTR)XO}422*1SL{wyY(%oMpBgJagtiDf zz>O6(m;};>Hi=t8o{DVC@YigqS(Qh+ix3Rwa9aliH}a}IlOCW1@?%h_bRbq-W{KHF z%Vo?-j@{Xi@=~Lz5uZP27==UGE15|g^0gzD|3x)SCEXrx`*MP^FDLl%pOi~~Il;dc z^hrwp9sYeT7iZ)-ajKy@{a`kr0-5*_!XfBpXwEcFGJ;%kV$0Nx;apKrur zJN2J~CAv{Zjj%FolyurtW8RaFmpn&zKJWL>(0;;+q(%(Hx!GMW4AcfP0YJ*Vz!F4g z!ZhMyj$BdXL@MlF%KeInmPCt~9&A!;cRw)W!Hi@0DY(GD_f?jeV{=s=cJ6e}JktJw zQORnxxj3mBxfrH=x{`_^Z1ddDh}L#V7i}$njUFRVwOX?qOTKjfPMBO4y(WiU<)epb zvB9L=%jW#*SL|Nd_G?E*_h1^M-$PG6Pc_&QqF0O-FIOpa4)PAEPsyvB)GKasmBoEt z?_Q2~QCYGH+hW31x-B=@5_AN870vY#KB~3a*&{I=f);3Kv7q4Q7s)0)gVYx2#Iz9g(F2;=+Iy4 z6KI^8GJ6D@%tpS^8boU}zpi=+(5GfIR)35PzrbuXeL1Y1N%JK7PG|^2k3qIqHfX;G zQ}~JZ-UWx|60P5?d1e;AHx!_;#PG%d=^X(AR%i`l0jSpYOpXoKFW~7ip7|xvN;2^? zsYC9fanpO7rO=V7+KXqVc;Q5z%Bj})xHVrgoR04sA2 zl~DAwv=!(()DvH*=lyhIlU^hBkA0$e*7&fJpB0|oB7)rqGK#5##2T`@_I^|O2x4GO z;xh6ROcV<9>?e0)MI(y++$-ksV;G;Xe`lh76T#Htuia+(UrIXrf9?

L(tZ$0BqX1>24?V$S+&kLZ`AodQ4_)P#Q3*4xg8}lMV-FLwC*cN$< zt65Rf%7z41u^i=P*qO8>JqXPrinQFapR7qHAtp~&RZ85$>ob|Js;GS^y;S{XnGiBc zGa4IGvDl?x%gY`vNhv8wgZnP#UYI-w*^4YCZnxkF85@ldepk$&$#3EAhrJY0U)lR{F6sM3SONV^+$;Zx8BD&Eku3K zKNLZyBni3)pGzU0;n(X@1fX8wYGKYMpLmCu{N5-}epPDxClPFK#A@02WM3!myN%bkF z|GJ4GZ}3sL{3{qXemy+#Uk{4>Kf8v11;f8I&c76+B&AQ8udd<8gU7+BeWC`akUU~U zgXoxie>MS@rBoyY8O8Tc&8id!w+_ooxcr!1?#rc$-|SBBtH6S?)1e#P#S?jFZ8u-Bs&k`yLqW|{j+%c#A4AQ>+tj$Y z^CZajspu$F%73E68Lw5q7IVREED9r1Ijsg#@DzH>wKseye>hjsk^{n0g?3+gs@7`i zHx+-!sjLx^fS;fY!ERBU+Q zVJ!e0hJH%P)z!y%1^ZyG0>PN@5W~SV%f>}c?$H8r;Sy-ui>aruVTY=bHe}$e zi&Q4&XK!qT7-XjCrDaufT@>ieQ&4G(SShUob0Q>Gznep9fR783jGuUynAqc6$pYX; z7*O@@JW>O6lKIk0G00xsm|=*UVTQBB`u1f=6wGAj%nHK_;Aqmfa!eAykDmi-@u%6~ z;*c!pS1@V8r@IX9j&rW&d*}wpNs96O2Ute>%yt{yv>k!6zfT6pru{F1M3P z2WN1JDYqoTB#(`kE{H676QOoX`cnqHl1Yaru)>8Ky~VU{)r#{&s86Vz5X)v15ULHA zAZDb{99+s~qI6;-dQ5DBjHJP@GYTwn;Dv&9kE<0R!d z8tf1oq$kO`_sV(NHOSbMwr=To4r^X$`sBW4$gWUov|WY?xccQJN}1DOL|GEaD_!@& z15p?Pj+>7d`@LvNIu9*^hPN)pwcv|akvYYq)ks%`G>!+!pW{-iXPZsRp8 z35LR;DhseQKWYSD`%gO&k$Dj6_6q#vjWA}rZcWtQr=Xn*)kJ9kacA=esi*I<)1>w^ zO_+E>QvjP)qiSZg9M|GNeLtO2D7xT6vsj`88sd!94j^AqxFLi}@w9!Y*?nwWARE0P znuI_7A-saQ+%?MFA$gttMV-NAR^#tjl_e{R$N8t2NbOlX373>e7Ox=l=;y#;M7asp zRCz*CLnrm$esvSb5{T<$6CjY zmZ(i{Rs_<#pWW>(HPaaYj`%YqBra=Ey3R21O7vUbzOkJJO?V`4-D*u4$Me0Bx$K(lYo`JO}gnC zx`V}a7m-hLU9Xvb@K2ymioF)vj12<*^oAqRuG_4u%(ah?+go%$kOpfb`T96P+L$4> zQ#S+sA%VbH&mD1k5Ak7^^dZoC>`1L%i>ZXmooA!%GI)b+$D&ziKrb)a=-ds9xk#~& z7)3iem6I|r5+ZrTRe_W861x8JpD`DDIYZNm{$baw+$)X^Jtjnl0xlBgdnNY}x%5za zkQ8E6T<^$sKBPtL4(1zi_Rd(tVth*3Xs!ulflX+70?gb&jRTnI8l+*Aj9{|d%qLZ+ z>~V9Z;)`8-lds*Zgs~z1?Fg?Po7|FDl(Ce<*c^2=lFQ~ahwh6rqSjtM5+$GT>3WZW zj;u~w9xwAhOc<kF}~`CJ68 z?(S5vNJa;kriPlim33{N5`C{9?NWhzsna_~^|K2k4xz1`xcui*LXL-1#Y}Hi9`Oo!zQ>x-kgAX4LrPz63uZ+?uG*84@PKq-KgQlMNRwz=6Yes) zY}>YN+qP}nwr$(CZQFjUOI=-6J$2^XGvC~EZ+vrqWaOXB$k?%Suf5k=4>AveC1aJ! ziaW4IS%F$_Babi)kA8Y&u4F7E%99OPtm=vzw$$ zEz#9rvn`Iot_z-r3MtV>k)YvErZ<^Oa${`2>MYYODSr6?QZu+be-~MBjwPGdMvGd!b!elsdi4% z`37W*8+OGulab8YM?`KjJ8e+jM(tqLKSS@=jimq3)Ea2EB%88L8CaM+aG7;27b?5` z4zuUWBr)f)k2o&xg{iZ$IQkJ+SK>lpq4GEacu~eOW4yNFLU!Kgc{w4&D$4ecm0f}~ zTTzquRW@`f0}|IILl`!1P+;69g^upiPA6F{)U8)muWHzexRenBU$E^9X-uIY2%&1w z_=#5*(nmxJ9zF%styBwivi)?#KMG96-H@hD-H_&EZiRNsfk7mjBq{L%!E;Sqn!mVX*}kXhwH6eh;b42eD!*~upVG@ z#smUqz$ICm!Y8wY53gJeS|Iuard0=;k5i5Z_hSIs6tr)R4n*r*rE`>38Pw&lkv{_r!jNN=;#?WbMj|l>cU(9trCq; z%nN~r^y7!kH^GPOf3R}?dDhO=v^3BeP5hF|%4GNQYBSwz;x({21i4OQY->1G=KFyu z&6d`f2tT9Yl_Z8YACZaJ#v#-(gcyeqXMhYGXb=t>)M@fFa8tHp2x;ODX=Ap@a5I=U z0G80^$N0G4=U(>W%mrrThl0DjyQ-_I>+1Tdd_AuB3qpYAqY54upwa3}owa|x5iQ^1 zEf|iTZxKNGRpI>34EwkIQ2zHDEZ=(J@lRaOH>F|2Z%V_t56Km$PUYu^xA5#5Uj4I4RGqHD56xT%H{+P8Ag>e_3pN$4m8n>i%OyJFPNWaEnJ4McUZPa1QmOh?t8~n& z&RulPCors8wUaqMHECG=IhB(-tU2XvHP6#NrLVyKG%Ee*mQ5Ps%wW?mcnriTVRc4J`2YVM>$ixSF2Xi+Wn(RUZnV?mJ?GRdw%lhZ+t&3s7g!~g{%m&i<6 z5{ib-<==DYG93I(yhyv4jp*y3#*WNuDUf6`vTM%c&hiayf(%=x@4$kJ!W4MtYcE#1 zHM?3xw63;L%x3drtd?jot!8u3qeqctceX3m;tWetK+>~q7Be$h>n6riK(5@ujLgRS zvOym)k+VAtyV^mF)$29Y`nw&ijdg~jYpkx%*^ z8dz`C*g=I?;clyi5|!27e2AuSa$&%UyR(J3W!A=ZgHF9OuKA34I-1U~pyD!KuRkjA zbkN!?MfQOeN>DUPBxoy5IX}@vw`EEB->q!)8fRl_mqUVuRu|C@KD-;yl=yKc=ZT0% zB$fMwcC|HE*0f8+PVlWHi>M`zfsA(NQFET?LrM^pPcw`cK+Mo0%8*x8@65=CS_^$cG{GZQ#xv($7J z??R$P)nPLodI;P!IC3eEYEHh7TV@opr#*)6A-;EU2XuogHvC;;k1aI8asq7ovoP!* z?x%UoPrZjj<&&aWpsbr>J$Er-7!E(BmOyEv!-mbGQGeJm-U2J>74>o5x`1l;)+P&~ z>}f^=Rx(ZQ2bm+YE0u=ZYrAV@apyt=v1wb?R@`i_g64YyAwcOUl=C!i>=Lzb$`tjv zOO-P#A+)t-JbbotGMT}arNhJmmGl-lyUpMn=2UacVZxmiG!s!6H39@~&uVokS zG=5qWhfW-WOI9g4!R$n7!|ViL!|v3G?GN6HR0Pt_L5*>D#FEj5wM1DScz4Jv@Sxnl zB@MPPmdI{(2D?;*wd>3#tjAirmUnQoZrVv`xM3hARuJksF(Q)wd4P$88fGYOT1p6U z`AHSN!`St}}UMBT9o7i|G`r$ zrB=s$qV3d6$W9@?L!pl0lf%)xs%1ko^=QY$ty-57=55PvP(^6E7cc zGJ*>m2=;fOj?F~yBf@K@9qwX0hA803Xw+b0m}+#a(>RyR8}*Y<4b+kpp|OS+!whP( zH`v{%s>jsQI9rd$*vm)EkwOm#W_-rLTHcZRek)>AtF+~<(did)*oR1|&~1|e36d-d zgtm5cv1O0oqgWC%Et@P4Vhm}Ndl(Y#C^MD03g#PH-TFy+7!Osv1z^UWS9@%JhswEq~6kSr2DITo59+; ze=ZC}i2Q?CJ~Iyu?vn|=9iKV>4j8KbxhE4&!@SQ^dVa-gK@YfS9xT(0kpW*EDjYUkoj! zE49{7H&E}k%5(>sM4uGY)Q*&3>{aitqdNnRJkbOmD5Mp5rv-hxzOn80QsG=HJ_atI-EaP69cacR)Uvh{G5dTpYG7d zbtmRMq@Sexey)||UpnZ?;g_KMZq4IDCy5}@u!5&B^-=6yyY{}e4Hh3ee!ZWtL*s?G zxG(A!<9o!CL+q?u_utltPMk+hn?N2@?}xU0KlYg?Jco{Yf@|mSGC<(Zj^yHCvhmyx z?OxOYoxbptDK()tsJ42VzXdINAMWL$0Gcw?G(g8TMB)Khw_|v9`_ql#pRd2i*?CZl z7k1b!jQB=9-V@h%;Cnl7EKi;Y^&NhU0mWEcj8B|3L30Ku#-9389Q+(Yet0r$F=+3p z6AKOMAIi|OHyzlHZtOm73}|ntKtFaXF2Fy|M!gOh^L4^62kGUoWS1i{9gsds_GWBc zLw|TaLP64z3z9?=R2|T6Xh2W4_F*$cq>MtXMOy&=IPIJ`;!Tw?PqvI2b*U1)25^<2 zU_ZPoxg_V0tngA0J+mm?3;OYw{i2Zb4x}NedZug!>EoN3DC{1i)Z{Z4m*(y{ov2%- zk(w>+scOO}MN!exSc`TN)!B=NUX`zThWO~M*ohqq;J2hx9h9}|s#?@eR!=F{QTrq~ zTcY|>azkCe$|Q0XFUdpFT=lTcyW##i;-e{}ORB4D?t@SfqGo_cS z->?^rh$<&n9DL!CF+h?LMZRi)qju!meugvxX*&jfD!^1XB3?E?HnwHP8$;uX{Rvp# zh|)hM>XDv$ZGg=$1{+_bA~u-vXqlw6NH=nkpyWE0u}LQjF-3NhATL@9rRxMnpO%f7 z)EhZf{PF|mKIMFxnC?*78(}{Y)}iztV12}_OXffJ;ta!fcFIVjdchyHxH=t%ci`Xd zX2AUB?%?poD6Zv*&BA!6c5S#|xn~DK01#XvjT!w!;&`lDXSJT4_j$}!qSPrb37vc{ z9^NfC%QvPu@vlxaZ;mIbn-VHA6miwi8qJ~V;pTZkKqqOii<1Cs}0i?uUIss;hM4dKq^1O35y?Yp=l4i zf{M!@QHH~rJ&X~8uATV><23zZUbs-J^3}$IvV_ANLS08>k`Td7aU_S1sLsfi*C-m1 z-e#S%UGs4E!;CeBT@9}aaI)qR-6NU@kvS#0r`g&UWg?fC7|b^_HyCE!8}nyh^~o@< zpm7PDFs9yxp+byMS(JWm$NeL?DNrMCNE!I^ko-*csB+dsf4GAq{=6sfyf4wb>?v1v zmb`F*bN1KUx-`ra1+TJ37bXNP%`-Fd`vVQFTwWpX@;s(%nDQa#oWhgk#mYlY*!d>( zE&!|ySF!mIyfING+#%RDY3IBH_fW$}6~1%!G`suHub1kP@&DoAd5~7J55;5_noPI6eLf{t;@9Kf<{aO0`1WNKd?<)C-|?C?)3s z>wEq@8=I$Wc~Mt$o;g++5qR+(6wt9GI~pyrDJ%c?gPZe)owvy^J2S=+M^ z&WhIE`g;;J^xQLVeCtf7b%Dg#Z2gq9hp_%g)-%_`y*zb; zn9`f`mUPN-Ts&fFo(aNTsXPA|J!TJ{0hZp0^;MYHLOcD=r_~~^ymS8KLCSeU3;^QzJNqS z5{5rEAv#l(X?bvwxpU;2%pQftF`YFgrD1jt2^~Mt^~G>T*}A$yZc@(k9orlCGv&|1 zWWvVgiJsCAtamuAYT~nzs?TQFt<1LSEx!@e0~@yd6$b5!Zm(FpBl;(Cn>2vF?k zOm#TTjFwd2D-CyA!mqR^?#Uwm{NBemP>(pHmM}9;;8`c&+_o3#E5m)JzfwN?(f-a4 zyd%xZc^oQx3XT?vcCqCX&Qrk~nu;fxs@JUoyVoi5fqpi&bUhQ2y!Ok2pzsFR(M(|U zw3E+kH_zmTRQ9dUMZWRE%Zakiwc+lgv7Z%|YO9YxAy`y28`Aw;WU6HXBgU7fl@dnt z-fFBV)}H-gqP!1;V@Je$WcbYre|dRdp{xt!7sL3Eoa%IA`5CAA%;Wq8PktwPdULo! z8!sB}Qt8#jH9Sh}QiUtEPZ6H0b*7qEKGJ%ITZ|vH)5Q^2m<7o3#Z>AKc%z7_u`rXA zqrCy{-{8;9>dfllLu$^M5L z-hXs))h*qz%~ActwkIA(qOVBZl2v4lwbM>9l70Y`+T*elINFqt#>OaVWoja8RMsep z6Or3f=oBnA3vDbn*+HNZP?8LsH2MY)x%c13@(XfuGR}R?Nu<|07{$+Lc3$Uv^I!MQ z>6qWgd-=aG2Y^24g4{Bw9ueOR)(9h`scImD=86dD+MnSN4$6 z^U*o_mE-6Rk~Dp!ANp#5RE9n*LG(Vg`1)g6!(XtDzsov$Dvz|Gv1WU68J$CkshQhS zCrc|cdkW~UK}5NeaWj^F4MSgFM+@fJd{|LLM)}_O<{rj z+?*Lm?owq?IzC%U%9EBga~h-cJbIu=#C}XuWN>OLrc%M@Gu~kFEYUi4EC6l#PR2JS zQUkGKrrS#6H7}2l0F@S11DP`@pih0WRkRJl#F;u{c&ZC{^$Z+_*lB)r)-bPgRFE;* zl)@hK4`tEP=P=il02x7-C7p%l=B`vkYjw?YhdJU9!P!jcmY$OtC^12w?vy3<<=tlY zUwHJ_0lgWN9vf>1%WACBD{UT)1qHQSE2%z|JHvP{#INr13jM}oYv_5#xsnv9`)UAO zuwgyV4YZ;O)eSc3(mka6=aRohi!HH@I#xq7kng?Acdg7S4vDJb6cI5fw?2z%3yR+| zU5v@Hm}vy;${cBp&@D=HQ9j7NcFaOYL zj-wV=eYF{|XTkFNM2uz&T8uH~;)^Zo!=KP)EVyH6s9l1~4m}N%XzPpduPg|h-&lL` zAXspR0YMOKd2yO)eMFFJ4?sQ&!`dF&!|niH*!^*Ml##o0M(0*uK9&yzekFi$+mP9s z>W9d%Jb)PtVi&-Ha!o~Iyh@KRuKpQ@)I~L*d`{O8!kRObjO7=n+Gp36fe!66neh+7 zW*l^0tTKjLLzr`x4`_8&on?mjW-PzheTNox8Hg7Nt@*SbE-%kP2hWYmHu#Fn@Q^J(SsPUz*|EgOoZ6byg3ew88UGdZ>9B2Tq=jF72ZaR=4u%1A6Vm{O#?@dD!(#tmR;eP(Fu z{$0O%=Vmua7=Gjr8nY%>ul?w=FJ76O2js&17W_iq2*tb!i{pt#`qZB#im9Rl>?t?0c zicIC}et_4d+CpVPx)i4~$u6N-QX3H77ez z?ZdvXifFk|*F8~L(W$OWM~r`pSk5}#F?j_5u$Obu9lDWIknO^AGu+Blk7!9Sb;NjS zncZA?qtASdNtzQ>z7N871IsPAk^CC?iIL}+{K|F@BuG2>qQ;_RUYV#>hHO(HUPpk@ z(bn~4|F_jiZi}Sad;_7`#4}EmD<1EiIxa48QjUuR?rC}^HRocq`OQPM@aHVKP9E#q zy%6bmHygCpIddPjE}q_DPC`VH_2m;Eey&ZH)E6xGeStOK7H)#+9y!%-Hm|QF6w#A( zIC0Yw%9j$s-#odxG~C*^MZ?M<+&WJ+@?B_QPUyTg9DJGtQN#NIC&-XddRsf3n^AL6 zT@P|H;PvN;ZpL0iv$bRb7|J{0o!Hq+S>_NrH4@coZtBJu#g8#CbR7|#?6uxi8d+$g z87apN>EciJZ`%Zv2**_uiET9Vk{pny&My;+WfGDw4EVL#B!Wiw&M|A8f1A@ z(yFQS6jfbH{b8Z-S7D2?Ixl`j0{+ZnpT=;KzVMLW{B$`N?Gw^Fl0H6lT61%T2AU**!sX0u?|I(yoy&Xveg7XBL&+>n6jd1##6d>TxE*Vj=8lWiG$4=u{1UbAa5QD>5_ z;Te^42v7K6Mmu4IWT6Rnm>oxrl~b<~^e3vbj-GCdHLIB_>59}Ya+~OF68NiH=?}2o zP(X7EN=quQn&)fK>M&kqF|<_*H`}c zk=+x)GU>{Af#vx&s?`UKUsz})g^Pc&?Ka@t5$n$bqf6{r1>#mWx6Ep>9|A}VmWRnowVo`OyCr^fHsf# zQjQ3Ttp7y#iQY8l`zEUW)(@gGQdt(~rkxlkefskT(t%@i8=|p1Y9Dc5bc+z#n$s13 zGJk|V0+&Ekh(F};PJzQKKo+FG@KV8a<$gmNSD;7rd_nRdc%?9)p!|B-@P~kxQG}~B zi|{0}@}zKC(rlFUYp*dO1RuvPC^DQOkX4<+EwvBAC{IZQdYxoq1Za!MW7%p7gGr=j zzWnAq%)^O2$eItftC#TTSArUyL$U54-O7e|)4_7%Q^2tZ^0-d&3J1}qCzR4dWX!)4 zzIEKjgnYgMus^>6uw4Jm8ga6>GBtMjpNRJ6CP~W=37~||gMo_p@GA@#-3)+cVYnU> zE5=Y4kzl+EbEh%dhQokB{gqNDqx%5*qBusWV%!iprn$S!;oN_6E3?0+umADVs4ako z?P+t?m?};gev9JXQ#Q&KBpzkHPde_CGu-y z<{}RRAx=xlv#mVi+Ibrgx~ujW$h{?zPfhz)Kp7kmYS&_|97b&H&1;J-mzrBWAvY} zh8-I8hl_RK2+nnf&}!W0P+>5?#?7>npshe<1~&l_xqKd0_>dl_^RMRq@-Myz&|TKZBj1=Q()) zF{dBjv5)h=&Z)Aevx}+i|7=R9rG^Di!sa)sZCl&ctX4&LScQ-kMncgO(9o6W6)yd< z@Rk!vkja*X_N3H=BavGoR0@u0<}m-7|2v!0+2h~S2Q&a=lTH91OJsvms2MT~ zY=c@LO5i`mLpBd(vh|)I&^A3TQLtr>w=zoyzTd=^f@TPu&+*2MtqE$Avf>l>}V|3-8Fp2hzo3y<)hr_|NO(&oSD z!vEjTWBxbKTiShVl-U{n*B3#)3a8$`{~Pk}J@elZ=>Pqp|MQ}jrGv7KrNcjW%TN_< zZz8kG{#}XoeWf7qY?D)L)8?Q-b@Na&>i=)(@uNo zr;cH98T3$Iau8Hn*@vXi{A@YehxDE2zX~o+RY`)6-X{8~hMpc#C`|8y> zU8Mnv5A0dNCf{Ims*|l-^ z(MRp{qoGohB34|ggDI*p!Aw|MFyJ|v+<+E3brfrI)|+l3W~CQLPbnF@G0)P~Ly!1TJLp}xh8uW`Q+RB-v`MRYZ9Gam3cM%{ zb4Cb*f)0deR~wtNb*8w-LlIF>kc7DAv>T0D(a3@l`k4TFnrO+g9XH7;nYOHxjc4lq zMmaW6qpgAgy)MckYMhl?>sq;-1E)-1llUneeA!ya9KM$)DaNGu57Z5aE>=VST$#vb zFo=uRHr$0M{-ha>h(D_boS4zId;3B|Tpqo|?B?Z@I?G(?&Iei+-{9L_A9=h=Qfn-U z1wIUnQe9!z%_j$F_{rf&`ZFSott09gY~qrf@g3O=Y>vzAnXCyL!@(BqWa)Zqt!#_k zfZHuwS52|&&)aK;CHq9V-t9qt0au{$#6c*R#e5n3rje0hic7c7m{kW$p(_`wB=Gw7 z4k`1Hi;Mc@yA7dp@r~?@rfw)TkjAW++|pkfOG}0N|2guek}j8Zen(!+@7?qt_7ndX zB=BG6WJ31#F3#Vk3=aQr8T)3`{=p9nBHlKzE0I@v`{vJ}h8pd6vby&VgFhzH|q;=aonunAXL6G2y(X^CtAhWr*jI zGjpY@raZDQkg*aMq}Ni6cRF z{oWv}5`nhSAv>usX}m^GHt`f(t8@zHc?K|y5Zi=4G*UG1Sza{$Dpj%X8 zzEXaKT5N6F5j4J|w#qlZP!zS7BT)9b+!ZSJdToqJts1c!)fwih4d31vfb{}W)EgcA zH2pZ^8_k$9+WD2n`6q5XbOy8>3pcYH9 z07eUB+p}YD@AH!}p!iKv><2QF-Y^&xx^PAc1F13A{nUeCDg&{hnix#FiO!fe(^&%Qcux!h znu*S!s$&nnkeotYsDthh1dq(iQrE|#f_=xVgfiiL&-5eAcC-> z5L0l|DVEM$#ulf{bj+Y~7iD)j<~O8CYM8GW)dQGq)!mck)FqoL^X zwNdZb3->hFrbHFm?hLvut-*uK?zXn3q1z|UX{RZ;-WiLoOjnle!xs+W0-8D)kjU#R z+S|A^HkRg$Ij%N4v~k`jyHffKaC~=wg=9)V5h=|kLQ@;^W!o2^K+xG&2n`XCd>OY5Ydi= zgHH=lgy++erK8&+YeTl7VNyVm9-GfONlSlVb3)V9NW5tT!cJ8d7X)!b-$fb!s76{t z@d=Vg-5K_sqHA@Zx-L_}wVnc@L@GL9_K~Zl(h5@AR#FAiKad8~KeWCo@mgXIQ#~u{ zgYFwNz}2b6Vu@CP0XoqJ+dm8px(5W5-Jpis97F`+KM)TuP*X8H@zwiVKDKGVp59pI zifNHZr|B+PG|7|Y<*tqap0CvG7tbR1R>jn70t1X`XJixiMVcHf%Ez*=xm1(CrTSDt z0cle!+{8*Ja&EOZ4@$qhBuKQ$U95Q%rc7tg$VRhk?3=pE&n+T3upZg^ZJc9~c2es% zh7>+|mrmA-p&v}|OtxqmHIBgUxL~^0+cpfkSK2mhh+4b=^F1Xgd2)}U*Yp+H?ls#z zrLxWg_hm}AfK2XYWr!rzW4g;+^^&bW%LmbtRai9f3PjU${r@n`JThy-cphbcwn)rq9{A$Ht`lmYKxOacy z6v2R(?gHhD5@&kB-Eg?4!hAoD7~(h>(R!s1c1Hx#s9vGPePUR|of32bS`J5U5w{F) z>0<^ktO2UHg<0{oxkdOQ;}coZDQph8p6ruj*_?uqURCMTac;>T#v+l1Tc~%^k-Vd@ zkc5y35jVNc49vZpZx;gG$h{%yslDI%Lqga1&&;mN{Ush1c7p>7e-(zp}6E7f-XmJb4nhk zb8zS+{IVbL$QVF8pf8}~kQ|dHJAEATmmnrb_wLG}-yHe>W|A&Y|;muy-d^t^<&)g5SJfaTH@P1%euONny=mxo+C z4N&w#biWY41r8k~468tvuYVh&XN&d#%QtIf9;iVXfWY)#j=l`&B~lqDT@28+Y!0E+MkfC}}H*#(WKKdJJq=O$vNYCb(ZG@p{fJgu;h z21oHQ(14?LeT>n5)s;uD@5&ohU!@wX8w*lB6i@GEH0pM>YTG+RAIWZD;4#F1&F%Jp zXZUml2sH0!lYJT?&sA!qwez6cXzJEd(1ZC~kT5kZSp7(@=H2$Azb_*W&6aA|9iwCL zdX7Q=42;@dspHDwYE?miGX#L^3xD&%BI&fN9^;`v4OjQXPBaBmOF1;#C)8XA(WFlH zycro;DS2?(G&6wkr6rqC>rqDv3nfGw3hmN_9Al>TgvmGsL8_hXx09};l9Ow@)F5@y z#VH5WigLDwZE4nh^7&@g{1FV^UZ%_LJ-s<{HN*2R$OPg@R~Z`c-ET*2}XB@9xvAjrK&hS=f|R8Gr9 zr|0TGOsI7RD+4+2{ZiwdVD@2zmg~g@^D--YL;6UYGSM8i$NbQr4!c7T9rg!8;TM0E zT#@?&S=t>GQm)*ua|?TLT2ktj#`|R<_*FAkOu2Pz$wEc%-=Y9V*$&dg+wIei3b*O8 z2|m$!jJG!J!ZGbbIa!(Af~oSyZV+~M1qGvelMzPNE_%5?c2>;MeeG2^N?JDKjFYCy z7SbPWH-$cWF9~fX%9~v99L!G(wi!PFp>rB!9xj7=Cv|F+7CsGNwY0Q_J%FID%C^CBZQfJ9K(HK%k31j~e#&?hQ zNuD6gRkVckU)v+53-fc} z7ZCzYN-5RG4H7;>>Hg?LU9&5_aua?A0)0dpew1#MMlu)LHe(M;OHjHIUl7|%%)YPo z0cBk;AOY00%Fe6heoN*$(b<)Cd#^8Iu;-2v@>cE-OB$icUF9EEoaC&q8z9}jMTT2I z8`9;jT%z0;dy4!8U;GW{i`)3!c6&oWY`J3669C!tM<5nQFFrFRglU8f)5Op$GtR-3 zn!+SPCw|04sv?%YZ(a7#L?vsdr7ss@WKAw&A*}-1S|9~cL%uA+E~>N6QklFE>8W|% zyX-qAUGTY1hQ-+um`2|&ji0cY*(qN!zp{YpDO-r>jPk*yuVSay<)cUt`t@&FPF_&$ zcHwu1(SQ`I-l8~vYyUxm@D1UEdFJ$f5Sw^HPH7b!9 zzYT3gKMF((N(v0#4f_jPfVZ=ApN^jQJe-X$`A?X+vWjLn_%31KXE*}5_}d8 zw_B1+a#6T1?>M{ronLbHIlEsMf93muJ7AH5h%;i99<~JX^;EAgEB1uHralD*!aJ@F zV2ruuFe9i2Q1C?^^kmVy921eb=tLDD43@-AgL^rQ3IO9%+vi_&R2^dpr}x{bCVPej z7G0-0o64uyWNtr*loIvslyo0%)KSDDKjfThe0hcqs)(C-MH1>bNGBDRTW~scy_{w} zp^aq8Qb!h9Lwielq%C1b8=?Z=&U)ST&PHbS)8Xzjh2DF?d{iAv)Eh)wsUnf>UtXN( zL7=$%YrZ#|^c{MYmhn!zV#t*(jdmYdCpwqpZ{v&L8KIuKn`@IIZfp!uo}c;7J57N` zAxyZ-uA4=Gzl~Ovycz%MW9ZL7N+nRo&1cfNn9(1H5eM;V_4Z_qVann7F>5f>%{rf= zPBZFaV@_Sobl?Fy&KXyzFDV*FIdhS5`Uc~S^Gjo)aiTHgn#<0C=9o-a-}@}xDor;D zZyZ|fvf;+=3MZd>SR1F^F`RJEZo+|MdyJYQAEauKu%WDol~ayrGU3zzbHKsnHKZ*z zFiwUkL@DZ>!*x05ql&EBq@_Vqv83&?@~q5?lVmffQZ+V-=qL+!u4Xs2Z2zdCQ3U7B&QR9_Iggy} z(om{Y9eU;IPe`+p1ifLx-XWh?wI)xU9ik+m#g&pGdB5Bi<`PR*?92lE0+TkRuXI)z z5LP!N2+tTc%cB6B1F-!fj#}>S!vnpgVU~3!*U1ej^)vjUH4s-bd^%B=ItQqDCGbrEzNQi(dJ`J}-U=2{7-d zK8k^Rlq2N#0G?9&1?HSle2vlkj^KWSBYTwx`2?9TU_DX#J+f+qLiZCqY1TXHFxXZqYMuD@RU$TgcnCC{_(vwZ-*uX)~go#%PK z@}2Km_5aQ~(<3cXeJN6|F8X_1@L%@xTzs}$_*E|a^_URF_qcF;Pfhoe?FTFwvjm1o z8onf@OY@jC2tVcMaZS;|T!Ks(wOgPpRzRnFS-^RZ4E!9dsnj9sFt609a|jJbb1Dt@ z<=Gal2jDEupxUSwWu6zp<<&RnAA;d&4gKVG0iu6g(DsST(4)z6R)zDpfaQ}v{5ARt zyhwvMtF%b-YazR5XLz+oh=mn;y-Mf2a8>7?2v8qX;19y?b>Z5laGHvzH;Nu9S`B8} zI)qN$GbXIQ1VL3lnof^6TS~rvPVg4V?Dl2Bb*K2z4E{5vy<(@@K_cN@U>R!>aUIRnb zL*)=787*cs#zb31zBC49x$`=fkQbMAef)L2$dR{)6BAz!t5U_B#1zZG`^neKSS22oJ#5B=gl%U=WeqL9REF2g zZnfCb0?quf?Ztj$VXvDSWoK`0L=Zxem2q}!XWLoT-kYMOx)!7fcgT35uC~0pySEme z`{wGWTkGr7>+Kb^n;W?BZH6ZP(9tQX%-7zF>vc2}LuWDI(9kh1G#7B99r4x6;_-V+k&c{nPUrR zAXJGRiMe~aup{0qzmLNjS_BC4cB#sXjckx{%_c&^xy{M61xEb>KW_AG5VFXUOjAG4 z^>Qlm9A#1N{4snY=(AmWzatb!ngqiqPbBZ7>Uhb3)dTkSGcL#&SH>iMO-IJBPua`u zo)LWZ>=NZLr758j{%(|uQuZ)pXq_4c!!>s|aDM9#`~1bzK3J1^^D#<2bNCccH7~-X}Ggi!pIIF>uFx%aPARGQsnC8ZQc8lrQ5o~smqOg>Ti^GNme94*w z)JZy{_{#$jxGQ&`M z!OMvZMHR>8*^>eS%o*6hJwn!l8VOOjZQJvh)@tnHVW&*GYPuxqXw}%M!(f-SQf`=L z5;=5w2;%82VMH6Xi&-K3W)o&K^+vJCepWZ-rW%+Dc6X3(){z$@4zjYxQ|}8UIojeC zYZpQ1dU{fy=oTr<4VX?$q)LP}IUmpiez^O&N3E_qPpchGTi5ZM6-2ScWlQq%V&R2Euz zO|Q0Hx>lY1Q1cW5xHv5!0OGU~PVEqSuy#fD72d#O`N!C;o=m+YioGu-wH2k6!t<~K zSr`E=W9)!g==~x9VV~-8{4ZN9{~-A9zJpRe%NGg$+MDuI-dH|b@BD)~>pPCGUNNzY zMDg||0@XGQgw`YCt5C&A{_+J}mvV9Wg{6V%2n#YSRN{AP#PY?1FF1#|vO_%e+#`|2*~wGAJaeRX6=IzFNeWhz6gJc8+(03Ph4y6ELAm=AkN7TOgMUEw*N{= z_)EIDQx5q22oUR+_b*tazu9+pX|n1c*IB-}{DqIj z-?E|ks{o3AGRNb;+iKcHkZvYJvFsW&83RAPs1Oh@IWy%l#5x2oUP6ZCtv+b|q>jsf zZ_9XO;V!>n`UxH1LvH8)L4?8raIvasEhkpQoJ`%!5rBs!0Tu(s_D{`4opB;57)pkX z4$A^8CsD3U5*!|bHIEqsn~{q+Ddj$ME@Gq4JXtgVz&7l{Ok!@?EA{B3P~NAqb9)4? zkQo30A^EbHfQ@87G5&EQTd`frrwL)&Yw?%-W@uy^Gn23%j?Y!Iea2xw<-f;esq zf%w5WN@E1}zyXtYv}}`U^B>W`>XPmdLj%4{P298|SisrE;7HvXX;A}Ffi8B#3Lr;1 zHt6zVb`8{#+e$*k?w8|O{Uh|&AG}|DG1PFo1i?Y*cQm$ZwtGcVgMwtBUDa{~L1KT-{jET4w60>{KZ27vXrHJ;fW{6| z=|Y4!&UX020wU1>1iRgB@Q#m~1^Z^9CG1LqDhYBrnx%IEdIty z!46iOoKlKs)c}newDG)rWUikD%j`)p z_w9Ph&e40=(2eBy;T!}*1p1f1SAUDP9iWy^u^Ubdj21Kn{46;GR+hwLO=4D11@c~V zI8x&(D({K~Df2E)Nx_yQvYfh4;MbMJ@Z}=Dt3_>iim~QZ*hZIlEs0mEb z_54+&*?wMD`2#vsQRN3KvoT>hWofI_Vf(^C1ff-Ike@h@saEf7g}<9T`W;HAne-Nd z>RR+&SP35w)xKn8^U$7))PsM!jKwYZ*RzEcG-OlTrX3}9a{q%#Un5E5W{{hp>w~;` zGky+3(vJvQyGwBo`tCpmo0mo((?nM8vf9aXrrY1Ve}~TuVkB(zeds^jEfI}xGBCM2 zL1|#tycSaWCurP+0MiActG3LCas@_@tao@(R1ANlwB$4K53egNE_;!&(%@Qo$>h`^1S_!hN6 z)vZtG$8fN!|BXBJ=SI>e(LAU(y(i*PHvgQ2llulxS8>qsimv7yL}0q_E5WiAz7)(f zC(ahFvG8&HN9+6^jGyLHM~$)7auppeWh_^zKk&C_MQ~8;N??OlyH~azgz5fe^>~7F zl3HnPN3z-kN)I$4@`CLCMQx3sG~V8hPS^}XDXZrQA>}mQPw%7&!sd(Pp^P=tgp-s^ zjl}1-KRPNWXgV_K^HkP__SR`S-|OF0bR-N5>I%ODj&1JUeAQ3$9i;B~$S6}*^tK?= z**%aCiH7y?xdY?{LgVP}S0HOh%0%LI$wRx;$T|~Y8R)Vdwa}kGWv8?SJVm^>r6+%I z#lj1aR94{@MP;t-scEYQWc#xFA30^}?|BeX*W#9OL;Q9#WqaaM546j5j29((^_8Nu z4uq}ESLr~r*O7E7$D{!k9W>`!SLoyA53i9QwRB{!pHe8um|aDE`Cg0O*{jmor)^t)3`>V>SWN-2VJcFmj^1?~tT=JrP`fVh*t zXHarp=8HEcR#vFe+1a%XXuK+)oFs`GDD}#Z+TJ}Ri`FvKO@ek2ayn}yaOi%(8p%2$ zpEu)v0Jym@f}U|-;}CbR=9{#<^z28PzkkTNvyKvJDZe+^VS2bES3N@Jq!-*}{oQlz z@8bgC_KnDnT4}d#&Cpr!%Yb?E!brx0!eVOw~;lLwUoz#Np%d$o%9scc3&zPm`%G((Le|6o1 zM(VhOw)!f84zG^)tZ1?Egv)d8cdNi+T${=5kV+j;Wf%2{3g@FHp^Gf*qO0q!u$=m9 zCaY`4mRqJ;FTH5`a$affE5dJrk~k`HTP_7nGTY@B9o9vvnbytaID;^b=Tzp7Q#DmD zC(XEN)Ktn39z5|G!wsVNnHi) z%^q94!lL|hF`IijA^9NR0F$@h7k5R^ljOW(;Td9grRN0Mb)l_l7##{2nPQ@?;VjXv zaLZG}yuf$r$<79rVPpXg?6iiieX|r#&`p#Con2i%S8*8F}(E) zI5E6c3tG*<;m~6>!&H!GJ6zEuhH7mkAzovdhLy;)q z{H2*8I^Pb}xC4s^6Y}6bJvMu=8>g&I)7!N!5QG$xseeU#CC?ZM-TbjsHwHgDGrsD= z{%f;@Sod+Ch66Ko2WF~;Ty)v>&x^aovCbCbD7>qF*!?BXmOV3(s|nxsb*Lx_2lpB7 zokUnzrk;P=T-&kUHO}td+Zdj!3n&NR?K~cRU zAXU!DCp?51{J4w^`cV#ye}(`SQhGQkkMu}O3M*BWt4UsC^jCFUy;wTINYmhD$AT;4 z?Xd{HaJjP`raZ39qAm;%beDbrLpbRf(mkKbANan7XsL>_pE2oo^$TgdidjRP!5-`% zv0d!|iKN$c0(T|L0C~XD0aS8t{*&#LnhE;1Kb<9&=c2B+9JeLvJr*AyyRh%@jHej=AetOMSlz^=!kxX>>B{2B1uIrQyfd8KjJ+DBy!h)~*(!|&L4^Q_07SQ~E zcemVP`{9CwFvPFu7pyVGCLhH?LhEVb2{7U+Z_>o25#+3<|8%1T^5dh}*4(kfJGry} zm%r#hU+__Z;;*4fMrX=Bkc@7|v^*B;HAl0((IBPPii%X9+u3DDF6%bI&6?Eu$8&aWVqHIM7mK6?Uvq$1|(-T|)IV<>e?!(rY zqkmO1MRaLeTR=)io(0GVtQT@s6rN%C6;nS3@eu;P#ry4q;^O@1ZKCJyp_Jo)Ty^QW z+vweTx_DLm{P-XSBj~Sl<%_b^$=}odJ!S2wAcxenmzFGX1t&Qp8Vxz2VT`uQsQYtdn&_0xVivIcxZ_hnrRtwq4cZSj1c-SG9 z7vHBCA=fd0O1<4*=lu$6pn~_pVKyL@ztw1swbZi0B?spLo56ZKu5;7ZeUml1Ws1?u zqMf1p{5myAzeX$lAi{jIUqo1g4!zWLMm9cfWcnw`k6*BR^?$2(&yW?>w;G$EmTA@a z6?y#K$C~ZT8+v{87n5Dm&H6Pb_EQ@V0IWmG9cG=O;(;5aMWWrIPzz4Q`mhK;qQp~a z+BbQrEQ+w{SeiuG-~Po5f=^EvlouB@_|4xQXH@A~KgpFHrwu%dwuCR)=B&C(y6J4J zvoGk9;lLs9%iA-IJGU#RgnZZR+@{5lYl8(e1h6&>Vc_mvg0d@);X zji4T|n#lB!>pfL|8tQYkw?U2bD`W{na&;*|znjmalA&f;*U++_aBYerq;&C8Kw7mI z7tsG*?7*5j&dU)Lje;^{D_h`%(dK|pB*A*1(Jj)w^mZ9HB|vGLkF1GEFhu&rH=r=8 zMxO42e{Si6$m+Zj`_mXb&w5Q(i|Yxyg?juUrY}78uo@~3v84|8dfgbPd0iQJRdMj< zncCNGdMEcsxu#o#B5+XD{tsg*;j-eF8`mp~K8O1J!Z0+>0=7O=4M}E?)H)ENE;P*F z$Ox?ril_^p0g7xhDUf(q652l|562VFlC8^r8?lQv;TMvn+*8I}&+hIQYh2 z1}uQQaag&!-+DZ@|C+C$bN6W;S-Z@)d1|en+XGvjbOxCa-qAF*LA=6s(Jg+g;82f$ z(Vb)8I)AH@cdjGFAR5Rqd0wiNCu!xtqWbcTx&5kslzTb^7A78~Xzw1($UV6S^VWiP zFd{Rimd-0CZC_Bu(WxBFW7+k{cOW7DxBBkJdJ;VsJ4Z@lERQr%3eVv&$%)b%<~ zCl^Y4NgO}js@u{|o~KTgH}>!* z_iDNqX2(As7T0xivMH|3SC1ivm8Q}6Ffcd7owUKN5lHAtzMM4<0v+ykUT!QiowO;`@%JGv+K$bBx@*S7C8GJVqQ_K>12}M`f_Ys=S zKFh}HM9#6Izb$Y{wYzItTy+l5U2oL%boCJn?R3?jP@n$zSIwlmyGq30Cw4QBO|14` zW5c);AN*J3&eMFAk$SR~2k|&+&Bc$e>s%c{`?d~85S-UWjA>DS5+;UKZ}5oVa5O(N zqqc@>)nee)+4MUjH?FGv%hm2{IlIF-QX}ym-7ok4Z9{V+ZHVZQl$A*x!(q%<2~iVv znUa+BX35&lCb#9VE-~Y^W_f;Xhl%vgjwdjzMy$FsSIj&ok}L+X`4>J=9BkN&nu^E*gbhj3(+D>C4E z@Fwq_=N)^bKFSHTzZk?-gNU$@l}r}dwGyh_fNi=9b|n}J>&;G!lzilbWF4B}BBq4f zYIOl?b)PSh#XTPp4IS5ZR_2C!E)Z`zH0OW%4;&~z7UAyA-X|sh9@~>cQW^COA9hV4 zXcA6qUo9P{bW1_2`eo6%hgbN%(G-F1xTvq!sc?4wN6Q4`e9Hku zFwvlAcRY?6h^Fj$R8zCNEDq8`=uZB8D-xn)tA<^bFFy}4$vA}Xq0jAsv1&5!h!yRA zU()KLJya5MQ`q&LKdH#fwq&(bNFS{sKlEh_{N%{XCGO+po#(+WCLmKW6&5iOHny>g z3*VFN?mx!16V5{zyuMWDVP8U*|BGT$(%IO|)?EF|OI*sq&RovH!N%=>i_c?K*A>>k zyg1+~++zY4Q)J;VWN0axhoIKx;l&G$gvj(#go^pZskEVj8^}is3Jw26LzYYVos0HX zRPvmK$dVxM8(Tc?pHFe0Z3uq){{#OK3i-ra#@+;*=ui8)y6hsRv z4Fxx1c1+fr!VI{L3DFMwXKrfl#Q8hfP@ajgEau&QMCxd{g#!T^;ATXW)nUg&$-n25 zruy3V!!;{?OTobo|0GAxe`Acn3GV@W=&n;~&9 zQM>NWW~R@OYORkJAo+eq1!4vzmf9K%plR4(tB@TR&FSbDoRgJ8qVcH#;7lQub*nq&?Z>7WM=oeEVjkaG zT#f)=o!M2DO5hLR+op>t0CixJCIeXH*+z{-XS|%jx)y(j&}Wo|3!l7{o)HU3m7LYyhv*xF&tq z%IN7N;D4raue&&hm0xM=`qv`+TK@;_xAcGKuK(2|75~ar2Yw)geNLSmVxV@x89bQu zpViVKKnlkwjS&&c|-X6`~xdnh}Ps)Hs z4VbUL^{XNLf7_|Oi>tA%?SG5zax}esF*FH3d(JH^Gvr7Rp*n=t7frH!U;!y1gJB^i zY_M$KL_}mW&XKaDEi9K-wZR|q*L32&m+2n_8lq$xRznJ7p8}V>w+d@?uB!eS3#u<} zIaqi!b!w}a2;_BfUUhGMy#4dPx>)_>yZ`ai?Rk`}d0>~ce-PfY-b?Csd(28yX22L% zI7XI>OjIHYTk_@Xk;Gu^F52^Gn6E1&+?4MxDS2G_#PQ&yXPXP^<-p|2nLTb@AAQEY zI*UQ9Pmm{Kat}wuazpjSyXCdnrD&|C1c5DIb1TnzF}f4KIV6D)CJ!?&l&{T)e4U%3HTSYqsQ zo@zWB1o}ceQSV)<4G<)jM|@@YpL+XHuWsr5AYh^Q{K=wSV99D~4RRU52FufmMBMmd z_H}L#qe(}|I9ZyPRD6kT>Ivj&2Y?qVZq<4bG_co_DP`sE*_Xw8D;+7QR$Uq(rr+u> z8bHUWbV19i#)@@G4bCco@Xb<8u~wVDz9S`#k@ciJtlu@uP1U0X?yov8v9U3VOig2t zL9?n$P3=1U_Emi$#slR>N5wH-=J&T=EdUHA}_Z zZIl3nvMP*AZS9{cDqFanrA~S5BqxtNm9tlu;^`)3X&V4tMAkJ4gEIPl= zoV!Gyx0N{3DpD@)pv^iS*dl2FwANu;1;%EDl}JQ7MbxLMAp>)UwNwe{=V}O-5C*>F zu?Ny+F64jZn<+fKjF01}8h5H_3pey|;%bI;SFg$w8;IC<8l|3#Lz2;mNNik6sVTG3 z+Su^rIE#40C4a-587$U~%KedEEw1%r6wdvoMwpmlXH$xPnNQN#f%Z7|p)nC>WsuO= z4zyqapLS<8(UJ~Qi9d|dQijb_xhA2)v>la)<1md5s^R1N&PiuA$^k|A<+2C?OiHbj z>Bn$~t)>Y(Zb`8hW7q9xQ=s>Rv81V+UiuZJc<23HplI88isqRCId89fb`Kt|CxVIg znWcwprwXnotO>3s&Oypkte^9yJjlUVVxSe%_xlzmje|mYOVPH^vjA=?6xd0vaj0Oz zwJ4OJNiFdnHJX3rw&inskjryukl`*fRQ#SMod5J|KroJRsVXa5_$q7whSQ{gOi*s0 z1LeCy|JBWRsDPn7jCb4s(p|JZiZ8+*ExC@Vj)MF|*Vp{B(ziccSn`G1Br9bV(v!C2 z6#?eqpJBc9o@lJ#^p-`-=`4i&wFe>2)nlPK1p9yPFzJCzBQbpkcR>={YtamIw)3nt z(QEF;+)4`>8^_LU)_Q3 zC5_7lgi_6y>U%m)m@}Ku4C}=l^J=<<7c;99ec3p{aR+v=diuJR7uZi%aQv$oP?dn?@6Yu_+*^>T0ptf(oobdL;6)N-I!TO`zg^Xbv3#L0I~sn@WGk-^SmPh5>W+LB<+1PU}AKa?FCWF|qMNELOgdxR{ zbqE7@jVe+FklzdcD$!(A$&}}H*HQFTJ+AOrJYnhh}Yvta(B zQ_bW4Rr;R~&6PAKwgLWXS{Bnln(vUI+~g#kl{r+_zbngT`Y3`^Qf=!PxN4IYX#iW4 zucW7@LLJA9Zh3(rj~&SyN_pjO8H&)|(v%!BnMWySBJV=eSkB3YSTCyIeJ{i;(oc%_hk{$_l;v>nWSB)oVeg+blh=HB5JSlG_r7@P z3q;aFoZjD_qS@zygYqCn=;Zxjo!?NK!%J$ z52lOP`8G3feEj+HTp@Tnn9X~nG=;tS+z}u{mQX_J0kxtr)O30YD%oo)L@wy`jpQYM z@M>Me=95k1p*FW~rHiV1CIfVc{K8r|#Kt(ApkXKsDG$_>76UGNhHExFCw#Ky9*B-z zNq2ga*xax!HMf_|Vp-86r{;~YgQKqu7%szk8$hpvi_2I`OVbG1doP(`gn}=W<8%Gn z%81#&WjkH4GV;4u43EtSW>K_Ta3Zj!XF?;SO3V#q=<=>Tc^@?A`i;&`-cYj|;^ zEo#Jl5zSr~_V-4}y8pnufXLa80vZY4z2ko7fj>DR)#z=wWuS1$$W!L?(y}YC+yQ|G z@L&`2upy3f>~*IquAjkVNU>}c10(fq#HdbK$~Q3l6|=@-eBbo>B9(6xV`*)sae58*f zym~RRVx;xoCG3`JV`xo z!lFw)=t2Hy)e!IFs?0~7osWk(d%^wxq&>_XD4+U#y&-VF%4z?XH^i4w`TxpF{`XhZ z%G}iEzf!T(l>g;W9<~K+)$g!{UvhW{E0Lis(S^%I8OF&%kr!gJ&fMOpM=&=Aj@wuL zBX?*6i51Qb$uhkwkFYkaD_UDE+)rh1c;(&Y=B$3)J&iJfQSx!1NGgPtK!$c9OtJuu zX(pV$bfuJpRR|K(dp@^j}i&HeJOh@|7lWo8^$*o~Xqo z5Sb+!EtJ&e@6F+h&+_1ETbg7LfP5GZjvIUIN3ibCOldAv z)>YdO|NH$x7AC8dr=<2ekiY1%fN*r~e5h6Yaw<{XIErujKV~tiyrvV_DV0AzEknC- zR^xKM3i<1UkvqBj3C{wDvytOd+YtDSGu!gEMg+!&|8BQrT*|p)(dwQLEy+ zMtMzij3zo40)CA!BKZF~yWg?#lWhqD3@qR)gh~D{uZaJO;{OWV8XZ_)J@r3=)T|kt zUS1pXr6-`!Z}w2QR7nP%d?ecf90;K_7C3d!UZ`N(TZoWNN^Q~RjVhQG{Y<%E1PpV^4 z-m-K+$A~-+VDABs^Q@U*)YvhY4Znn2^w>732H?NRK(5QSS$V@D7yz2BVX4)f5A04~$WbxGOam22>t&uD)JB8-~yiQW6ik;FGblY_I>SvB_z2?PS z*Qm&qbKI{H1V@YGWzpx`!v)WeLT02};JJo*#f$a*FH?IIad-^(;9XC#YTWN6;Z6+S zm4O1KH=#V@FJw7Pha0!9Vb%ZIM$)a`VRMoiN&C|$YA3~ZC*8ayZRY^fyuP6$n%2IU z$#XceYZeqLTXw(m$_z|33I$B4k~NZO>pP6)H_}R{E$i%USGy{l{-jOE;%CloYPEU+ zRFxOn4;7lIOh!7abb23YKD+_-?O z0FP9otcAh+oSj;=f#$&*ExUHpd&e#bSF%#8*&ItcL2H$Sa)?pt0Xtf+t)z$_u^wZi z44oE}r4kIZGy3!Mc8q$B&6JqtnHZ>Znn!Zh@6rgIu|yU+zG8q`q9%B18|T|oN3zMq z`l&D;U!OL~%>vo&q0>Y==~zLiCZk4v%s_7!9DxQ~id1LLE93gf*gg&2$|hB#j8;?3 z5v4S;oM6rT{Y;I+#FdmNw z){d%tNM<<#GN%n9ox7B=3#;u7unZ~tLB_vRZ52a&2=IM)2VkXm=L+Iqq~uk#Dug|x z>S84e+A7EiOY5lj*!q?6HDkNh~0g;0Jy(al!ZHHDtur9T$y-~)94HelX1NHjXWIM7UAe}$?jiz z9?P4`I0JM=G5K{3_%2jPLC^_Mlw?-kYYgb7`qGa3@dn|^1fRMwiyM@Ch z;CB&o7&&?c5e>h`IM;Wnha0QKnEp=$hA8TJgR-07N~U5(>9vJzeoFsSRBkDq=x(YgEMpb=l4TDD`2 zwVJpWGTA_u7}?ecW7s6%rUs&NXD3+n;jB86`X?8(l3MBo6)PdakI6V6a}22{)8ilT zM~T*mU}__xSy|6XSrJ^%lDAR3Lft%+yxC|ZUvSO_nqMX!_ul3;R#*{~4DA=h$bP)%8Yv9X zyp><|e8=_ttI}ZAwOd#dlnSjck#6%273{E$kJuCGu=I@O)&6ID{nWF5@gLb16sj|&Sb~+du4e4O_%_o`Ix4NRrAsyr1_}MuP94s>de8cH-OUkVPk3+K z&jW)It9QiU-ti~AuJkL`XMca8Oh4$SyJ=`-5WU<{cIh+XVH#e4d&zive_UHC!pN>W z3TB;Mn5i)9Qn)#6@lo4QpI3jFYc0~+jS)4AFz8fVC;lD^+idw^S~Qhq>Tg(!3$yLD zzktzoFrU@6s4wwCMz}edpF5i5Q1IMmEJQHzp(LAt)pgN3&O!&d?3W@6U4)I^2V{;- z6A(?zd93hS*uQmnh4T)nHnE{wVhh(=MMD(h(P4+^p83Om6t<*cUW>l(qJzr%5vp@K zN27ka(L{JX=1~e2^)F^i=TYj&;<7jyUUR2Bek^A8+3Up*&Xwc{)1nRR5CT8vG>ExV zHnF3UqXJOAno_?bnhCX-&kwI~Ti8t4`n0%Up>!U`ZvK^w2+0Cs-b9%w%4`$+To|k= zKtgc&l}P`*8IS>8DOe?EB84^kx4BQp3<7P{Pq}&p%xF_81pg!l2|u=&I{AuUgmF5n zJQCTLv}%}xbFGYtKfbba{CBo)lWW%Z>i(_NvLhoQZ*5-@2l&x>e+I~0Nld3UI9tdL zRzu8}i;X!h8LHVvN?C+|M81e>Jr38%&*9LYQec9Ax>?NN+9(_>XSRv&6hlCYB`>Qm z1&ygi{Y()OU4@D_jd_-7vDILR{>o|7-k)Sjdxkjgvi{@S>6GqiF|o`*Otr;P)kLHN zZkpts;0zw_6;?f(@4S1FN=m!4^mv~W+lJA`&7RH%2$)49z0A+8@0BCHtj|yH--AEL z0tW6G%X-+J+5a{5*WKaM0QDznf;V?L5&uQw+yegDNDP`hA;0XPYc6e0;Xv6|i|^F2WB)Z$LR|HR4 zTQsRAby9(^Z@yATyOgcfQw7cKyr^3Tz7lc7+JEwwzA7)|2x+PtEb>nD(tpxJQm)Kn zW9K_*r!L%~N*vS8<5T=iv|o!zTe9k_2jC_j*7ik^M_ zaf%k{WX{-;0*`t`G!&`eW;gChVXnJ-Rn)To8vW-?>>a%QU1v`ZC=U)f8iA@%JG0mZ zDqH;~mgBnrCP~1II<=V9;EBL)J+xzCoiRBaeH&J6rL!{4zIY8tZka?_FBeQeNO3q6 zyG_alW54Ba&wQf{&F1v-r1R6ID)PTsqjIBc+5MHkcW5Fnvi~{-FjKe)t1bl}Y;z@< z=!%zvpRua>>t_x}^}z0<7MI!H2v6|XAyR9!t50q-A)xk0nflgF4*OQlCGK==4S|wc zRMsSscNhRzHMBU8TdcHN!q^I}x0iXJ%uehac|Zs_B$p@CnF)HeXPpB_Za}F{<@6-4 zl%kml@}kHQ(ypD8FsPJ2=14xXJE|b20RUIgs!2|R3>LUMGF6X*B_I|$`Qg=;zm7C z{mEDy9dTmPbued7mlO@phdmAmJ7p@GR1bjCkMw6*G7#4+`k>fk1czdJUB!e@Q(~6# zwo%@p@V5RL0ABU2LH7Asq^quDUho@H>eTZH9f*no9fY0T zD_-9px3e}A!>>kv5wk91%C9R1J_Nh!*&Kk$J3KNxC}c_@zlgpJZ+5L)Nw|^p=2ue}CJtm;uj*Iqr)K})kA$xtNUEvX;4!Px*^&9T_`IN{D z{6~QY=Nau6EzpvufB^hflc#XIsSq0Y9(nf$d~6ZwK}fal92)fr%T3=q{0mP-EyP_G z)UR5h@IX}3Qll2b0oCAcBF>b*@Etu*aTLPU<%C>KoOrk=x?pN!#f_Og-w+;xbFgjQ zXp`et%lDBBh~OcFnMKMUoox0YwBNy`N0q~bSPh@+enQ=4RUw1) zpovN`QoV>vZ#5LvC;cl|6jPr}O5tu!Ipoyib8iXqy}TeJ;4+_7r<1kV0v5?Kv>fYp zg>9L`;XwXa&W7-jf|9~uP2iyF5`5AJ`Q~p4eBU$MCC00`rcSF>`&0fbd^_eqR+}mK z4n*PMMa&FOcc)vTUR zlDUAn-mh`ahi_`f`=39JYTNVjsTa_Y3b1GOIi)6dY)D}xeshB0T8Eov5%UhWd1)u}kjEQ|LDo{tqKKrYIfVz~@dp!! zMOnah@vp)%_-jDTUG09l+;{CkDCH|Q{NqX*uHa1YxFShy*1+;J`gywKaz|2Q{lG8x zP?KBur`}r`!WLKXY_K;C8$EWG>jY3UIh{+BLv0=2)KH%P}6xE2kg)%(-uA6lC?u8}{K(#P*c zE9C8t*u%j2r_{;Rpe1A{9nNXU;b_N0vNgyK!EZVut~}+R2rcbsHilqsOviYh-pYX= zHw@53nlmwYI5W5KP>&`dBZe0Jn?nAdC^HY1wlR6$u^PbpB#AS&5L6zqrXN&7*N2Q` z+Rae1EwS)H=aVSIkr8Ek^1jy2iS2o7mqm~Mr&g5=jjt7VxwglQ^`h#Mx+x2v|9ZAwE$i_9918MjJxTMr?n!bZ6n$}y11u8I9COTU`Z$Fi z!AeAQLMw^gp_{+0QTEJrhL424pVDp%wpku~XRlD3iv{vQ!lAf!_jyqd_h}+Tr1XG| z`*FT*NbPqvHCUsYAkFnM`@l4u_QH&bszpUK#M~XLJt{%?00GXY?u_{gj3Hvs!=N(I z(=AuWPijyoU!r?aFTsa8pLB&cx}$*%;K$e*XqF{~*rA-qn)h^!(-;e}O#B$|S~c+U zN4vyOK0vmtx$5K!?g*+J@G1NmlEI=pyZXZ69tAv=@`t%ag_Hk{LP~OH9iE)I= zaJ69b4kuCkV0V zo(M0#>phpQ_)@j;h%m{-a*LGi(72TP)ws2w*@4|C-3+;=5DmC4s7Lp95%n%@Ko zfdr3-a7m*dys9iIci$A=4NPJ`HfJ;hujLgU)ZRuJI`n;Pw|yksu!#LQnJ#dJysgNb z@@qwR^wrk(jbq4H?d!lNyy72~Dnn87KxsgQ!)|*m(DRM+eC$wh7KnS-mho3|KE)7h zK3k;qZ;K1Lj6uEXLYUYi)1FN}F@-xJ z@@3Hb84sl|j{4$3J}aTY@cbX@pzB_qM~APljrjju6P0tY{C@ zpUCOz_NFmALMv1*blCcwUD3?U6tYs+N%cmJ98D%3)%)Xu^uvzF zS5O!sc#X6?EwsYkvPo6A%O8&y8sCCQH<%f2togVwW&{M;PR!a(ZT_A+jVAbf{@5kL zB@Z(hb$3U{T_}SKA_CoQVU-;j>2J=L#lZ~aQCFg-d<9rzs$_gO&d5N6eFSc z1ml8)P*FSi+k@!^M9nDWR5e@ATD8oxtDu=36Iv2!;dZzidIS(PCtEuXAtlBb1;H%Z zwnC^Ek*D)EX4#Q>R$$WA2sxC_t(!!6Tr?C#@{3}n{<^o;9id1RA&-Pig1e-2B1XpG zliNjgmd3c&%A}s>qf{_j#!Z`fu0xIwm4L0)OF=u(OEmp;bLCIaZX$&J_^Z%4Sq4GZ zPn6sV_#+6pJmDN_lx@1;Zw6Md_p0w9h6mHtzpuIEwNn>OnuRSC2=>fP^Hqgc)xu^4 z<3!s`cORHJh#?!nKI`Et7{3C27+EuH)Gw1f)aoP|B3y?fuVfvpYYmmukx0ya-)TQX zR{ggy5cNf4X|g)nl#jC9p>7|09_S7>1D2GTRBUTW zAkQ=JMRogZqG#v;^=11O6@rPPwvJkr{bW-Qg8`q8GoD#K`&Y+S#%&B>SGRL>;ZunM@49!}Uy zN|bBCJ%sO;@3wl0>0gbl3L@1^O60ONObz8ZI7nder>(udj-jt`;yj^nTQ$L9`OU9W zX4alF#$|GiR47%x@s&LV>2Sz2R6?;2R~5k6V>)nz!o_*1Y!$p>BC5&?hJg_MiE6UBy>RkVZj`9UWbRkN-Hk!S`=BS3t3uyX6)7SF#)71*}`~Ogz z1rap5H6~dhBJ83;q-Y<5V35C2&F^JI-it(=5D#v!fAi9p#UwV~2tZQI+W(Dv?1t9? zfh*xpxxO{-(VGB>!Q&0%^YW_F!@aZS#ucP|YaD#>wd1Fv&Z*SR&mc;asi}1G) z_H>`!akh-Zxq9#io(7%;a$)w+{QH)Y$?UK1Dt^4)up!Szcxnu}kn$0afcfJL#IL+S z5gF_Y30j;{lNrG6m~$Ay?)*V9fZuU@3=kd40=LhazjFrau>(Y>SJNtOz>8x_X-BlA zIpl{i>OarVGj1v(4?^1`R}aQB&WCRQzS~;7R{tDZG=HhgrW@B`W|#cdyj%YBky)P= zpxuOZkW>S6%q7U{VsB#G(^FMsH5QuGXhb(sY+!-R8Bmv6Sx3WzSW<1MPPN1!&PurYky(@`bP9tz z52}LH9Q?+FF5jR6-;|+GVdRA!qtd;}*-h&iIw3Tq3qF9sDIb1FFxGbo&fbG5n8$3F zyY&PWL{ys^dTO}oZ#@sIX^BKW*bon=;te9j5k+T%wJ zNJtoN1~YVj4~YRrlZl)b&kJqp+Z`DqT!la$x&&IxgOQw#yZd-nBP3!7FijBXD|IsU8Zl^ zc6?MKpJQ+7ka|tZQLfchD$PD|;K(9FiLE|eUZX#EZxhG!S-63C$jWX1Yd!6-Yxi-u zjULIr|0-Q%D9jz}IF~S%>0(jOqZ(Ln<$9PxiySr&2Oic7vb<8q=46)Ln%Z|<*z5&> z3f~Zw@m;vR(bESB<=Jqkxn(=#hQw42l(7)h`vMQQTttz9XW6^|^8EK7qhju4r_c*b zJIi`)MB$w@9epwdIfnEBR+?~);yd6C(LeMC& zn&&N*?-g&BBJcV;8&UoZi4Lmxcj16ojlxR~zMrf=O_^i1wGb9X-0@6_rpjPYemIin zmJb+;lHe;Yp=8G)Q(L1bzH*}I>}uAqhj4;g)PlvD9_e_ScR{Ipq|$8NvAvLD8MYr}xl=bU~)f%B3E>r3Bu9_t|ThF3C5~BdOve zEbk^r&r#PT&?^V1cb{72yEWH}TXEE}w>t!cY~rA+hNOTK8FAtIEoszp!qqptS&;r$ zaYV-NX96-h$6aR@1xz6_E0^N49mU)-v#bwtGJm)ibygzJ8!7|WIrcb`$XH~^!a#s& z{Db-0IOTFq#9!^j!n_F}#Z_nX{YzBK8XLPVmc&X`fT7!@$U-@2KM9soGbmOSAmqV z{nr$L^MBo_u^Joyf0E^=eo{Rt0{{e$IFA(#*kP@SQd6lWT2-#>` zP1)7_@IO!9lk>Zt?#CU?cuhiLF&)+XEM9B)cS(gvQT!X3`wL*{fArTS;Ak`J<84du zALKPz4}3nlG8Fo^MH0L|oK2-4xIY!~Oux~1sw!+It)&D3p;+N8AgqKI`ld6v71wy8I!eP0o~=RVcFQR2Gr(eP_JbSytoQ$Yt}l*4r@A8Me94y z8cTDWhqlq^qoAhbOzGBXv^Wa4vUz$(7B!mX`T=x_ueKRRDfg&Uc-e1+z4x$jyW_Pm zp?U;-R#xt^Z8Ev~`m`iL4*c#65Nn)q#=Y0l1AuD&+{|8-Gsij3LUZXpM0Bx0u7WWm zH|%yE@-#XEph2}-$-thl+S;__ciBxSSzHveP%~v}5I%u!z_l_KoW{KRx2=eB33umE zIYFtu^5=wGU`Jab8#}cnYry@9p5UE#U|VVvx_4l49JQ;jQdp(uw=$^A$EA$LM%vmE zvdEOaIcp5qX8wX{mYf0;#51~imYYPn4=k&#DsKTxo{_Mg*;S495?OBY?#gv=edYC* z^O@-sd-qa+U24xvcbL0@C7_6o!$`)sVr-jSJE4XQUQ$?L7}2(}Eixqv;L8AdJAVqc zq}RPgpnDb@E_;?6K58r3h4-!4rT4Ab#rLHLX?eMOfluJk=3i1@Gt1i#iA=O`M0@x! z(HtJP9BMHXEzuD93m|B&woj0g6T?f#^)>J>|I4C5?Gam>n9!8CT%~aT;=oco5d6U8 zMXl(=W;$ND_8+DD*?|5bJ!;8ebESXMUKBAf7YBwNVJibGaJ*(2G`F%wx)grqVPjudiaq^Kl&g$8A2 zWMxMr@_$c}d+;_B`#kUX-t|4VKH&_f^^EP0&=DPLW)H)UzBG%%Tra*5 z%$kyZe3I&S#gfie^z5)!twG={3Cuh)FdeA!Kj<-9** zvT*5%Tb`|QbE!iW-XcOuy39>D3oe6x{>&<#E$o8Ac|j)wq#kQzz|ATd=Z0K!p2$QE zPu?jL8Lb^y3_CQE{*}sTDe!2!dtlFjq&YLY@2#4>XS`}v#PLrpvc4*@q^O{mmnr5D zmyJq~t?8>FWU5vZdE(%4cuZuao0GNjp3~Dt*SLaxI#g_u>hu@k&9Ho*#CZP~lFJHj z(e!SYlLigyc?&5-YxlE{uuk$9b&l6d`uIlpg_z15dPo*iU&|Khx2*A5Fp;8iK_bdP z?T6|^7@lcx2j0T@x>X7|kuuBSB7<^zeY~R~4McconTxA2flHC0_jFxmSTv-~?zVT| zG_|yDqa9lkF*B6_{j=T>=M8r<0s;@z#h)3BQ4NLl@`Xr__o7;~M&dL3J8fP&zLfDfy z);ckcTev{@OUlZ`bCo(-3? z1u1xD`PKgSg?RqeVVsF<1SLF;XYA@Bsa&cY!I48ZJn1V<3d!?s=St?TLo zC0cNr`qD*M#s6f~X>SCNVkva^9A2ZP>CoJ9bvgXe_c}WdX-)pHM5m7O zrHt#g$F0AO+nGA;7dSJ?)|Mo~cf{z2L)Rz!`fpi73Zv)H=a5K)*$5sf_IZypi($P5 zsPwUc4~P-J1@^3C6-r9{V-u0Z&Sl7vNfmuMY4yy*cL>_)BmQF!8Om9Dej%cHxbIzA zhtV0d{=%cr?;bpBPjt@4w=#<>k5ee=TiWAXM2~tUGfm z$s&!Dm0R^V$}fOR*B^kGaipi~rx~A2cS0;t&khV1a4u38*XRUP~f za!rZMtay8bsLt6yFYl@>-y^31(*P!L^^s@mslZy(SMsv9bVoX`O#yBgEcjCmGpyc* zeH$Dw6vB5P*;jor+JOX@;6K#+xc)Z9B8M=x2a@Wx-{snPGpRmOC$zpsqW*JCh@M2Y z#K+M(>=#d^>Of9C`))h<=Bsy)6zaMJ&x-t%&+UcpLjV`jo4R2025 zXaG8EA!0lQa)|dx-@{O)qP6`$rhCkoQqZ`^SW8g-kOwrwsK8 z3ms*AIcyj}-1x&A&vSq{r=QMyp3CHdWH35!sad#!Sm>^|-|afB+Q;|Iq@LFgqIp#Z zD1%H+3I?6RGnk&IFo|u+E0dCxXz4yI^1i!QTu7uvIEH>i3rR{srcST`LIRwdV1P;W z+%AN1NIf@xxvVLiSX`8ILA8MzNqE&7>%jMzGt9wm78bo9<;h*W84i29^w!>V>{N+S zd`5Zmz^G;f=icvoOZfK5#1ctx*~UwD=ab4DGQXehQ!XYnak*dee%YN$_ZPL%KZuz$ zD;$PpT;HM^$KwtQm@7uvT`i6>Hae1CoRVM2)NL<2-k2PiX=eAx+-6j#JI?M}(tuBW zkF%jjLR)O`gI2fcPBxF^HeI|DWwQWHVR!;;{BXXHskxh8F@BMDn`oEi-NHt;CLymW z=KSv5)3dyzec0T5B*`g-MQ<;gz=nIWKUi9ko<|4I(-E0k$QncH>E4l z**1w&#={&zv4Tvhgz#c29`m|;lU-jmaXFMC11 z*dlXDMEOG>VoLMc>!rApwOu2prKSi*!w%`yzGmS+k(zm*CsLK*wv{S_0WX^8A-rKy zbk^Gf_92^7iB_uUF)EE+ET4d|X|>d&mdN?x@vxKAQk`O+r4Qdu>XGy(a(19g;=jU} zFX{O*_NG>!$@jh!U369Lnc+D~qch3uT+_Amyi}*k#LAAwh}k8IPK5a-WZ81ufD>l> z$4cF}GSz>ce`3FAic}6W4Z7m9KGO?(eWqi@L|5Hq0@L|&2flN1PVl}XgQ2q*_n2s3 zt5KtowNkTYB5b;SVuoXA@i5irXO)A&%7?V`1@HGCB&)Wgk+l|^XXChq;u(nyPB}b3 zY>m5jkxpZgi)zfbgv&ec4Zqdvm+D<?Im*mXweS9H+V>)zF#Zp3)bhl$PbISY{5=_z!8&*Jv~NYtI-g!>fDs zmvL5O^U%!^VaKA9gvKw|5?-jk>~%CVGvctKmP$kpnpfN{D8@X*Aazi$txfa%vd-|E z>kYmV66W!lNekJPom29LdZ%(I+ZLZYTXzTg*to~m?7vp%{V<~>H+2}PQ?PPAq`36R z<%wR8v6UkS>Wt#hzGk#44W<%9S=nBfB);6clKwnxY}T*w21Qc3_?IJ@4gYzC7s;WP zVQNI(M=S=JT#xsZy7G`cR(BP9*je0bfeN8JN5~zY(DDs0t{LpHOIbN);?T-69Pf3R zSNe*&p2%AwXHL>__g+xd4Hlc_vu<25H?(`nafS%)3UPP7_4;gk-9ckt8SJRTv5v0M z_Hww`qPudL?ajIR&X*;$y-`<)6dxx1U~5eGS13CB!lX;3w7n&lDDiArbAhSycd}+b zya_3p@A`$kQy;|NJZ~s44Hqo7Hwt}X86NK=(ey>lgWTtGL6k@Gy;PbO!M%1~Wcn2k zUFP|*5d>t-X*RU8g%>|(wwj*~#l4z^Aatf^DWd1Wj#Q*AY0D^V@sC`M zjJc6qXu0I7Y*2;;gGu!plAFzG=J;1%eIOdn zQA>J&e05UN*7I5@yRhK|lbBSfJ+5Uq;!&HV@xfPZrgD}kE*1DSq^=%{o%|LChhl#0 zlMb<^a6ixzpd{kNZr|3jTGeEzuo}-eLT-)Q$#b{!vKx8Tg}swCni>{#%vDY$Ww$84 zew3c9BBovqb}_&BRo#^!G(1Eg((BScRZ}C)Oz?y`T5wOrv);)b^4XR8 zhJo7+<^7)qB>I;46!GySzdneZ>n_E1oWZY;kf94#)s)kWjuJN1c+wbVoNQcmnv}{> zN0pF+Sl3E}UQ$}slSZeLJrwT>Sr}#V(dVaezCQl2|4LN`7L7v&siYR|r7M(*JYfR$ zst3=YaDw$FSc{g}KHO&QiKxuhEzF{f%RJLKe3p*7=oo`WNP)M(9X1zIQPP0XHhY3c znrP{$4#Ol$A0s|4S7Gx2L23dv*Gv2o;h((XVn+9+$qvm}s%zi6nI-_s6?mG! zj{DV;qesJb&owKeEK?=J>UcAlYckA7Sl+I&IN=yasrZOkejir*kE@SN`fk<8Fgx*$ zy&fE6?}G)d_N`){P~U@1jRVA|2*69)KSe_}!~?+`Yb{Y=O~_+@!j<&oVQQMnhoIRU zA0CyF1OFfkK44n*JD~!2!SCPM;PRSk%1XL=0&rz00wxPs&-_eapJy#$h!eqY%nS0{ z!aGg58JIJPF3_ci%n)QSVpa2H`vIe$RD43;#IRfDV&Ibit z+?>HW4{2wOfC6Fw)}4x}i1maDxcE1qi@BS*qcxD2gE@h3#4cgU*D-&3z7D|tVZWt= z-Cy2+*Cm@P4GN_TPUtaVyVesbVDazF@)j8VJ4>XZv!f%}&eO1SvIgr}4`A*3#vat< z_MoByL(qW6L7SFZ#|Gc1fFN)L2PxY+{B8tJp+pxRyz*87)vXR}*=&ahXjBlQKguuf zX6x<<6fQulE^C*KH8~W%ptpaC0l?b=_{~*U4?5Vt;dgM4t_{&UZ1C2j?b>b+5}{IF_CUyvz-@QZPMlJ)r_tS$9kH%RPv#2_nMb zRLj5;chJ72*U`Z@Dqt4$@_+k$%|8m(HqLG!qT4P^DdfvGf&){gKnGCX#H0!;W=AGP zbA&Z`-__a)VTS}kKFjWGk z%|>yE?t*EJ!qeQ%dPk$;xIQ+P0;()PCBDgjJm6Buj{f^awNoVx+9<|lg3%-$G(*f) zll6oOkN|yamn1uyl2*N-lnqRI1cvs_JxLTeahEK=THV$Sz*gQhKNb*p0fNoda#-&F zB-qJgW^g}!TtM|0bS2QZekW7_tKu%GcJ!4?lObt0z_$mZ4rbQ0o=^curCs3bJK6sq z9fu-aW-l#>z~ca(B;4yv;2RZ?tGYAU)^)Kz{L|4oPj zdOf_?de|#yS)p2v8-N||+XL=O*%3+y)oI(HbM)Ds?q8~HPzIP(vs*G`iddbWq}! z(2!VjP&{Z1w+%eUq^ /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 53a6b238d..7101f8e46 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -42,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index 715878b6a..76a1421f8 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -61,7 +61,7 @@ tasks.register('referenceBlockchainTests', Test) { boolean isCiServer = System.getenv().containsKey("CI") minHeapSize = isCiServer ? "8g" :"4g" - maxHeapSize = isCiServer ? "50g" : "8g" + maxHeapSize = isCiServer ? "32g" : "8g" useJUnitPlatform { includeTags("BlockchainReferenceTest") From 77e262fcac1eea15c6faf81edf086b9b71c54783 Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Thu, 19 Dec 2024 17:21:21 +0100 Subject: [PATCH 03/54] 1627 blockdata redesign (#1630) --- .../consensys/linea/zktracer/ZkTracer.java | 7 +- .../zktracer/module/blockdata/Blockdata.java | 78 +- .../module/blockdata/BlockdataOperation.java | 388 +++++-- .../zktracer/module/blockdata/Trace.java | 992 ++++++------------ .../zktracer/module/constants/Trace.java | 405 +++++++ .../linea/zktracer/module/hub/Hub.java | 13 +- .../linea/replaytests/ReplayTestTools.java | 3 + linea-constraints | 2 +- .../MultiBlockExecutionEnvironment.java | 2 + .../testing/ReplayExecutionEnvironment.java | 2 +- 10 files changed, 1104 insertions(+), 788 deletions(-) create mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java index 50d66dca2..7d43e5240 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java @@ -82,7 +82,7 @@ public class ZkTracer implements ConflationAwareOperationTracer { public ZkTracer() { this( LineaL1L2BridgeSharedConfiguration.EMPTY, - Bytes.fromHexString("c0ffee").toBigInteger().abs()); + Bytes.fromHexString("c0ffee").toUnsignedBigInteger()); } public ZkTracer(BigInteger nonnegativeChainId) { @@ -91,9 +91,8 @@ public ZkTracer(BigInteger nonnegativeChainId) { public ZkTracer( final LineaL1L2BridgeSharedConfiguration bridgeConfiguration, BigInteger chainId) { - BigInteger nonnegativeChainId = chainId.abs(); - this.hub = - new Hub(bridgeConfiguration.contract(), bridgeConfiguration.topic(), nonnegativeChainId); + ; + this.hub = new Hub(bridgeConfiguration.contract(), bridgeConfiguration.topic(), chainId); for (Module m : this.hub.getModulesToCount()) { if (!spillings.containsKey(m.moduleKey())) { throw new IllegalStateException( diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java index d98669584..450bf3ed7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java @@ -15,20 +15,21 @@ package net.consensys.linea.zktracer.module.blockdata; -import static net.consensys.linea.zktracer.module.blockdata.Trace.CT_MAX_FOR_BLOCKDATA; +import static net.consensys.linea.zktracer.module.blockdata.Trace.nROWS_DEPTH; import java.math.BigInteger; import java.nio.MappedByteBuffer; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.List; +import java.util.*; import lombok.RequiredArgsConstructor; import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.container.module.Module; -import net.consensys.linea.zktracer.module.rlptxn.RlpTxn; +import net.consensys.linea.zktracer.module.euc.Euc; import net.consensys.linea.zktracer.module.txndata.TxnData; import net.consensys.linea.zktracer.module.wcp.Wcp; +import net.consensys.linea.zktracer.opcode.OpCode; +import net.consensys.linea.zktracer.types.EWord; +import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.evm.worldstate.WorldView; import org.hyperledger.besu.plugin.data.BlockBody; import org.hyperledger.besu.plugin.data.BlockHeader; @@ -36,13 +37,29 @@ @RequiredArgsConstructor public class Blockdata implements Module { private final Wcp wcp; + private final Euc euc; private final TxnData txnData; - private final RlpTxn rlpTxn; - private final BigInteger chainId; + private final Deque operations = new ArrayDeque<>(); - private boolean conflationFinished = false; private static final int TIMESTAMP_BYTESIZE = 4; - private int previousTimestamp = 0; + private BlockHeader prevBlockHeader; + private int traceCounter = 0; + private long firstBlockNumber; + private Bytes chainId; + + final OpCode[] opCodes = { + OpCode.COINBASE, + OpCode.TIMESTAMP, + OpCode.NUMBER, + OpCode.DIFFICULTY, + OpCode.GASLIMIT, + OpCode.CHAINID, + OpCode.BASEFEE + }; + + public void setChainId(BigInteger chainId) { + this.chainId = EWord.of(chainId).lo(); + } @Override public String moduleKey() { @@ -51,28 +68,33 @@ public String moduleKey() { @Override public void traceStartConflation(final long blockCount) { - wcp.additionalRows.add(TIMESTAMP_BYTESIZE); + wcp.additionalRows.add(TIMESTAMP_BYTESIZE); // TODO: check } @Override public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { - final int currentTimestamp = (int) blockHeader.getTimestamp(); - operations.addLast( - new BlockdataOperation( - blockHeader.getCoinbase(), - currentTimestamp, - blockHeader.getNumber(), - blockHeader.getDifficulty().getAsBigInteger(), - txnData.currentBlock().getNbOfTxsInBlock())); - - wcp.callGT(currentTimestamp, previousTimestamp); - previousTimestamp = currentTimestamp; + final long blockNumber = blockHeader.getNumber(); + firstBlockNumber = (traceCounter < opCodes.length) ? blockNumber : firstBlockNumber; + for (OpCode opCode : opCodes) { + BlockdataOperation operation = + new BlockdataOperation( + blockHeader, + prevBlockHeader, + txnData.currentBlock().getNbOfTxsInBlock(), + wcp, + euc, + chainId, + opCode, + firstBlockNumber); + operations.addLast(operation); + // Increase counter to track where we are in the conflation + traceCounter++; + } + prevBlockHeader = blockHeader; } @Override - public void traceEndConflation(final WorldView state) { - conflationFinished = true; - } + public void traceEndConflation(final WorldView state) {} @Override public void enterTransaction() {} @@ -82,8 +104,8 @@ public void popTransaction() {} @Override public int lineCount() { - final int numberOfBlock = conflationFinished ? operations.size() : operations.size() + 1; - return numberOfBlock * (CT_MAX_FOR_BLOCKDATA + 1); + final int numberOfBlock = (operations.size() / opCodes.length); + return numberOfBlock * nROWS_DEPTH; } @Override @@ -95,10 +117,8 @@ public List columnsHeaders() { public void commit(List buffers) { final Trace trace = new Trace(buffers); - final long firstBlockNumber = operations.getFirst().absoluteBlockNumber(); - int relblock = 0; for (BlockdataOperation blockData : operations) { - blockData.trace(trace, ++relblock, firstBlockNumber, chainId); + blockData.trace(trace); } } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index 2d5f9ec71..d7985eaeb 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -15,137 +15,325 @@ package net.consensys.linea.zktracer.module.blockdata; -import static net.consensys.linea.zktracer.module.blockdata.Trace.CT_MAX_FOR_BLOCKDATA; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_BASEFEE; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_CHAINID; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_COINBASE; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_DIFFICULTY; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_GASLIMIT; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_NUMBER; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_TIMESTAMP; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_BASE_FEE; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_BLOCK_GAS_LIMIT; +import static com.google.common.base.Preconditions.checkArgument; +import static net.consensys.linea.zktracer.module.blockdata.Trace.*; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_GT; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_ISZERO; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_LT; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; -import static net.consensys.linea.zktracer.types.Conversions.bigIntegerToBytes; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_GEQ; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; +import static net.consensys.linea.zktracer.module.constants.Trace.GAS_LIMIT_ADJUSTMENT_FACTOR; +import static net.consensys.linea.zktracer.module.constants.Trace.LINEA_GAS_LIMIT_MAXIMUM; +import static net.consensys.linea.zktracer.module.constants.Trace.LINEA_GAS_LIMIT_MINIMUM; +import static net.consensys.linea.zktracer.types.Conversions.booleanToBytes; import java.math.BigInteger; +import java.util.Arrays; +import lombok.EqualsAndHashCode; import lombok.Getter; -import lombok.RequiredArgsConstructor; import lombok.experimental.Accessors; import net.consensys.linea.zktracer.container.ModuleOperation; +import net.consensys.linea.zktracer.module.euc.Euc; +import net.consensys.linea.zktracer.module.wcp.Wcp; +import net.consensys.linea.zktracer.opcode.OpCode; +import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.plugin.data.BlockHeader; @Accessors(fluent = true) @Getter -@RequiredArgsConstructor public class BlockdataOperation extends ModuleOperation { - private final Address coinbase; - private final long timestamp; - private final long absoluteBlockNumber; - private final BigInteger difficulty; + private final Wcp wcp; + private final Euc euc; + private final Bytes chainId; + private final BlockHeader blockHeader; + private final BlockHeader prevBlockHeader; + private final EWord POWER_256_20 = EWord.of(BigInteger.ONE.shiftLeft(20 * 8)); + private final EWord POWER_256_6 = EWord.of(BigInteger.ONE.shiftLeft(6 * 8)); + + private final boolean firstBlockInConflation; + private final int ctMax; + @EqualsAndHashCode.Include @Getter private final OpCode opCode; + private final long firstBlockNumber; private final int relTxMax; + private final long relBlock; + + private EWord data; + private EWord[] arg1; + private EWord[] arg2; + private Bytes[] res; + private final UnsignedByte[] exoInst; + private final boolean[] wcpFlag; + private final boolean[] eucFlag; + + public BlockdataOperation( + BlockHeader blockHeader, + BlockHeader prevBlockHeader, + int relTxMax, + Wcp wcp, + Euc euc, + Bytes chainId, + OpCode opCode, + long firstBlockNumber) { + // Data from blockHeader + this.blockHeader = blockHeader; + this.prevBlockHeader = prevBlockHeader; + + this.chainId = chainId; + this.ctMax = ctMax(opCode); + this.firstBlockNumber = firstBlockNumber; + this.relTxMax = relTxMax; + this.relBlock = blockHeader.getNumber() - firstBlockNumber + 1; + this.firstBlockInConflation = (blockHeader.getNumber() == firstBlockNumber); + this.wcp = wcp; + this.euc = euc; + this.opCode = opCode; + + // Init non-counter constant columns arrays of size ctMax + this.wcpFlag = new boolean[ctMax]; + this.eucFlag = new boolean[ctMax]; + this.exoInst = new UnsignedByte[ctMax]; + this.arg1 = new EWord[ctMax]; + this.arg2 = new EWord[ctMax]; + this.res = new Bytes[ctMax]; + Arrays.fill(exoInst, UnsignedByte.ZERO); + Arrays.fill(arg1, EWord.ZERO); + Arrays.fill(arg2, EWord.ZERO); + Arrays.fill(res, EWord.ZERO); + + // Handle opcodes + switch (opCode) { + case OpCode.COINBASE -> { + handleCoinbase(); + } + case OpCode.TIMESTAMP -> { + handleTimestamp(); + } + case OpCode.NUMBER -> { + handleNumber(); + } + case OpCode.DIFFICULTY -> { + handleDifficulty(); + } + case OpCode.GASLIMIT -> { + handleGasLimit(); + } + case OpCode.CHAINID -> { + handleChainId(); + } + case OpCode.BASEFEE -> { + handleBaseFee(); + } + } + } + + private void handleCoinbase() { + data = EWord.ofHexString(blockHeader.getCoinbase().toHexString()); + // row i + wcpCallToLT(0, data, POWER_256_20); + } + + private void handleTimestamp() { + data = EWord.of(blockHeader.getTimestamp()); + EWord prevData = + prevBlockHeader == null ? EWord.ZERO : EWord.of(prevBlockHeader.getTimestamp()); + + // row i + wcpCallToLT(0, data, POWER_256_6); + + // row i + 1 + wcpCallToGT(1, data, prevData); + } + + private void handleNumber() { + data = EWord.of(blockHeader.getNumber()); + + wcpCallToISZERO(0, EWord.of(firstBlockNumber)); + + // row i + if (firstBlockInConflation) { + wcpCallToLT(1, data, POWER_256_6); + } + } + + private void handleDifficulty() { + data = EWord.of(blockHeader.getDifficulty().getAsBigInteger()); + + // row i + wcpCallToGEQ(0, data, EWord.ZERO); + } + + private void handleGasLimit() { + data = EWord.of(blockHeader.getGasLimit()); + + // row i + wcpCallToGEQ(0, data, EWord.of(LINEA_GAS_LIMIT_MINIMUM)); + + // row i + 1 + wcpCallToLEQ(1, data, EWord.of(LINEA_GAS_LIMIT_MAXIMUM)); + + if (!firstBlockInConflation) { + EWord prevGasLimit = EWord.of(prevBlockHeader.getGasLimit()); + // row i + 2 + Bytes maxDeviation = eucCall(2, prevGasLimit, EWord.of(GAS_LIMIT_ADJUSTMENT_FACTOR)); + // row i + 3 + wcpCallToLT(3, data, EWord.of(prevGasLimit.toLong() + maxDeviation.toLong())); + + // row i + 4 + wcpCallToGT( + 4, + data, + EWord.of(prevGasLimit.toLong() - maxDeviation.toLong())); // TODO: double check this + } + } + + private void handleChainId() { + data = EWord.of(chainId); + + // row i + wcpCallToGEQ(0, data, EWord.ZERO); + } + + private void handleBaseFee() { + data = EWord.of(blockHeader.getBaseFee().get().getAsBigInteger()); + + // row i + wcpCallToGEQ(0, data, EWord.ZERO); + } @Override protected int computeLineCount() { - return CT_MAX_FOR_BLOCKDATA + 1; + return ctMax; } - public void trace( - Trace trace, final int relBlock, final long firstBlockNumber, final BigInteger chainId) { - for (short ct = 0; ct <= CT_MAX_FOR_BLOCKDATA; ct++) { - traceBlockConstant(trace, relBlock, firstBlockNumber); - traceRowDependant(trace, ct, relBlock, chainId); + public void trace(Trace trace) { + for (short ct = 0; ct < ctMax; ct++) { + trace + .iomf(true) + .ctMax(ctMax - 1) + .ct(ct) + .isCoinbase(opCode == OpCode.COINBASE) + .isTimestamp(opCode == OpCode.TIMESTAMP) + .isNumber(opCode == OpCode.NUMBER) + .isDifficulty(opCode == OpCode.DIFFICULTY) + .isGaslimit(opCode == OpCode.GASLIMIT) + .isChainid(opCode == OpCode.CHAINID) + .isBasefee(opCode == OpCode.BASEFEE) + .inst(UnsignedByte.of(opCode.byteValue())) + .coinbaseHi(blockHeader.getCoinbase().slice(0, 4).toLong()) + .coinbaseLo(blockHeader.getCoinbase().slice(4, LLARGE)) + .blockGasLimit(blockHeader.getGasLimit()) + .basefee(blockHeader.getBaseFee().get().getAsBigInteger().longValue()) + .firstBlockNumber(firstBlockNumber) + .relBlock((short) relBlock) + .relTxNumMax((short) relTxMax) + .dataHi(data.hi()) + .dataLo(data.lo()) + .arg1Hi(arg1[ct].hi()) + .arg1Lo(arg1[ct].lo()) + .arg2Hi(arg2[ct].hi()) + .arg2Lo(arg2[ct].lo()) + .res(res[ct]) + .exoInst(exoInst[ct]) + .wcpFlag(wcpFlag[ct]) + .eucFlag(eucFlag[ct]); + trace.validateRow(); } } - private void traceRowDependant( - Trace trace, final short ct, final int relBlock, final BigInteger chainId) { - trace.ct(ct); + // Module call macros + private boolean wcpCallTo(int w, EWord arg1, EWord arg2, int inst) { + checkArgument(arg1.bitLength() / 8 <= 32); + checkArgument(arg2.bitLength() / 8 <= 32); + + this.arg1[w] = arg1; + this.arg2[w] = arg2; + + final boolean r; + r = + switch (inst) { + case EVM_INST_LT -> wcp.callLT(arg1, arg2); + case EVM_INST_GT -> wcp.callGT(arg1, arg2); + case WCP_INST_LEQ -> wcp.callLEQ(arg1, arg2); + case WCP_INST_GEQ -> wcp.callGEQ(arg1, arg2); + case EVM_INST_ISZERO -> wcp.callISZERO(arg1); + default -> throw new IllegalStateException("Unexpected value: " + inst); + }; + res[w] = booleanToBytes(r); + + exoInst[w] = UnsignedByte.of(inst); + + wcpFlag[w] = true; + eucFlag[w] = false; + + return r; + } + + private boolean wcpCallToLT(int w, EWord arg1, EWord arg2) { + return wcpCallTo(w, arg1, arg2, EVM_INST_LT); + } - Bytes32 data; - switch (ct) { - case 0 -> { - data = Bytes32.leftPad(this.coinbase); - trace.inst(UnsignedByte.of(EVM_INST_COINBASE)).wcpFlag(false); + private boolean wcpCallToGT(int w, EWord arg1, EWord arg2) { + return wcpCallTo(w, arg1, arg2, EVM_INST_GT); + } + + private boolean wcpCallToLEQ(int w, EWord arg1, EWord arg2) { + return wcpCallTo(w, arg1, arg2, WCP_INST_LEQ); + } + + private boolean wcpCallToGEQ(int w, EWord arg1, EWord arg2) { + return wcpCallTo(w, arg1, arg2, WCP_INST_GEQ); + } + + private boolean wcpCallToISZERO(int w, EWord arg1) { + return wcpCallTo(w, arg1, EWord.ZERO, EVM_INST_ISZERO); + } + + private Bytes eucCall(int w, EWord arg1, EWord arg2) { + checkArgument(arg1.bitLength() / 8 <= 16); + checkArgument(arg2.bitLength() / 8 <= 16); + + this.arg1[w] = arg1; + this.arg2[w] = arg2; + + res[w] = euc.callEUC(arg1, arg2).quotient(); + + wcpFlag[w] = false; + eucFlag[w] = true; + + return res[w]; + } + + private int ctMax(OpCode opCode) { + switch (opCode) { + case OpCode.COINBASE -> { + return nROWS_CB; } - case 1 -> { - data = Bytes32.leftPad(Bytes.ofUnsignedLong(this.timestamp)); - trace.inst(UnsignedByte.of(EVM_INST_TIMESTAMP)).wcpFlag(relBlock != 1); + case OpCode.TIMESTAMP -> { + return nROWS_TS; } - case 2 -> { - data = Bytes32.leftPad(Bytes.ofUnsignedLong(this.absoluteBlockNumber)); - trace.inst(UnsignedByte.of(EVM_INST_NUMBER)).wcpFlag(false); + case OpCode.NUMBER -> { + return nROWS_NB; } - case 3 -> { - data = Bytes32.leftPad(bigIntegerToBytes(this.difficulty)); - trace.inst(UnsignedByte.of(EVM_INST_DIFFICULTY)).wcpFlag(false); + case OpCode.DIFFICULTY -> { + return nROWS_DF; } - case 4 -> { - data = Bytes32.leftPad(Bytes.ofUnsignedLong(LINEA_BLOCK_GAS_LIMIT)); - trace.inst(UnsignedByte.of(EVM_INST_GASLIMIT)).wcpFlag(false); + case OpCode.GASLIMIT -> { + return nROWS_GL; } - case 5 -> { - data = Bytes32.leftPad(bigIntegerToBytes(chainId)); - trace.inst(UnsignedByte.of(EVM_INST_CHAINID)).wcpFlag(false); + case OpCode.CHAINID -> { + return nROWS_ID; } - case 6 -> { - data = Bytes32.leftPad(Bytes.ofUnsignedLong(LINEA_BASE_FEE)); - trace.inst(UnsignedByte.of(EVM_INST_BASEFEE)).wcpFlag(false); + case OpCode.BASEFEE -> { + return nROWS_BF; + } + default -> { + return nROWS_DEPTH; } - default -> throw new IllegalArgumentException( - String.format("Blockdata max CT is %s, can't write %s", CT_MAX_FOR_BLOCKDATA, ct)); } - - trace - .dataHi(data.slice(0, LLARGE)) - .dataLo(data.slice(LLARGE, LLARGE)) - .byteHi0(UnsignedByte.of(data.get(0))) - .byteHi1(UnsignedByte.of(data.get(1))) - .byteHi2(UnsignedByte.of(data.get(2))) - .byteHi3(UnsignedByte.of(data.get(3))) - .byteHi4(UnsignedByte.of(data.get(4))) - .byteHi5(UnsignedByte.of(data.get(5))) - .byteHi6(UnsignedByte.of(data.get(6))) - .byteHi7(UnsignedByte.of(data.get(7))) - .byteHi8(UnsignedByte.of(data.get(8))) - .byteHi9(UnsignedByte.of(data.get(9))) - .byteHi10(UnsignedByte.of(data.get(10))) - .byteHi11(UnsignedByte.of(data.get(11))) - .byteHi12(UnsignedByte.of(data.get(12))) - .byteHi13(UnsignedByte.of(data.get(13))) - .byteHi14(UnsignedByte.of(data.get(14))) - .byteHi15(UnsignedByte.of(data.get(15))) - .byteLo0(UnsignedByte.of(data.get(LLARGE + 0))) - .byteLo1(UnsignedByte.of(data.get(LLARGE + 1))) - .byteLo2(UnsignedByte.of(data.get(LLARGE + 2))) - .byteLo3(UnsignedByte.of(data.get(LLARGE + 3))) - .byteLo4(UnsignedByte.of(data.get(LLARGE + 4))) - .byteLo5(UnsignedByte.of(data.get(LLARGE + 5))) - .byteLo6(UnsignedByte.of(data.get(LLARGE + 6))) - .byteLo7(UnsignedByte.of(data.get(LLARGE + 7))) - .byteLo8(UnsignedByte.of(data.get(LLARGE + 8))) - .byteLo9(UnsignedByte.of(data.get(LLARGE + 9))) - .byteLo10(UnsignedByte.of(data.get(LLARGE + 10))) - .byteLo11(UnsignedByte.of(data.get(LLARGE + 11))) - .byteLo12(UnsignedByte.of(data.get(LLARGE + 12))) - .byteLo13(UnsignedByte.of(data.get(LLARGE + 13))) - .byteLo14(UnsignedByte.of(data.get(LLARGE + 14))) - .byteLo15(UnsignedByte.of(data.get(LLARGE + 15))); - } - - private void traceBlockConstant(Trace trace, final int relBlock, final long firstBlockNumber) { - trace - .firstBlockNumber(firstBlockNumber) - .relBlock((short) relBlock) - .relTxNumMax((short) this.relTxMax) - .coinbaseHi(this.coinbase.slice(0, 4).toLong()) - .coinbaseLo(this.coinbase.slice(4, LLARGE)) - .blockGasLimit(LINEA_BLOCK_GAS_LIMIT) - .basefee(LINEA_BASE_FEE); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java index 6df04d63f..0a3c9796d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java @@ -31,157 +31,109 @@ * Please DO NOT ATTEMPT TO MODIFY this code directly. */ public class Trace { - public static final int CT_MAX_FOR_BLOCKDATA = 0x6; - public static final int ROW_SHIFT_BASEFEE = 0x6; - public static final int ROW_SHIFT_CHAINID = 0x5; - public static final int ROW_SHIFT_COINBASE = 0x0; - public static final int ROW_SHIFT_DIFFICULTY = 0x3; - public static final int ROW_SHIFT_GASLIMIT = 0x4; - public static final int ROW_SHIFT_NUMBER = 0x2; - public static final int ROW_SHIFT_TIMESTAMP = 0x1; + public static final int nROWS_BF = 0x1; + public static final int nROWS_CB = 0x1; + public static final int nROWS_DEPTH = 0xd; + public static final int nROWS_DF = 0x1; + public static final int nROWS_GL = 0x5; + public static final int nROWS_ID = 0x1; + public static final int nROWS_NB = 0x2; + public static final int nROWS_TS = 0x2; private final BitSet filled = new BitSet(); private int currentLine = 0; + private final MappedByteBuffer arg1Hi; + private final MappedByteBuffer arg1Lo; + private final MappedByteBuffer arg2Hi; + private final MappedByteBuffer arg2Lo; private final MappedByteBuffer basefee; private final MappedByteBuffer blockGasLimit; - private final MappedByteBuffer byteHi0; - private final MappedByteBuffer byteHi1; - private final MappedByteBuffer byteHi10; - private final MappedByteBuffer byteHi11; - private final MappedByteBuffer byteHi12; - private final MappedByteBuffer byteHi13; - private final MappedByteBuffer byteHi14; - private final MappedByteBuffer byteHi15; - private final MappedByteBuffer byteHi2; - private final MappedByteBuffer byteHi3; - private final MappedByteBuffer byteHi4; - private final MappedByteBuffer byteHi5; - private final MappedByteBuffer byteHi6; - private final MappedByteBuffer byteHi7; - private final MappedByteBuffer byteHi8; - private final MappedByteBuffer byteHi9; - private final MappedByteBuffer byteLo0; - private final MappedByteBuffer byteLo1; - private final MappedByteBuffer byteLo10; - private final MappedByteBuffer byteLo11; - private final MappedByteBuffer byteLo12; - private final MappedByteBuffer byteLo13; - private final MappedByteBuffer byteLo14; - private final MappedByteBuffer byteLo15; - private final MappedByteBuffer byteLo2; - private final MappedByteBuffer byteLo3; - private final MappedByteBuffer byteLo4; - private final MappedByteBuffer byteLo5; - private final MappedByteBuffer byteLo6; - private final MappedByteBuffer byteLo7; - private final MappedByteBuffer byteLo8; - private final MappedByteBuffer byteLo9; private final MappedByteBuffer coinbaseHi; private final MappedByteBuffer coinbaseLo; private final MappedByteBuffer ct; + private final MappedByteBuffer ctMax; private final MappedByteBuffer dataHi; private final MappedByteBuffer dataLo; + private final MappedByteBuffer eucFlag; + private final MappedByteBuffer exoInst; private final MappedByteBuffer firstBlockNumber; private final MappedByteBuffer inst; + private final MappedByteBuffer iomf; + private final MappedByteBuffer isBasefee; + private final MappedByteBuffer isChainid; + private final MappedByteBuffer isCoinbase; + private final MappedByteBuffer isDifficulty; + private final MappedByteBuffer isGaslimit; + private final MappedByteBuffer isNumber; + private final MappedByteBuffer isTimestamp; private final MappedByteBuffer relBlock; private final MappedByteBuffer relTxNumMax; + private final MappedByteBuffer res; private final MappedByteBuffer wcpFlag; static List headers(int length) { List headers = new ArrayList<>(); + headers.add(new ColumnHeader("blockdata.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_2_LO", 16, length)); headers.add(new ColumnHeader("blockdata.BASEFEE", 6, length)); headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 6, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_0", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_1", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_10", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_11", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_12", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_13", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_14", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_15", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_2", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_3", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_4", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_5", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_6", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_7", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_8", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_HI_9", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_0", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_1", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_10", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_11", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_12", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_13", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_14", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_15", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_2", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_3", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_4", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_5", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_6", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_7", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_8", 1, length)); - headers.add(new ColumnHeader("blockdata.BYTE_LO_9", 1, length)); headers.add(new ColumnHeader("blockdata.COINBASE_HI", 4, length)); headers.add(new ColumnHeader("blockdata.COINBASE_LO", 16, length)); headers.add(new ColumnHeader("blockdata.CT", 1, length)); + headers.add(new ColumnHeader("blockdata.CT_MAX", 1, length)); headers.add(new ColumnHeader("blockdata.DATA_HI", 16, length)); headers.add(new ColumnHeader("blockdata.DATA_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.EUC_FLAG", 1, length)); + headers.add(new ColumnHeader("blockdata.EXO_INST", 1, length)); headers.add(new ColumnHeader("blockdata.FIRST_BLOCK_NUMBER", 6, length)); headers.add(new ColumnHeader("blockdata.INST", 1, length)); - headers.add(new ColumnHeader("blockdata.REL_BLOCK", 2, length)); + headers.add(new ColumnHeader("blockdata.IOMF", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_BASEFEE", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_CHAINID", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_COINBASE", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_DIFFICULTY", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_GASLIMIT", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_NUMBER", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_TIMESTAMP", 1, length)); + headers.add(new ColumnHeader("blockdata.REL_BLOCK", 1, length)); headers.add(new ColumnHeader("blockdata.REL_TX_NUM_MAX", 2, length)); + headers.add(new ColumnHeader("blockdata.RES", 16, length)); headers.add(new ColumnHeader("blockdata.WCP_FLAG", 1, length)); return headers; } public Trace(List buffers) { - this.basefee = buffers.get(0); - this.blockGasLimit = buffers.get(1); - this.byteHi0 = buffers.get(2); - this.byteHi1 = buffers.get(3); - this.byteHi10 = buffers.get(4); - this.byteHi11 = buffers.get(5); - this.byteHi12 = buffers.get(6); - this.byteHi13 = buffers.get(7); - this.byteHi14 = buffers.get(8); - this.byteHi15 = buffers.get(9); - this.byteHi2 = buffers.get(10); - this.byteHi3 = buffers.get(11); - this.byteHi4 = buffers.get(12); - this.byteHi5 = buffers.get(13); - this.byteHi6 = buffers.get(14); - this.byteHi7 = buffers.get(15); - this.byteHi8 = buffers.get(16); - this.byteHi9 = buffers.get(17); - this.byteLo0 = buffers.get(18); - this.byteLo1 = buffers.get(19); - this.byteLo10 = buffers.get(20); - this.byteLo11 = buffers.get(21); - this.byteLo12 = buffers.get(22); - this.byteLo13 = buffers.get(23); - this.byteLo14 = buffers.get(24); - this.byteLo15 = buffers.get(25); - this.byteLo2 = buffers.get(26); - this.byteLo3 = buffers.get(27); - this.byteLo4 = buffers.get(28); - this.byteLo5 = buffers.get(29); - this.byteLo6 = buffers.get(30); - this.byteLo7 = buffers.get(31); - this.byteLo8 = buffers.get(32); - this.byteLo9 = buffers.get(33); - this.coinbaseHi = buffers.get(34); - this.coinbaseLo = buffers.get(35); - this.ct = buffers.get(36); - this.dataHi = buffers.get(37); - this.dataLo = buffers.get(38); - this.firstBlockNumber = buffers.get(39); - this.inst = buffers.get(40); - this.relBlock = buffers.get(41); - this.relTxNumMax = buffers.get(42); - this.wcpFlag = buffers.get(43); + this.arg1Hi = buffers.get(0); + this.arg1Lo = buffers.get(1); + this.arg2Hi = buffers.get(2); + this.arg2Lo = buffers.get(3); + this.basefee = buffers.get(4); + this.blockGasLimit = buffers.get(5); + this.coinbaseHi = buffers.get(6); + this.coinbaseLo = buffers.get(7); + this.ct = buffers.get(8); + this.ctMax = buffers.get(9); + this.dataHi = buffers.get(10); + this.dataLo = buffers.get(11); + this.eucFlag = buffers.get(12); + this.exoInst = buffers.get(13); + this.firstBlockNumber = buffers.get(14); + this.inst = buffers.get(15); + this.iomf = buffers.get(16); + this.isBasefee = buffers.get(17); + this.isChainid = buffers.get(18); + this.isCoinbase = buffers.get(19); + this.isDifficulty = buffers.get(20); + this.isGaslimit = buffers.get(21); + this.isNumber = buffers.get(22); + this.isTimestamp = buffers.get(23); + this.relBlock = buffers.get(24); + this.relTxNumMax = buffers.get(25); + this.res = buffers.get(26); + this.wcpFlag = buffers.get(27); } public int size() { @@ -192,611 +144,491 @@ public int size() { return this.currentLine; } - public Trace basefee(final long b) { + public Trace arg1Hi(final Bytes b) { if (filled.get(0)) { - throw new IllegalStateException("blockdata.BASEFEE already set"); + throw new IllegalStateException("blockdata.ARG_1_HI already set"); } else { filled.set(0); } - if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockdata.BASEFEE has invalid value (" + b + ")"); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + arg1Hi.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + arg1Hi.put(bs.get(j)); } - basefee.put((byte) (b >> 40)); - basefee.put((byte) (b >> 32)); - basefee.put((byte) (b >> 24)); - basefee.put((byte) (b >> 16)); - basefee.put((byte) (b >> 8)); - basefee.put((byte) b); return this; } - public Trace blockGasLimit(final long b) { + public Trace arg1Lo(final Bytes b) { if (filled.get(1)) { - throw new IllegalStateException("blockdata.BLOCK_GAS_LIMIT already set"); + throw new IllegalStateException("blockdata.ARG_1_LO already set"); } else { filled.set(1); } - if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockdata.BLOCK_GAS_LIMIT has invalid value (" + b + ")"); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + arg1Lo.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + arg1Lo.put(bs.get(j)); } - blockGasLimit.put((byte) (b >> 40)); - blockGasLimit.put((byte) (b >> 32)); - blockGasLimit.put((byte) (b >> 24)); - blockGasLimit.put((byte) (b >> 16)); - blockGasLimit.put((byte) (b >> 8)); - blockGasLimit.put((byte) b); return this; } - public Trace byteHi0(final UnsignedByte b) { + public Trace arg2Hi(final Bytes b) { if (filled.get(2)) { - throw new IllegalStateException("blockdata.BYTE_HI_0 already set"); + throw new IllegalStateException("blockdata.ARG_2_HI already set"); } else { filled.set(2); } - byteHi0.put(b.toByte()); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + arg2Hi.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + arg2Hi.put(bs.get(j)); + } return this; } - public Trace byteHi1(final UnsignedByte b) { + public Trace arg2Lo(final Bytes b) { if (filled.get(3)) { - throw new IllegalStateException("blockdata.BYTE_HI_1 already set"); + throw new IllegalStateException("blockdata.ARG_2_LO already set"); } else { filled.set(3); } - byteHi1.put(b.toByte()); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + arg2Lo.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + arg2Lo.put(bs.get(j)); + } return this; } - public Trace byteHi10(final UnsignedByte b) { + public Trace basefee(final long b) { if (filled.get(4)) { - throw new IllegalStateException("blockdata.BYTE_HI_10 already set"); + throw new IllegalStateException("blockdata.BASEFEE already set"); } else { filled.set(4); } - byteHi10.put(b.toByte()); + if (b >= 281474976710656L) { + throw new IllegalArgumentException("blockdata.BASEFEE has invalid value (" + b + ")"); + } + basefee.put((byte) (b >> 40)); + basefee.put((byte) (b >> 32)); + basefee.put((byte) (b >> 24)); + basefee.put((byte) (b >> 16)); + basefee.put((byte) (b >> 8)); + basefee.put((byte) b); return this; } - public Trace byteHi11(final UnsignedByte b) { + public Trace blockGasLimit(final long b) { if (filled.get(5)) { - throw new IllegalStateException("blockdata.BYTE_HI_11 already set"); + throw new IllegalStateException("blockdata.BLOCK_GAS_LIMIT already set"); } else { filled.set(5); } - byteHi11.put(b.toByte()); + if (b >= 281474976710656L) { + throw new IllegalArgumentException("blockdata.BLOCK_GAS_LIMIT has invalid value (" + b + ")"); + } + blockGasLimit.put((byte) (b >> 40)); + blockGasLimit.put((byte) (b >> 32)); + blockGasLimit.put((byte) (b >> 24)); + blockGasLimit.put((byte) (b >> 16)); + blockGasLimit.put((byte) (b >> 8)); + blockGasLimit.put((byte) b); return this; } - public Trace byteHi12(final UnsignedByte b) { + public Trace coinbaseHi(final long b) { if (filled.get(6)) { - throw new IllegalStateException("blockdata.BYTE_HI_12 already set"); + throw new IllegalStateException("blockdata.COINBASE_HI already set"); } else { filled.set(6); } - byteHi12.put(b.toByte()); + if (b >= 4294967296L) { + throw new IllegalArgumentException("blockdata.COINBASE_HI has invalid value (" + b + ")"); + } + coinbaseHi.put((byte) (b >> 24)); + coinbaseHi.put((byte) (b >> 16)); + coinbaseHi.put((byte) (b >> 8)); + coinbaseHi.put((byte) b); return this; } - public Trace byteHi13(final UnsignedByte b) { + public Trace coinbaseLo(final Bytes b) { if (filled.get(7)) { - throw new IllegalStateException("blockdata.BYTE_HI_13 already set"); + throw new IllegalStateException("blockdata.COINBASE_LO already set"); } else { filled.set(7); } - byteHi13.put(b.toByte()); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + coinbaseLo.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + coinbaseLo.put(bs.get(j)); + } return this; } - public Trace byteHi14(final UnsignedByte b) { + public Trace ct(final long b) { if (filled.get(8)) { - throw new IllegalStateException("blockdata.BYTE_HI_14 already set"); + throw new IllegalStateException("blockdata.CT already set"); } else { filled.set(8); } - byteHi14.put(b.toByte()); + if (b >= 8L) { + throw new IllegalArgumentException("blockdata.CT has invalid value (" + b + ")"); + } + ct.put((byte) b); return this; } - public Trace byteHi15(final UnsignedByte b) { + public Trace ctMax(final long b) { if (filled.get(9)) { - throw new IllegalStateException("blockdata.BYTE_HI_15 already set"); + throw new IllegalStateException("blockdata.CT_MAX already set"); } else { filled.set(9); } - byteHi15.put(b.toByte()); + if (b >= 8L) { + throw new IllegalArgumentException("blockdata.CT_MAX has invalid value (" + b + ")"); + } + ctMax.put((byte) b); return this; } - public Trace byteHi2(final UnsignedByte b) { + public Trace dataHi(final Bytes b) { if (filled.get(10)) { - throw new IllegalStateException("blockdata.BYTE_HI_2 already set"); + throw new IllegalStateException("blockdata.DATA_HI already set"); } else { filled.set(10); } - byteHi2.put(b.toByte()); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + dataHi.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + dataHi.put(bs.get(j)); + } return this; } - public Trace byteHi3(final UnsignedByte b) { + public Trace dataLo(final Bytes b) { if (filled.get(11)) { - throw new IllegalStateException("blockdata.BYTE_HI_3 already set"); + throw new IllegalStateException("blockdata.DATA_LO already set"); } else { filled.set(11); } - byteHi3.put(b.toByte()); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockdata.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + dataLo.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + dataLo.put(bs.get(j)); + } return this; } - public Trace byteHi4(final UnsignedByte b) { + public Trace eucFlag(final Boolean b) { if (filled.get(12)) { - throw new IllegalStateException("blockdata.BYTE_HI_4 already set"); + throw new IllegalStateException("blockdata.EUC_FLAG already set"); } else { filled.set(12); } - byteHi4.put(b.toByte()); + eucFlag.put((byte) (b ? 1 : 0)); return this; } - public Trace byteHi5(final UnsignedByte b) { + public Trace exoInst(final UnsignedByte b) { if (filled.get(13)) { - throw new IllegalStateException("blockdata.BYTE_HI_5 already set"); + throw new IllegalStateException("blockdata.EXO_INST already set"); } else { filled.set(13); } - byteHi5.put(b.toByte()); + exoInst.put(b.toByte()); return this; } - public Trace byteHi6(final UnsignedByte b) { + public Trace firstBlockNumber(final long b) { if (filled.get(14)) { - throw new IllegalStateException("blockdata.BYTE_HI_6 already set"); + throw new IllegalStateException("blockdata.FIRST_BLOCK_NUMBER already set"); } else { filled.set(14); } - byteHi6.put(b.toByte()); + if (b >= 281474976710656L) { + throw new IllegalArgumentException( + "blockdata.FIRST_BLOCK_NUMBER has invalid value (" + b + ")"); + } + firstBlockNumber.put((byte) (b >> 40)); + firstBlockNumber.put((byte) (b >> 32)); + firstBlockNumber.put((byte) (b >> 24)); + firstBlockNumber.put((byte) (b >> 16)); + firstBlockNumber.put((byte) (b >> 8)); + firstBlockNumber.put((byte) b); return this; } - public Trace byteHi7(final UnsignedByte b) { + public Trace inst(final UnsignedByte b) { if (filled.get(15)) { - throw new IllegalStateException("blockdata.BYTE_HI_7 already set"); + throw new IllegalStateException("blockdata.INST already set"); } else { filled.set(15); } - byteHi7.put(b.toByte()); + inst.put(b.toByte()); return this; } - public Trace byteHi8(final UnsignedByte b) { + public Trace iomf(final Boolean b) { if (filled.get(16)) { - throw new IllegalStateException("blockdata.BYTE_HI_8 already set"); + throw new IllegalStateException("blockdata.IOMF already set"); } else { filled.set(16); } - byteHi8.put(b.toByte()); + iomf.put((byte) (b ? 1 : 0)); return this; } - public Trace byteHi9(final UnsignedByte b) { + public Trace isBasefee(final Boolean b) { if (filled.get(17)) { - throw new IllegalStateException("blockdata.BYTE_HI_9 already set"); + throw new IllegalStateException("blockdata.IS_BASEFEE already set"); } else { filled.set(17); } - byteHi9.put(b.toByte()); + isBasefee.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo0(final UnsignedByte b) { + public Trace isChainid(final Boolean b) { if (filled.get(18)) { - throw new IllegalStateException("blockdata.BYTE_LO_0 already set"); + throw new IllegalStateException("blockdata.IS_CHAINID already set"); } else { filled.set(18); } - byteLo0.put(b.toByte()); + isChainid.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo1(final UnsignedByte b) { + public Trace isCoinbase(final Boolean b) { if (filled.get(19)) { - throw new IllegalStateException("blockdata.BYTE_LO_1 already set"); + throw new IllegalStateException("blockdata.IS_COINBASE already set"); } else { filled.set(19); } - byteLo1.put(b.toByte()); + isCoinbase.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo10(final UnsignedByte b) { + public Trace isDifficulty(final Boolean b) { if (filled.get(20)) { - throw new IllegalStateException("blockdata.BYTE_LO_10 already set"); + throw new IllegalStateException("blockdata.IS_DIFFICULTY already set"); } else { filled.set(20); } - byteLo10.put(b.toByte()); + isDifficulty.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo11(final UnsignedByte b) { + public Trace isGaslimit(final Boolean b) { if (filled.get(21)) { - throw new IllegalStateException("blockdata.BYTE_LO_11 already set"); + throw new IllegalStateException("blockdata.IS_GASLIMIT already set"); } else { filled.set(21); } - byteLo11.put(b.toByte()); + isGaslimit.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo12(final UnsignedByte b) { + public Trace isNumber(final Boolean b) { if (filled.get(22)) { - throw new IllegalStateException("blockdata.BYTE_LO_12 already set"); + throw new IllegalStateException("blockdata.IS_NUMBER already set"); } else { filled.set(22); } - byteLo12.put(b.toByte()); + isNumber.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo13(final UnsignedByte b) { + public Trace isTimestamp(final Boolean b) { if (filled.get(23)) { - throw new IllegalStateException("blockdata.BYTE_LO_13 already set"); + throw new IllegalStateException("blockdata.IS_TIMESTAMP already set"); } else { filled.set(23); } - byteLo13.put(b.toByte()); + isTimestamp.put((byte) (b ? 1 : 0)); return this; } - public Trace byteLo14(final UnsignedByte b) { + public Trace relBlock(final long b) { if (filled.get(24)) { - throw new IllegalStateException("blockdata.BYTE_LO_14 already set"); + throw new IllegalStateException("blockdata.REL_BLOCK already set"); } else { filled.set(24); } - byteLo14.put(b.toByte()); + if (b >= 256L) { + throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); + } + relBlock.put((byte) b); return this; } - public Trace byteLo15(final UnsignedByte b) { + public Trace relTxNumMax(final long b) { if (filled.get(25)) { - throw new IllegalStateException("blockdata.BYTE_LO_15 already set"); + throw new IllegalStateException("blockdata.REL_TX_NUM_MAX already set"); } else { filled.set(25); } - byteLo15.put(b.toByte()); + if (b >= 1024L) { + throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); + } + relTxNumMax.put((byte) (b >> 8)); + relTxNumMax.put((byte) b); return this; } - public Trace byteLo2(final UnsignedByte b) { + public Trace res(final Bytes b) { if (filled.get(26)) { - throw new IllegalStateException("blockdata.BYTE_LO_2 already set"); + throw new IllegalStateException("blockdata.RES already set"); } else { filled.set(26); } - byteLo2.put(b.toByte()); - - return this; - } - - public Trace byteLo3(final UnsignedByte b) { - if (filled.get(27)) { - throw new IllegalStateException("blockdata.BYTE_LO_3 already set"); - } else { - filled.set(27); - } - - byteLo3.put(b.toByte()); - - return this; - } - - public Trace byteLo4(final UnsignedByte b) { - if (filled.get(28)) { - throw new IllegalStateException("blockdata.BYTE_LO_4 already set"); - } else { - filled.set(28); - } - - byteLo4.put(b.toByte()); - - return this; - } - - public Trace byteLo5(final UnsignedByte b) { - if (filled.get(29)) { - throw new IllegalStateException("blockdata.BYTE_LO_5 already set"); - } else { - filled.set(29); - } - - byteLo5.put(b.toByte()); - - return this; - } - - public Trace byteLo6(final UnsignedByte b) { - if (filled.get(30)) { - throw new IllegalStateException("blockdata.BYTE_LO_6 already set"); - } else { - filled.set(30); - } - - byteLo6.put(b.toByte()); - - return this; - } - - public Trace byteLo7(final UnsignedByte b) { - if (filled.get(31)) { - throw new IllegalStateException("blockdata.BYTE_LO_7 already set"); - } else { - filled.set(31); - } - - byteLo7.put(b.toByte()); - - return this; - } - - public Trace byteLo8(final UnsignedByte b) { - if (filled.get(32)) { - throw new IllegalStateException("blockdata.BYTE_LO_8 already set"); - } else { - filled.set(32); - } - - byteLo8.put(b.toByte()); - - return this; - } - - public Trace byteLo9(final UnsignedByte b) { - if (filled.get(33)) { - throw new IllegalStateException("blockdata.BYTE_LO_9 already set"); - } else { - filled.set(33); - } - - byteLo9.put(b.toByte()); - - return this; - } - - public Trace coinbaseHi(final long b) { - if (filled.get(34)) { - throw new IllegalStateException("blockdata.COINBASE_HI already set"); - } else { - filled.set(34); - } - - if (b >= 4294967296L) { - throw new IllegalArgumentException("blockdata.COINBASE_HI has invalid value (" + b + ")"); - } - coinbaseHi.put((byte) (b >> 24)); - coinbaseHi.put((byte) (b >> 16)); - coinbaseHi.put((byte) (b >> 8)); - coinbaseHi.put((byte) b); - - return this; - } - - public Trace coinbaseLo(final Bytes b) { - if (filled.get(35)) { - throw new IllegalStateException("blockdata.COINBASE_LO already set"); - } else { - filled.set(35); - } - // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockdata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); + "blockdata.RES has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - coinbaseLo.put((byte) 0); + res.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - coinbaseLo.put(bs.get(j)); - } - - return this; - } - - public Trace ct(final long b) { - if (filled.get(36)) { - throw new IllegalStateException("blockdata.CT already set"); - } else { - filled.set(36); - } - - if (b >= 16L) { - throw new IllegalArgumentException("blockdata.CT has invalid value (" + b + ")"); - } - ct.put((byte) b); - - return this; - } - - public Trace dataHi(final Bytes b) { - if (filled.get(37)) { - throw new IllegalStateException("blockdata.DATA_HI already set"); - } else { - filled.set(37); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); - } - // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataHi.put((byte) 0); - } - // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataHi.put(bs.get(j)); - } - - return this; - } - - public Trace dataLo(final Bytes b) { - if (filled.get(38)) { - throw new IllegalStateException("blockdata.DATA_LO already set"); - } else { - filled.set(38); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); - } - // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataLo.put((byte) 0); - } - // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataLo.put(bs.get(j)); - } - - return this; - } - - public Trace firstBlockNumber(final long b) { - if (filled.get(39)) { - throw new IllegalStateException("blockdata.FIRST_BLOCK_NUMBER already set"); - } else { - filled.set(39); - } - - if (b >= 281474976710656L) { - throw new IllegalArgumentException( - "blockdata.FIRST_BLOCK_NUMBER has invalid value (" + b + ")"); - } - firstBlockNumber.put((byte) (b >> 40)); - firstBlockNumber.put((byte) (b >> 32)); - firstBlockNumber.put((byte) (b >> 24)); - firstBlockNumber.put((byte) (b >> 16)); - firstBlockNumber.put((byte) (b >> 8)); - firstBlockNumber.put((byte) b); - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(40)) { - throw new IllegalStateException("blockdata.INST already set"); - } else { - filled.set(40); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace relBlock(final long b) { - if (filled.get(41)) { - throw new IllegalStateException("blockdata.REL_BLOCK already set"); - } else { - filled.set(41); - } - - if (b >= 1024L) { - throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); - } - relBlock.put((byte) (b >> 8)); - relBlock.put((byte) b); - - return this; - } - - public Trace relTxNumMax(final long b) { - if (filled.get(42)) { - throw new IllegalStateException("blockdata.REL_TX_NUM_MAX already set"); - } else { - filled.set(42); - } - - if (b >= 1024L) { - throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); + res.put(bs.get(j)); } - relTxNumMax.put((byte) (b >> 8)); - relTxNumMax.put((byte) b); return this; } public Trace wcpFlag(final Boolean b) { - if (filled.get(43)) { + if (filled.get(27)) { throw new IllegalStateException("blockdata.WCP_FLAG already set"); } else { - filled.set(43); + filled.set(27); } wcpFlag.put((byte) (b ? 1 : 0)); @@ -806,178 +638,114 @@ public Trace wcpFlag(final Boolean b) { public Trace validateRow() { if (!filled.get(0)) { - throw new IllegalStateException("blockdata.BASEFEE has not been filled"); + throw new IllegalStateException("blockdata.ARG_1_HI has not been filled"); } if (!filled.get(1)) { - throw new IllegalStateException("blockdata.BLOCK_GAS_LIMIT has not been filled"); + throw new IllegalStateException("blockdata.ARG_1_LO has not been filled"); } if (!filled.get(2)) { - throw new IllegalStateException("blockdata.BYTE_HI_0 has not been filled"); + throw new IllegalStateException("blockdata.ARG_2_HI has not been filled"); } if (!filled.get(3)) { - throw new IllegalStateException("blockdata.BYTE_HI_1 has not been filled"); + throw new IllegalStateException("blockdata.ARG_2_LO has not been filled"); } if (!filled.get(4)) { - throw new IllegalStateException("blockdata.BYTE_HI_10 has not been filled"); + throw new IllegalStateException("blockdata.BASEFEE has not been filled"); } if (!filled.get(5)) { - throw new IllegalStateException("blockdata.BYTE_HI_11 has not been filled"); + throw new IllegalStateException("blockdata.BLOCK_GAS_LIMIT has not been filled"); } if (!filled.get(6)) { - throw new IllegalStateException("blockdata.BYTE_HI_12 has not been filled"); + throw new IllegalStateException("blockdata.COINBASE_HI has not been filled"); } if (!filled.get(7)) { - throw new IllegalStateException("blockdata.BYTE_HI_13 has not been filled"); + throw new IllegalStateException("blockdata.COINBASE_LO has not been filled"); } if (!filled.get(8)) { - throw new IllegalStateException("blockdata.BYTE_HI_14 has not been filled"); + throw new IllegalStateException("blockdata.CT has not been filled"); } if (!filled.get(9)) { - throw new IllegalStateException("blockdata.BYTE_HI_15 has not been filled"); + throw new IllegalStateException("blockdata.CT_MAX has not been filled"); } if (!filled.get(10)) { - throw new IllegalStateException("blockdata.BYTE_HI_2 has not been filled"); + throw new IllegalStateException("blockdata.DATA_HI has not been filled"); } if (!filled.get(11)) { - throw new IllegalStateException("blockdata.BYTE_HI_3 has not been filled"); + throw new IllegalStateException("blockdata.DATA_LO has not been filled"); } if (!filled.get(12)) { - throw new IllegalStateException("blockdata.BYTE_HI_4 has not been filled"); + throw new IllegalStateException("blockdata.EUC_FLAG has not been filled"); } if (!filled.get(13)) { - throw new IllegalStateException("blockdata.BYTE_HI_5 has not been filled"); + throw new IllegalStateException("blockdata.EXO_INST has not been filled"); } if (!filled.get(14)) { - throw new IllegalStateException("blockdata.BYTE_HI_6 has not been filled"); + throw new IllegalStateException("blockdata.FIRST_BLOCK_NUMBER has not been filled"); } if (!filled.get(15)) { - throw new IllegalStateException("blockdata.BYTE_HI_7 has not been filled"); + throw new IllegalStateException("blockdata.INST has not been filled"); } if (!filled.get(16)) { - throw new IllegalStateException("blockdata.BYTE_HI_8 has not been filled"); + throw new IllegalStateException("blockdata.IOMF has not been filled"); } if (!filled.get(17)) { - throw new IllegalStateException("blockdata.BYTE_HI_9 has not been filled"); + throw new IllegalStateException("blockdata.IS_BASEFEE has not been filled"); } if (!filled.get(18)) { - throw new IllegalStateException("blockdata.BYTE_LO_0 has not been filled"); + throw new IllegalStateException("blockdata.IS_CHAINID has not been filled"); } if (!filled.get(19)) { - throw new IllegalStateException("blockdata.BYTE_LO_1 has not been filled"); + throw new IllegalStateException("blockdata.IS_COINBASE has not been filled"); } if (!filled.get(20)) { - throw new IllegalStateException("blockdata.BYTE_LO_10 has not been filled"); + throw new IllegalStateException("blockdata.IS_DIFFICULTY has not been filled"); } if (!filled.get(21)) { - throw new IllegalStateException("blockdata.BYTE_LO_11 has not been filled"); + throw new IllegalStateException("blockdata.IS_GASLIMIT has not been filled"); } if (!filled.get(22)) { - throw new IllegalStateException("blockdata.BYTE_LO_12 has not been filled"); + throw new IllegalStateException("blockdata.IS_NUMBER has not been filled"); } if (!filled.get(23)) { - throw new IllegalStateException("blockdata.BYTE_LO_13 has not been filled"); + throw new IllegalStateException("blockdata.IS_TIMESTAMP has not been filled"); } if (!filled.get(24)) { - throw new IllegalStateException("blockdata.BYTE_LO_14 has not been filled"); + throw new IllegalStateException("blockdata.REL_BLOCK has not been filled"); } if (!filled.get(25)) { - throw new IllegalStateException("blockdata.BYTE_LO_15 has not been filled"); + throw new IllegalStateException("blockdata.REL_TX_NUM_MAX has not been filled"); } if (!filled.get(26)) { - throw new IllegalStateException("blockdata.BYTE_LO_2 has not been filled"); + throw new IllegalStateException("blockdata.RES has not been filled"); } if (!filled.get(27)) { - throw new IllegalStateException("blockdata.BYTE_LO_3 has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("blockdata.BYTE_LO_4 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("blockdata.BYTE_LO_5 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("blockdata.BYTE_LO_6 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("blockdata.BYTE_LO_7 has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("blockdata.BYTE_LO_8 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("blockdata.BYTE_LO_9 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("blockdata.COINBASE_HI has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("blockdata.COINBASE_LO has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("blockdata.CT has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("blockdata.DATA_HI has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("blockdata.DATA_LO has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("blockdata.FIRST_BLOCK_NUMBER has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("blockdata.INST has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("blockdata.REL_BLOCK has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("blockdata.REL_TX_NUM_MAX has not been filled"); - } - - if (!filled.get(43)) { throw new IllegalStateException("blockdata.WCP_FLAG has not been filled"); } @@ -989,178 +757,114 @@ public Trace validateRow() { public Trace fillAndValidateRow() { if (!filled.get(0)) { - basefee.position(basefee.position() + 6); + arg1Hi.position(arg1Hi.position() + 16); } if (!filled.get(1)) { - blockGasLimit.position(blockGasLimit.position() + 6); + arg1Lo.position(arg1Lo.position() + 16); } if (!filled.get(2)) { - byteHi0.position(byteHi0.position() + 1); + arg2Hi.position(arg2Hi.position() + 16); } if (!filled.get(3)) { - byteHi1.position(byteHi1.position() + 1); + arg2Lo.position(arg2Lo.position() + 16); } if (!filled.get(4)) { - byteHi10.position(byteHi10.position() + 1); + basefee.position(basefee.position() + 6); } if (!filled.get(5)) { - byteHi11.position(byteHi11.position() + 1); + blockGasLimit.position(blockGasLimit.position() + 6); } if (!filled.get(6)) { - byteHi12.position(byteHi12.position() + 1); + coinbaseHi.position(coinbaseHi.position() + 4); } if (!filled.get(7)) { - byteHi13.position(byteHi13.position() + 1); + coinbaseLo.position(coinbaseLo.position() + 16); } if (!filled.get(8)) { - byteHi14.position(byteHi14.position() + 1); + ct.position(ct.position() + 1); } if (!filled.get(9)) { - byteHi15.position(byteHi15.position() + 1); + ctMax.position(ctMax.position() + 1); } if (!filled.get(10)) { - byteHi2.position(byteHi2.position() + 1); + dataHi.position(dataHi.position() + 16); } if (!filled.get(11)) { - byteHi3.position(byteHi3.position() + 1); + dataLo.position(dataLo.position() + 16); } if (!filled.get(12)) { - byteHi4.position(byteHi4.position() + 1); + eucFlag.position(eucFlag.position() + 1); } if (!filled.get(13)) { - byteHi5.position(byteHi5.position() + 1); + exoInst.position(exoInst.position() + 1); } if (!filled.get(14)) { - byteHi6.position(byteHi6.position() + 1); + firstBlockNumber.position(firstBlockNumber.position() + 6); } if (!filled.get(15)) { - byteHi7.position(byteHi7.position() + 1); + inst.position(inst.position() + 1); } if (!filled.get(16)) { - byteHi8.position(byteHi8.position() + 1); + iomf.position(iomf.position() + 1); } if (!filled.get(17)) { - byteHi9.position(byteHi9.position() + 1); + isBasefee.position(isBasefee.position() + 1); } if (!filled.get(18)) { - byteLo0.position(byteLo0.position() + 1); + isChainid.position(isChainid.position() + 1); } if (!filled.get(19)) { - byteLo1.position(byteLo1.position() + 1); + isCoinbase.position(isCoinbase.position() + 1); } if (!filled.get(20)) { - byteLo10.position(byteLo10.position() + 1); + isDifficulty.position(isDifficulty.position() + 1); } if (!filled.get(21)) { - byteLo11.position(byteLo11.position() + 1); + isGaslimit.position(isGaslimit.position() + 1); } if (!filled.get(22)) { - byteLo12.position(byteLo12.position() + 1); + isNumber.position(isNumber.position() + 1); } if (!filled.get(23)) { - byteLo13.position(byteLo13.position() + 1); + isTimestamp.position(isTimestamp.position() + 1); } if (!filled.get(24)) { - byteLo14.position(byteLo14.position() + 1); + relBlock.position(relBlock.position() + 1); } if (!filled.get(25)) { - byteLo15.position(byteLo15.position() + 1); + relTxNumMax.position(relTxNumMax.position() + 2); } if (!filled.get(26)) { - byteLo2.position(byteLo2.position() + 1); + res.position(res.position() + 16); } if (!filled.get(27)) { - byteLo3.position(byteLo3.position() + 1); - } - - if (!filled.get(28)) { - byteLo4.position(byteLo4.position() + 1); - } - - if (!filled.get(29)) { - byteLo5.position(byteLo5.position() + 1); - } - - if (!filled.get(30)) { - byteLo6.position(byteLo6.position() + 1); - } - - if (!filled.get(31)) { - byteLo7.position(byteLo7.position() + 1); - } - - if (!filled.get(32)) { - byteLo8.position(byteLo8.position() + 1); - } - - if (!filled.get(33)) { - byteLo9.position(byteLo9.position() + 1); - } - - if (!filled.get(34)) { - coinbaseHi.position(coinbaseHi.position() + 4); - } - - if (!filled.get(35)) { - coinbaseLo.position(coinbaseLo.position() + 16); - } - - if (!filled.get(36)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(37)) { - dataHi.position(dataHi.position() + 16); - } - - if (!filled.get(38)) { - dataLo.position(dataLo.position() + 16); - } - - if (!filled.get(39)) { - firstBlockNumber.position(firstBlockNumber.position() + 6); - } - - if (!filled.get(40)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(41)) { - relBlock.position(relBlock.position() + 2); - } - - if (!filled.get(42)) { - relTxNumMax.position(relTxNumMax.position() + 2); - } - - if (!filled.get(43)) { wcpFlag.position(wcpFlag.position() + 1); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java new file mode 100644 index 000000000..088d7d85c --- /dev/null +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java @@ -0,0 +1,405 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.constants; + +import java.math.BigInteger; +import java.nio.MappedByteBuffer; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; + +import net.consensys.linea.zktracer.ColumnHeader; + +/** + * WARNING: This code is generated automatically. + * + *

Any modifications to this code may be overwritten and could lead to unexpected behavior. + * Please DO NOT ATTEMPT TO MODIFY this code directly. + */ +public class Trace { + public static final int BLOCKHASH_MAX_HISTORY = 0x100; + public static final int CREATE2_SHIFT = 0xff; + public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; + public static final int EIP_3541_MARKER = 0xef; + public static final BigInteger EMPTY_KECCAK_HI = + new BigInteger("262949717399590921288928019264691438528"); + public static final BigInteger EMPTY_KECCAK_LO = + new BigInteger("304396909071904405792975023732328604784"); + public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; + public static final BigInteger EMPTY_RIPEMD_LO = + new BigInteger("263072838190121256777638892741499129137"); + public static final BigInteger EMPTY_SHA2_HI = + new BigInteger("302652579918965577886386472538583578916"); + public static final BigInteger EMPTY_SHA2_LO = + new BigInteger("52744687940778649747319168982913824853"); + public static final int EVM_INST_ADD = 0x1; + public static final int EVM_INST_ADDMOD = 0x8; + public static final int EVM_INST_ADDRESS = 0x30; + public static final int EVM_INST_AND = 0x16; + public static final int EVM_INST_BALANCE = 0x31; + public static final int EVM_INST_BASEFEE = 0x48; + public static final int EVM_INST_BLOCKHASH = 0x40; + public static final int EVM_INST_BYTE = 0x1a; + public static final int EVM_INST_CALL = 0xf1; + public static final int EVM_INST_CALLCODE = 0xf2; + public static final int EVM_INST_CALLDATACOPY = 0x37; + public static final int EVM_INST_CALLDATALOAD = 0x35; + public static final int EVM_INST_CALLDATASIZE = 0x36; + public static final int EVM_INST_CALLER = 0x33; + public static final int EVM_INST_CALLVALUE = 0x34; + public static final int EVM_INST_CHAINID = 0x46; + public static final int EVM_INST_CODECOPY = 0x39; + public static final int EVM_INST_CODESIZE = 0x38; + public static final int EVM_INST_COINBASE = 0x41; + public static final int EVM_INST_CREATE = 0xf0; + public static final int EVM_INST_CREATE2 = 0xf5; + public static final int EVM_INST_DELEGATECALL = 0xf4; + public static final int EVM_INST_DIFFICULTY = 0x44; + public static final int EVM_INST_DIV = 0x4; + public static final int EVM_INST_DUP1 = 0x80; + public static final int EVM_INST_DUP10 = 0x89; + public static final int EVM_INST_DUP11 = 0x8a; + public static final int EVM_INST_DUP12 = 0x8b; + public static final int EVM_INST_DUP13 = 0x8c; + public static final int EVM_INST_DUP14 = 0x8d; + public static final int EVM_INST_DUP15 = 0x8e; + public static final int EVM_INST_DUP16 = 0x8f; + public static final int EVM_INST_DUP2 = 0x81; + public static final int EVM_INST_DUP3 = 0x82; + public static final int EVM_INST_DUP4 = 0x83; + public static final int EVM_INST_DUP5 = 0x84; + public static final int EVM_INST_DUP6 = 0x85; + public static final int EVM_INST_DUP7 = 0x86; + public static final int EVM_INST_DUP8 = 0x87; + public static final int EVM_INST_DUP9 = 0x88; + public static final int EVM_INST_EQ = 0x14; + public static final int EVM_INST_EXP = 0xa; + public static final int EVM_INST_EXTCODECOPY = 0x3c; + public static final int EVM_INST_EXTCODEHASH = 0x3f; + public static final int EVM_INST_EXTCODESIZE = 0x3b; + public static final int EVM_INST_GAS = 0x5a; + public static final int EVM_INST_GASLIMIT = 0x45; + public static final int EVM_INST_GASPRICE = 0x3a; + public static final int EVM_INST_GT = 0x11; + public static final int EVM_INST_INVALID = 0xfe; + public static final int EVM_INST_ISZERO = 0x15; + public static final int EVM_INST_JUMP = 0x56; + public static final int EVM_INST_JUMPDEST = 0x5b; + public static final int EVM_INST_JUMPI = 0x57; + public static final int EVM_INST_LOG0 = 0xa0; + public static final int EVM_INST_LOG1 = 0xa1; + public static final int EVM_INST_LOG2 = 0xa2; + public static final int EVM_INST_LOG3 = 0xa3; + public static final int EVM_INST_LOG4 = 0xa4; + public static final int EVM_INST_LT = 0x10; + public static final int EVM_INST_MLOAD = 0x51; + public static final int EVM_INST_MOD = 0x6; + public static final int EVM_INST_MSIZE = 0x59; + public static final int EVM_INST_MSTORE = 0x52; + public static final int EVM_INST_MSTORE8 = 0x53; + public static final int EVM_INST_MUL = 0x2; + public static final int EVM_INST_MULMOD = 0x9; + public static final int EVM_INST_NOT = 0x19; + public static final int EVM_INST_NUMBER = 0x43; + public static final int EVM_INST_OR = 0x17; + public static final int EVM_INST_ORIGIN = 0x32; + public static final int EVM_INST_PC = 0x58; + public static final int EVM_INST_POP = 0x50; + public static final int EVM_INST_PUSH1 = 0x60; + public static final int EVM_INST_PUSH10 = 0x69; + public static final int EVM_INST_PUSH11 = 0x6a; + public static final int EVM_INST_PUSH12 = 0x6b; + public static final int EVM_INST_PUSH13 = 0x6c; + public static final int EVM_INST_PUSH14 = 0x6d; + public static final int EVM_INST_PUSH15 = 0x6e; + public static final int EVM_INST_PUSH16 = 0x6f; + public static final int EVM_INST_PUSH17 = 0x70; + public static final int EVM_INST_PUSH18 = 0x71; + public static final int EVM_INST_PUSH19 = 0x72; + public static final int EVM_INST_PUSH2 = 0x61; + public static final int EVM_INST_PUSH20 = 0x73; + public static final int EVM_INST_PUSH21 = 0x74; + public static final int EVM_INST_PUSH22 = 0x75; + public static final int EVM_INST_PUSH23 = 0x76; + public static final int EVM_INST_PUSH24 = 0x77; + public static final int EVM_INST_PUSH25 = 0x78; + public static final int EVM_INST_PUSH26 = 0x79; + public static final int EVM_INST_PUSH27 = 0x7a; + public static final int EVM_INST_PUSH28 = 0x7b; + public static final int EVM_INST_PUSH29 = 0x7c; + public static final int EVM_INST_PUSH3 = 0x62; + public static final int EVM_INST_PUSH30 = 0x7d; + public static final int EVM_INST_PUSH31 = 0x7e; + public static final int EVM_INST_PUSH32 = 0x7f; + public static final int EVM_INST_PUSH4 = 0x63; + public static final int EVM_INST_PUSH5 = 0x64; + public static final int EVM_INST_PUSH6 = 0x65; + public static final int EVM_INST_PUSH7 = 0x66; + public static final int EVM_INST_PUSH8 = 0x67; + public static final int EVM_INST_PUSH9 = 0x68; + public static final int EVM_INST_RETURN = 0xf3; + public static final int EVM_INST_RETURNDATACOPY = 0x3e; + public static final int EVM_INST_RETURNDATASIZE = 0x3d; + public static final int EVM_INST_REVERT = 0xfd; + public static final int EVM_INST_SAR = 0x1d; + public static final int EVM_INST_SDIV = 0x5; + public static final int EVM_INST_SELFBALANCE = 0x47; + public static final int EVM_INST_SELFDESTRUCT = 0xff; + public static final int EVM_INST_SGT = 0x13; + public static final int EVM_INST_SHA3 = 0x20; + public static final int EVM_INST_SHL = 0x1b; + public static final int EVM_INST_SHR = 0x1c; + public static final int EVM_INST_SIGNEXTEND = 0xb; + public static final int EVM_INST_SLOAD = 0x54; + public static final int EVM_INST_SLT = 0x12; + public static final int EVM_INST_SMOD = 0x7; + public static final int EVM_INST_SSTORE = 0x55; + public static final int EVM_INST_STATICCALL = 0xfa; + public static final int EVM_INST_STOP = 0x0; + public static final int EVM_INST_SUB = 0x3; + public static final int EVM_INST_SWAP1 = 0x90; + public static final int EVM_INST_SWAP10 = 0x99; + public static final int EVM_INST_SWAP11 = 0x9a; + public static final int EVM_INST_SWAP12 = 0x9b; + public static final int EVM_INST_SWAP13 = 0x9c; + public static final int EVM_INST_SWAP14 = 0x9d; + public static final int EVM_INST_SWAP15 = 0x9e; + public static final int EVM_INST_SWAP16 = 0x9f; + public static final int EVM_INST_SWAP2 = 0x91; + public static final int EVM_INST_SWAP3 = 0x92; + public static final int EVM_INST_SWAP4 = 0x93; + public static final int EVM_INST_SWAP5 = 0x94; + public static final int EVM_INST_SWAP6 = 0x95; + public static final int EVM_INST_SWAP7 = 0x96; + public static final int EVM_INST_SWAP8 = 0x97; + public static final int EVM_INST_SWAP9 = 0x98; + public static final int EVM_INST_TIMESTAMP = 0x42; + public static final int EVM_INST_XOR = 0x18; + public static final int EXO_SUM_INDEX_BLAKEMODEXP = 0x6; + public static final int EXO_SUM_INDEX_ECDATA = 0x4; + public static final int EXO_SUM_INDEX_KEC = 0x1; + public static final int EXO_SUM_INDEX_LOG = 0x2; + public static final int EXO_SUM_INDEX_RIPSHA = 0x5; + public static final int EXO_SUM_INDEX_ROM = 0x0; + public static final int EXO_SUM_INDEX_TXCD = 0x3; + public static final int EXO_SUM_WEIGHT_BLAKEMODEXP = 0x40; + public static final int EXO_SUM_WEIGHT_ECDATA = 0x10; + public static final int EXO_SUM_WEIGHT_KEC = 0x2; + public static final int EXO_SUM_WEIGHT_LOG = 0x4; + public static final int EXO_SUM_WEIGHT_RIPSHA = 0x20; + public static final int EXO_SUM_WEIGHT_ROM = 0x1; + public static final int EXO_SUM_WEIGHT_TXCD = 0x8; + public static final int EXP_INST_EXPLOG = 0xee0a; + public static final int EXP_INST_MODEXPLOG = 0xee05; + public static final int GAS_CONST_G_ACCESS_LIST_ADRESS = 0x960; + public static final int GAS_CONST_G_ACCESS_LIST_STORAGE = 0x76c; + public static final int GAS_CONST_G_BASE = 0x2; + public static final int GAS_CONST_G_BLOCKHASH = 0x14; + public static final int GAS_CONST_G_CALL_STIPEND = 0x8fc; + public static final int GAS_CONST_G_CALL_VALUE = 0x2328; + public static final int GAS_CONST_G_CODE_DEPOSIT = 0xc8; + public static final int GAS_CONST_G_COLD_ACCOUNT_ACCESS = 0xa28; + public static final int GAS_CONST_G_COLD_SLOAD = 0x834; + public static final int GAS_CONST_G_COPY = 0x3; + public static final int GAS_CONST_G_CREATE = 0x7d00; + public static final int GAS_CONST_G_EXP = 0xa; + public static final int GAS_CONST_G_EXP_BYTE = 0x32; + public static final int GAS_CONST_G_HIGH = 0xa; + public static final int GAS_CONST_G_JUMPDEST = 0x1; + public static final int GAS_CONST_G_KECCAK_256 = 0x1e; + public static final int GAS_CONST_G_KECCAK_256_WORD = 0x6; + public static final int GAS_CONST_G_LOG = 0x177; + public static final int GAS_CONST_G_LOG_DATA = 0x8; + public static final int GAS_CONST_G_LOG_TOPIC = 0x177; + public static final int GAS_CONST_G_LOW = 0x5; + public static final int GAS_CONST_G_MEMORY = 0x3; + public static final int GAS_CONST_G_MID = 0x8; + public static final int GAS_CONST_G_NEW_ACCOUNT = 0x61a8; + public static final int GAS_CONST_G_SELFDESTRUCT = 0x1388; + public static final int GAS_CONST_G_SRESET = 0xb54; + public static final int GAS_CONST_G_SSET = 0x4e20; + public static final int GAS_CONST_G_TRANSACTION = 0x5208; + public static final int GAS_CONST_G_TX_CREATE = 0x7d00; + public static final int GAS_CONST_G_TX_DATA_NONZERO = 0x10; + public static final int GAS_CONST_G_TX_DATA_ZERO = 0x4; + public static final int GAS_CONST_G_VERY_LOW = 0x3; + public static final int GAS_CONST_G_WARM_ACCESS = 0x64; + public static final int GAS_CONST_G_ZERO = 0x0; + public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; + public static final int LINEA_BASE_FEE = 0x7; + public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; + public static final int LINEA_CHAIN_ID = 0xe708; + public static final int LINEA_DIFFICULTY = 0x2; + public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; + public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; + public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; + public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; + public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; + public static final int LLARGE = 0x10; + public static final int LLARGEMO = 0xf; + public static final int LLARGEPO = 0x11; + public static final int MAX_CODE_SIZE = 0x6000; + public static final int MAX_REFUND_QUOTIENT = 0x5; + public static final int MISC_WEIGHT_EXP = 0x1; + public static final int MISC_WEIGHT_MMU = 0x2; + public static final int MISC_WEIGHT_MXP = 0x4; + public static final int MISC_WEIGHT_OOB = 0x8; + public static final int MISC_WEIGHT_STP = 0x10; + public static final int MMEDIUM = 0x8; + public static final int MMEDIUMMO = 0x7; + public static final int MMIO_INST_LIMB_TO_RAM_ONE_TARGET = 0xfe12; + public static final int MMIO_INST_LIMB_TO_RAM_TRANSPLANT = 0xfe11; + public static final int MMIO_INST_LIMB_TO_RAM_TWO_TARGET = 0xfe13; + public static final int MMIO_INST_LIMB_VANISHES = 0xfe01; + public static final int MMIO_INST_RAM_EXCISION = 0xfe41; + public static final int MMIO_INST_RAM_TO_LIMB_ONE_SOURCE = 0xfe22; + public static final int MMIO_INST_RAM_TO_LIMB_TRANSPLANT = 0xfe21; + public static final int MMIO_INST_RAM_TO_LIMB_TWO_SOURCE = 0xfe23; + public static final int MMIO_INST_RAM_TO_RAM_PARTIAL = 0xfe32; + public static final int MMIO_INST_RAM_TO_RAM_TRANSPLANT = 0xfe31; + public static final int MMIO_INST_RAM_TO_RAM_TWO_SOURCE = 0xfe34; + public static final int MMIO_INST_RAM_TO_RAM_TWO_TARGET = 0xfe33; + public static final int MMIO_INST_RAM_VANISHES = 0xfe42; + public static final int MMU_INST_ANY_TO_RAM_WITH_PADDING = 0xfe50; + public static final int MMU_INST_BLAKE = 0xfe80; + public static final int MMU_INST_EXO_TO_RAM_TRANSPLANTS = 0xfe30; + public static final int MMU_INST_INVALID_CODE_PREFIX = 0xfe00; + public static final int MMU_INST_MLOAD = 0xfe01; + public static final int MMU_INST_MODEXP_DATA = 0xfe70; + public static final int MMU_INST_MODEXP_ZERO = 0xfe60; + public static final int MMU_INST_MSTORE = 0xfe02; + public static final int MMU_INST_MSTORE8 = 0xfe03; + public static final int MMU_INST_RAM_TO_EXO_WITH_PADDING = 0xfe20; + public static final int MMU_INST_RAM_TO_RAM_SANS_PADDING = 0xfe40; + public static final int MMU_INST_RIGHT_PADDED_WORD_EXTRACTION = 0xfe10; + public static final int OOB_INST_BLAKE_CDS = 0xfa09; + public static final int OOB_INST_BLAKE_PARAMS = 0xfb09; + public static final int OOB_INST_CALL = 0xca; + public static final int OOB_INST_CDL = 0x35; + public static final int OOB_INST_CREATE = 0xce; + public static final int OOB_INST_DEPLOYMENT = 0xf3; + public static final int OOB_INST_ECADD = 0xff06; + public static final int OOB_INST_ECMUL = 0xff07; + public static final int OOB_INST_ECPAIRING = 0xff08; + public static final int OOB_INST_ECRECOVER = 0xff01; + public static final int OOB_INST_IDENTITY = 0xff04; + public static final int OOB_INST_JUMP = 0x56; + public static final int OOB_INST_JUMPI = 0x57; + public static final int OOB_INST_MODEXP_CDS = 0xfa05; + public static final int OOB_INST_MODEXP_EXTRACT = 0xfe05; + public static final int OOB_INST_MODEXP_LEAD = 0xfc05; + public static final int OOB_INST_MODEXP_PRICING = 0xfd05; + public static final int OOB_INST_MODEXP_XBS = 0xfb05; + public static final int OOB_INST_RDC = 0x3e; + public static final int OOB_INST_RIPEMD = 0xff03; + public static final int OOB_INST_SHA2 = 0xff02; + public static final int OOB_INST_SSTORE = 0x55; + public static final int OOB_INST_XCALL = 0xcc; + public static final int PHASE_BLAKE_DATA = 0x5; + public static final int PHASE_BLAKE_PARAMS = 0x6; + public static final int PHASE_BLAKE_RESULT = 0x7; + public static final int PHASE_ECADD_DATA = 0x60a; + public static final int PHASE_ECADD_RESULT = 0x60b; + public static final int PHASE_ECMUL_DATA = 0x70a; + public static final int PHASE_ECMUL_RESULT = 0x70b; + public static final int PHASE_ECPAIRING_DATA = 0x80a; + public static final int PHASE_ECPAIRING_RESULT = 0x80b; + public static final int PHASE_ECRECOVER_DATA = 0x10a; + public static final int PHASE_ECRECOVER_RESULT = 0x10b; + public static final int PHASE_KECCAK_DATA = 0x5; + public static final int PHASE_KECCAK_RESULT = 0x6; + public static final int PHASE_MODEXP_BASE = 0x1; + public static final int PHASE_MODEXP_EXPONENT = 0x2; + public static final int PHASE_MODEXP_MODULUS = 0x3; + public static final int PHASE_MODEXP_RESULT = 0x4; + public static final int PHASE_RIPEMD_DATA = 0x3; + public static final int PHASE_RIPEMD_RESULT = 0x4; + public static final int PHASE_SHA2_DATA = 0x1; + public static final int PHASE_SHA2_RESULT = 0x2; + public static final int REFUND_CONST_R_SCLEAR = 0x12c0; + public static final int RLP_ADDR_RECIPE_1 = 0x1; + public static final int RLP_ADDR_RECIPE_2 = 0x2; + public static final int RLP_PREFIX_INT_LONG = 0xb7; + public static final int RLP_PREFIX_INT_SHORT = 0x80; + public static final int RLP_PREFIX_LIST_LONG = 0xf7; + public static final int RLP_PREFIX_LIST_SHORT = 0xc0; + public static final int RLP_RCPT_SUBPHASE_ID_ADDR = 0x35; + public static final int RLP_RCPT_SUBPHASE_ID_CUMUL_GAS = 0x3; + public static final int RLP_RCPT_SUBPHASE_ID_DATA_LIMB = 0x4d; + public static final int RLP_RCPT_SUBPHASE_ID_DATA_SIZE = 0x53; + public static final int RLP_RCPT_SUBPHASE_ID_NO_LOG_ENTRY = 0xb; + public static final int RLP_RCPT_SUBPHASE_ID_STATUS_CODE = 0x2; + public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_BASE = 0x41; + public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_DELTA = 0x60; + public static final int RLP_RCPT_SUBPHASE_ID_TYPE = 0x7; + public static final int RLP_TXN_PHASE_ACCESS_LIST = 0xb; + public static final int RLP_TXN_PHASE_BETA = 0xc; + public static final int RLP_TXN_PHASE_CHAIN_ID = 0x2; + public static final int RLP_TXN_PHASE_DATA = 0xa; + public static final int RLP_TXN_PHASE_GAS_LIMIT = 0x7; + public static final int RLP_TXN_PHASE_GAS_PRICE = 0x4; + public static final int RLP_TXN_PHASE_MAX_FEE_PER_GAS = 0x6; + public static final int RLP_TXN_PHASE_MAX_PRIORITY_FEE_PER_GAS = 0x5; + public static final int RLP_TXN_PHASE_NONCE = 0x3; + public static final int RLP_TXN_PHASE_R = 0xe; + public static final int RLP_TXN_PHASE_RLP_PREFIX = 0x1; + public static final int RLP_TXN_PHASE_S = 0xf; + public static final int RLP_TXN_PHASE_TO = 0x8; + public static final int RLP_TXN_PHASE_VALUE = 0x9; + public static final int RLP_TXN_PHASE_Y = 0xd; + public static final int WCP_INST_GEQ = 0xe; + public static final int WCP_INST_LEQ = 0xf; + public static final int WORD_SIZE = 0x20; + public static final int WORD_SIZE_MO = 0x1f; + + private final BitSet filled = new BitSet(); + private int currentLine = 0; + + static List headers(int length) { + List headers = new ArrayList<>(); + return headers; + } + + public Trace(List buffers) {} + + public int size() { + if (!filled.isEmpty()) { + throw new RuntimeException("Cannot measure a trace with a non-validated row."); + } + + return this.currentLine; + } + + public Trace validateRow() { + filled.clear(); + this.currentLine++; + + return this; + } + + public Trace fillAndValidateRow() { + filled.clear(); + this.currentLine++; + + return this; + } + + public void build() { + if (!filled.isEmpty()) { + throw new IllegalStateException("Cannot build trace with a non-validated row."); + } + } +} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index 7d20516d3..5d14db6d3 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -180,8 +180,6 @@ public int lineCount() { return state.lineCounter().lineCount(); } - @Getter private final BigInteger chainId; - /** List of all modules of the ZK-evm */ // stateless modules @Getter private final Wcp wcp = new Wcp(); @@ -381,17 +379,14 @@ public List getModulesToCount() { .toList(); } - public Hub( - final Address l2l1ContractAddress, - final Bytes l2l1Topic, - final BigInteger nonnegativeChainId) { - checkState(nonnegativeChainId.signum() >= 0); - chainId = nonnegativeChainId; + public Hub(final Address l2l1ContractAddress, final Bytes l2l1Topic, final BigInteger chainId) { + checkState(chainId.signum() >= 0); l2Block = new L2Block(l2l1ContractAddress, LogTopic.of(l2l1Topic)); l2L1Logs = new L2L1Logs(l2Block); keccak = new Keccak(ecRecoverEffectiveCall, l2Block); shakiraData = new ShakiraData(wcp, sha256Blocks, keccak, ripemdBlocks); - blockdata = new Blockdata(wcp, txnData, rlpTxn, chainId); + blockdata = new Blockdata(wcp, euc, txnData); + blockdata.setChainId(chainId); mmu = new Mmu(euc, wcp); mmio = new Mmio(mmu); diff --git a/arithmetization/src/test/java/net/consensys/linea/replaytests/ReplayTestTools.java b/arithmetization/src/test/java/net/consensys/linea/replaytests/ReplayTestTools.java index 7c414b917..604dbf513 100644 --- a/arithmetization/src/test/java/net/consensys/linea/replaytests/ReplayTestTools.java +++ b/arithmetization/src/test/java/net/consensys/linea/replaytests/ReplayTestTools.java @@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j; import net.consensys.linea.UnitTestWatcher; import net.consensys.linea.testing.ReplayExecutionEnvironment; +import net.consensys.linea.zktracer.ZkTracer; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.provider.Arguments; @@ -87,6 +88,7 @@ public static void replay(BigInteger chainId, String filename, boolean resultChe throw new RuntimeException(e); } ReplayExecutionEnvironment.builder() + .zkTracer(new ZkTracer(chainId)) .txResultChecking(resultChecking) .build() .replay(chainId, new BufferedReader(new InputStreamReader(stream))); @@ -118,6 +120,7 @@ public static void replayAt(BigInteger chainId, String filePath) { try (GZIPInputStream gzipStream = new GZIPInputStream(stream)) { ReplayExecutionEnvironment.builder() + .zkTracer(new ZkTracer(chainId)) .build() .replay(chainId, new BufferedReader(new InputStreamReader(gzipStream)), filePath); } catch (IOException e) { diff --git a/linea-constraints b/linea-constraints index a5c956e20..2fa08d862 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit a5c956e20eccb1a3a44c49d642d66f6a0cc1d8ef +Subproject commit 2fa08d862dc9942ec89df0b194b41e6e61ed5346 diff --git a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java index cbf2f2b2c..ef3500926 100644 --- a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java @@ -24,6 +24,7 @@ import lombok.Singular; import lombok.extern.slf4j.Slf4j; import net.consensys.linea.blockcapture.snapshots.*; +import net.consensys.linea.zktracer.ZkTracer; import org.hyperledger.besu.ethereum.core.*; @Builder @@ -62,6 +63,7 @@ public MultiBlockExecutionEnvironmentBuilder addBlock(List transact public void run() { ReplayExecutionEnvironment.builder() + .zkTracer(new ZkTracer(ToyExecutionEnvironmentV2.CHAIN_ID)) .useCoinbaseAddressFromBlockHeader(true) .transactionProcessingResultValidator(this.transactionProcessingResultValidator) .build() diff --git a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java index 66d7e28c3..294ff5fd7 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java @@ -97,7 +97,7 @@ public class ReplayExecutionEnvironment { private final TransactionProcessingResultValidator transactionProcessingResultValidator = TransactionProcessingResultValidator.EMPTY_VALIDATOR; - private final ZkTracer zkTracer = new ZkTracer(); + private ZkTracer zkTracer; public void checkTracer(String inputFilePath) { // Generate the output file path based on the input file path From f65b8caa5cd3ef1521b9a792ba8d51105fae3f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Sat, 21 Dec 2024 08:20:54 +0100 Subject: [PATCH 04/54] fix: constraints commit catch up (#1675) --- linea-constraints | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linea-constraints b/linea-constraints index 2fa08d862..b644a399a 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 2fa08d862dc9942ec89df0b194b41e6e61ed5346 +Subproject commit b644a399a81bc6fdd8c57abc050e9648e6117b15 From ec4fa091fab0c034c885cc00f0e5d0c6eda7ce79 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Sun, 22 Dec 2024 20:13:33 +1300 Subject: [PATCH 05/54] feat: use informative names for temporary lt files (#1673) Instead of having trace files like `15859796120901255124.lt`, this constructs prefixes based on the name of the test method itself. For example, `zktracer_ExampleMultiBlockTest_test2_14913323958058450904.lt`. This just makes it easier, when debugging, to determine from a trace file the test which generated it. --- .../linea/testing/ExecutionEnvironment.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java index 6a2f71fbc..b818fae81 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java @@ -55,6 +55,7 @@ public class ExecutionEnvironment { public static final String CORSET_VALIDATION_RESULT = "Corset validation result: "; + static GenesisConfigFile GENESIS_CONFIG = GenesisConfigFile.fromSource(GenesisConfigFile.class.getResource("/linea.json")); @@ -63,7 +64,8 @@ public static void checkTracer( Path traceFilePath = null; boolean traceValidated = false; try { - traceFilePath = Files.createTempFile(null, ".lt"); + String prefix = constructTestPrefix(); + traceFilePath = Files.createTempFile(prefix, ".lt"); zkTracer.writeToFile(traceFilePath); final Path finalTraceFilePath = traceFilePath; logger.ifPresent(log -> log.debug("trace written to {}", finalTraceFilePath)); @@ -149,4 +151,29 @@ private static NodeKey createNodeKey() { return new NodeKey(keyPairSecurityModule); } + + private static final String LINEA_PACKAGE = "net.consensys.linea."; + + /** + * Construct a suitable prefix for the temporary lt file generated based on the method name of the + * test. This is done by walking up the stack looking for a calling method whose classname ends + * with "Test". Having found such a method, its name is then used as the test prefix. If no method + * is found, then this simply returns null --- which is completely safe in this context. + * + * @return + */ + public static String constructTestPrefix() { + for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { + if (ste.getClassName().endsWith("Test")) { + // Yes, it is. Now tidy up the name. + String name = ste.getClassName().replace(LINEA_PACKAGE, "").replace(".", "_"); + // Done + return name + "_" + ste.getMethodName() + "_"; + } + } + // Failed, so return null. This is fine as it just means the generate lt file will not have an + // informative + // prefix. + return null; + } } From 51e04bbf04f8adc96c2623854e0a1adb98758f71 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Mon, 6 Jan 2025 21:46:25 +1300 Subject: [PATCH 06/54] feat: improve slack report for daily blockchain tests (#1677) * feat: extract counters from JSON report This extracts the various counters from the JSON report and packages them up into the SLACK status report. * chore: add test_filter option to workflow This adds a test_filter option to the workflow so that is possible to just rerun a specific test, or set of tests based on a filter. --- .../workflows/reference-blockchain-tests.yml | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 10b559598..a6945da87 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -5,6 +5,11 @@ on: - cron: 0 21 * * 1-5 workflow_dispatch: inputs: + test_filter: + description: Filter tests to run (via Gradle) + required: false + type: string + default: "BlockchainReferenceTest_*" failed_module: description: Specific module to filter from failed tests required: false @@ -63,7 +68,7 @@ jobs: run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json - name: Run reference blockchain tests - run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck + run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter }}" timeout-minutes: 360 env: REFERENCE_TESTS_PARALLELISM: 2 @@ -89,6 +94,22 @@ jobs: name: blockchain-refrence-tests-report path: reference-tests/build/reports/tests/**/* + - name: Extract Metrics + if: ${{ failure() || cancelled() }} + run: | + # Gather metrics + SUCCESS_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"successCounter\":\([0-9]*\).*/\1/") + FAILED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"failedCounter\":\([0-9]*\).*/\1/") + ABORTED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"abortedCounter\":\([0-9]*\).*/\1/") + DISABLED_COUNTER=$(cat $JSON_REPORT | sed -e "s/.*\"disabledCounter\":\([0-9]*\).*/\1/") + # Set environment variables + echo "SUCCESS=$SUCCESS_COUNTER" >> $GITHUB_ENV + echo "FAILED=$FAILED_COUNTER" >> $GITHUB_ENV + echo "ABORTED=$ABORTED_COUNTER" >> $GITHUB_ENV + echo "DISABLED=$DISABLED_COUNTER" >> $GITHUB_ENV + env: + JSON_REPORT: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/BlockchainReferenceTestOutcome.json + - name: Failure Notification if: ${{ failure() || cancelled() }} uses: slackapi/slack-github-action@v2.0.0 @@ -97,4 +118,4 @@ jobs: webhook-type: webhook-trigger payload: | name: "Daily Blockchain" - status: "${{ job.status }}" + status: "${{ env.SUCCESS }} successful, ${{ env.FAILED }} failed, ${{ env.ABORTED }} aborted, ${{ env.DISABLED }} disabled" From 0c942f148836a37dcc4f9f5f28c4226522cc0117 Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Fri, 10 Jan 2025 14:19:36 +0100 Subject: [PATCH 07/54] Fix for TX_INIT + TX_FINL + TX_SKIP + some bug fixing + coinbase shenanigans (#1657) --- .github/workflows/gradle-tests.yml | 8 +- .../zktracer/module/blockdata/Blockdata.java | 37 ++- .../module/blockdata/BlockdataOperation.java | 25 +- .../zktracer/module/blockdata/Trace.java | 65 +++-- .../zktracer/module/constants/Trace.java | 2 + .../linea/zktracer/module/hub/Hub.java | 23 +- .../linea/zktracer/module/hub/Trace.java | 7 +- .../module/hub/defer/DeferRegistry.java | 8 +- .../hub/defer/PostTransactionDefer.java | 2 +- .../hub/fragment/TransactionFragment.java | 17 +- .../hub/fragment/account/AccountFragment.java | 13 +- .../module/hub/fragment/imc/ImcFragment.java | 9 +- .../module/hub/fragment/imc/mmu/MmuCall.java | 4 +- .../oob/precompiles/ModexpPricingOobCall.java | 5 +- .../scenario/CallScenarioFragment.java | 4 +- .../module/hub/section/CreateSection.java | 6 +- .../module/hub/section/LogSection.java | 4 +- .../module/hub/section/TraceSection.java | 8 + .../hub/section/TransactionSection.java | 2 +- .../hub/section/TxFinalizationSection.java | 269 ++++++------------ .../hub/section/TxInitializationSection.java | 204 +++++++++---- .../module/hub/section/TxSkipSection.java | 253 ++++++++-------- .../module/hub/section/call/CallSection.java | 11 +- .../hub/section/halt/ReturnSection.java | 4 +- .../hub/section/halt/SelfdestructSection.java | 6 +- .../module/hub/section/halt/StopSection.java | 4 +- .../linea/zktracer/module/rlptxn/RlpTxn.java | 105 +++---- .../module/rlptxn/RlpTxnOperation.java | 4 +- .../zktracer/module/txndata/TxnData.java | 4 +- .../module/txndata/TxndataOperation.java | 10 +- .../zktracer/opcode/gas/projector/SStore.java | 40 +-- .../types/TransactionProcessingMetadata.java | 35 --- .../linea/replaytests/Issue1280Tests.java | 3 + .../linea/zktracer/ExampleMultiBlockTest.java | 2 +- .../zktracer/module/hub/TxSkipTests.java | 4 +- .../zktracer/precompiles/ModexpTests.java | 56 +++- linea-constraints | 2 +- reference-tests/build.gradle | 2 +- .../linea/BlockchainReferenceTestTools.java | 152 +++++++++- .../consensys/linea/CorsetBlockProcessor.java | 1 - 40 files changed, 825 insertions(+), 595 deletions(-) diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index 2fa654a1c..bc111388d 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -51,7 +51,7 @@ jobs: # ================================================================== corset-unit-tests: needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large + runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl steps: - name: Checkout repository uses: actions/checkout@v3 @@ -80,7 +80,7 @@ jobs: go-corset-unit-tests: needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large + runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl continue-on-error: true steps: - name: Checkout repository @@ -114,7 +114,7 @@ jobs: # ================================================================== corset-replay-tests: needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large + runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl steps: - name: Checkout repository uses: actions/checkout@v3 @@ -143,7 +143,7 @@ jobs: go-corset-replay-tests: needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large + runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl continue-on-error: true steps: - name: Checkout repository diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java index 450bf3ed7..094b9949e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java @@ -46,6 +46,7 @@ public class Blockdata implements Module { private int traceCounter = 0; private long firstBlockNumber; private Bytes chainId; + private boolean shouldBeTraced = true; final OpCode[] opCodes = { OpCode.COINBASE, @@ -75,29 +76,35 @@ public void traceStartConflation(final long blockCount) { public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { final long blockNumber = blockHeader.getNumber(); firstBlockNumber = (traceCounter < opCodes.length) ? blockNumber : firstBlockNumber; - for (OpCode opCode : opCodes) { - BlockdataOperation operation = - new BlockdataOperation( - blockHeader, - prevBlockHeader, - txnData.currentBlock().getNbOfTxsInBlock(), - wcp, - euc, - chainId, - opCode, - firstBlockNumber); - operations.addLast(operation); - // Increase counter to track where we are in the conflation - traceCounter++; + if (shouldBeTraced) { + for (OpCode opCode : opCodes) { + BlockdataOperation operation = + new BlockdataOperation( + txnData.hub(), + blockHeader, + prevBlockHeader, + txnData.currentBlock().getNbOfTxsInBlock(), + wcp, + euc, + chainId, + opCode, + firstBlockNumber); + operations.addLast(operation); + // Increase counter to track where we are in the conflation + traceCounter++; + } } prevBlockHeader = blockHeader; + shouldBeTraced = false; } @Override public void traceEndConflation(final WorldView state) {} @Override - public void enterTransaction() {} + public void enterTransaction() { + shouldBeTraced = true; + } @Override public void popTransaction() {} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index d7985eaeb..acb6d3fd1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -23,9 +23,7 @@ import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_GEQ; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; -import static net.consensys.linea.zktracer.module.constants.Trace.GAS_LIMIT_ADJUSTMENT_FACTOR; -import static net.consensys.linea.zktracer.module.constants.Trace.LINEA_GAS_LIMIT_MAXIMUM; -import static net.consensys.linea.zktracer.module.constants.Trace.LINEA_GAS_LIMIT_MINIMUM; +import static net.consensys.linea.zktracer.module.constants.Trace.*; import static net.consensys.linea.zktracer.types.Conversions.booleanToBytes; import java.math.BigInteger; @@ -36,6 +34,7 @@ import lombok.experimental.Accessors; import net.consensys.linea.zktracer.container.ModuleOperation; import net.consensys.linea.zktracer.module.euc.Euc; +import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.types.EWord; @@ -46,6 +45,7 @@ @Accessors(fluent = true) @Getter public class BlockdataOperation extends ModuleOperation { + private final Hub hub; private final Wcp wcp; private final Euc euc; private final Bytes chainId; @@ -70,6 +70,7 @@ public class BlockdataOperation extends ModuleOperation { private final boolean[] eucFlag; public BlockdataOperation( + Hub hub, BlockHeader blockHeader, BlockHeader prevBlockHeader, int relTxMax, @@ -79,6 +80,7 @@ public BlockdataOperation( OpCode opCode, long firstBlockNumber) { // Data from blockHeader + this.hub = hub; this.blockHeader = blockHeader; this.prevBlockHeader = prevBlockHeader; @@ -131,7 +133,7 @@ public BlockdataOperation( } private void handleCoinbase() { - data = EWord.ofHexString(blockHeader.getCoinbase().toHexString()); + data = EWord.ofHexString(hub.coinbaseAddress.toHexString()); // row i wcpCallToLT(0, data, POWER_256_20); } @@ -173,14 +175,16 @@ private void handleGasLimit() { wcpCallToGEQ(0, data, EWord.of(LINEA_GAS_LIMIT_MINIMUM)); // row i + 1 - wcpCallToLEQ(1, data, EWord.of(LINEA_GAS_LIMIT_MAXIMUM)); + wcpCallToLEQ(1, data, EWord.of(Bytes.ofUnsignedLong(LINEA_GAS_LIMIT_MAXIMUM))); if (!firstBlockInConflation) { EWord prevGasLimit = EWord.of(prevBlockHeader.getGasLimit()); // row i + 2 Bytes maxDeviation = eucCall(2, prevGasLimit, EWord.of(GAS_LIMIT_ADJUSTMENT_FACTOR)); // row i + 3 - wcpCallToLT(3, data, EWord.of(prevGasLimit.toLong() + maxDeviation.toLong())); + BigInteger safeGasLimitUpperBound = + prevGasLimit.getAsBigInteger().add(maxDeviation.toUnsignedBigInteger()); + wcpCallToLT(3, data, EWord.of(safeGasLimitUpperBound)); // row i + 4 wcpCallToGT( @@ -223,10 +227,11 @@ public void trace(Trace trace) { .isChainid(opCode == OpCode.CHAINID) .isBasefee(opCode == OpCode.BASEFEE) .inst(UnsignedByte.of(opCode.byteValue())) - .coinbaseHi(blockHeader.getCoinbase().slice(0, 4).toLong()) - .coinbaseLo(blockHeader.getCoinbase().slice(4, LLARGE)) - .blockGasLimit(blockHeader.getGasLimit()) - .basefee(blockHeader.getBaseFee().get().getAsBigInteger().longValue()) + .coinbaseHi(hub.coinbaseAddress.slice(0, 4).toLong()) + .coinbaseLo(hub.coinbaseAddress.slice(4, LLARGE)) + .blockGasLimit(Bytes.ofUnsignedLong(blockHeader.getGasLimit())) + .basefee( + Bytes.ofUnsignedLong(blockHeader.getBaseFee().get().getAsBigInteger().longValue())) .firstBlockNumber(firstBlockNumber) .relBlock((short) relBlock) .relTxNumMax((short) relTxMax) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java index 0a3c9796d..ae8e03b22 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java @@ -78,8 +78,8 @@ static List headers(int length) { headers.add(new ColumnHeader("blockdata.ARG_1_LO", 16, length)); headers.add(new ColumnHeader("blockdata.ARG_2_HI", 16, length)); headers.add(new ColumnHeader("blockdata.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.BASEFEE", 6, length)); - headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 6, length)); + headers.add(new ColumnHeader("blockdata.BASEFEE", 8, length)); + headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 8, length)); headers.add(new ColumnHeader("blockdata.COINBASE_HI", 4, length)); headers.add(new ColumnHeader("blockdata.COINBASE_LO", 16, length)); headers.add(new ColumnHeader("blockdata.CT", 1, length)); @@ -98,7 +98,7 @@ static List headers(int length) { headers.add(new ColumnHeader("blockdata.IS_GASLIMIT", 1, length)); headers.add(new ColumnHeader("blockdata.IS_NUMBER", 1, length)); headers.add(new ColumnHeader("blockdata.IS_TIMESTAMP", 1, length)); - headers.add(new ColumnHeader("blockdata.REL_BLOCK", 1, length)); + headers.add(new ColumnHeader("blockdata.REL_BLOCK", 2, length)); headers.add(new ColumnHeader("blockdata.REL_TX_NUM_MAX", 2, length)); headers.add(new ColumnHeader("blockdata.RES", 16, length)); headers.add(new ColumnHeader("blockdata.WCP_FLAG", 1, length)); @@ -248,42 +248,54 @@ public Trace arg2Lo(final Bytes b) { return this; } - public Trace basefee(final long b) { + public Trace basefee(final Bytes b) { if (filled.get(4)) { throw new IllegalStateException("blockdata.BASEFEE already set"); } else { filled.set(4); } - if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockdata.BASEFEE has invalid value (" + b + ")"); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 64) { + throw new IllegalArgumentException( + "blockdata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 8; i++) { + basefee.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + basefee.put(bs.get(j)); } - basefee.put((byte) (b >> 40)); - basefee.put((byte) (b >> 32)); - basefee.put((byte) (b >> 24)); - basefee.put((byte) (b >> 16)); - basefee.put((byte) (b >> 8)); - basefee.put((byte) b); return this; } - public Trace blockGasLimit(final long b) { + public Trace blockGasLimit(final Bytes b) { if (filled.get(5)) { throw new IllegalStateException("blockdata.BLOCK_GAS_LIMIT already set"); } else { filled.set(5); } - if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockdata.BLOCK_GAS_LIMIT has invalid value (" + b + ")"); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 64) { + throw new IllegalArgumentException( + "blockdata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); + } + // Write padding (if necessary) + for (int i = bs.size(); i < 8; i++) { + blockGasLimit.put((byte) 0); + } + // Write bytes + for (int j = 0; j < bs.size(); j++) { + blockGasLimit.put(bs.get(j)); } - blockGasLimit.put((byte) (b >> 40)); - blockGasLimit.put((byte) (b >> 32)); - blockGasLimit.put((byte) (b >> 24)); - blockGasLimit.put((byte) (b >> 16)); - blockGasLimit.put((byte) (b >> 8)); - blockGasLimit.put((byte) b); return this; } @@ -574,9 +586,10 @@ public Trace relBlock(final long b) { filled.set(24); } - if (b >= 256L) { + if (b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); } + relBlock.put((byte) (b >> 8)); relBlock.put((byte) b); return this; @@ -589,7 +602,7 @@ public Trace relTxNumMax(final long b) { filled.set(25); } - if (b >= 1024L) { + if (b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); } relTxNumMax.put((byte) (b >> 8)); @@ -773,11 +786,11 @@ public Trace fillAndValidateRow() { } if (!filled.get(4)) { - basefee.position(basefee.position() + 6); + basefee.position(basefee.position() + 8); } if (!filled.get(5)) { - blockGasLimit.position(blockGasLimit.position() + 6); + blockGasLimit.position(blockGasLimit.position() + 8); } if (!filled.get(6)) { @@ -853,7 +866,7 @@ public Trace fillAndValidateRow() { } if (!filled.get(24)) { - relBlock.position(relBlock.position() + 1); + relBlock.position(relBlock.position() + 2); } if (!filled.get(25)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java index 088d7d85c..ca220a1bf 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java @@ -45,6 +45,8 @@ public class Trace { new BigInteger("302652579918965577886386472538583578916"); public static final BigInteger EMPTY_SHA2_LO = new BigInteger("52744687940778649747319168982913824853"); + public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; + public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; public static final int EVM_INST_ADD = 0x1; public static final int EVM_INST_ADDMOD = 0x8; public static final int EVM_INST_ADDRESS = 0x30; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index 5d14db6d3..738fe7a60 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -202,7 +202,7 @@ public int lineCount() { private final RlpTxn rlpTxn = new RlpTxn(romLex); private final Mmio mmio; - private final TxnData txnData = new TxnData(wcp, euc); + private final TxnData txnData = new TxnData(this, wcp, euc); private final RlpTxnRcpt rlpTxnRcpt = new RlpTxnRcpt(); private final LogInfo logInfo = new LogInfo(rlpTxnRcpt); private final LogData logData = new LogData(rlpTxnRcpt); @@ -294,6 +294,9 @@ private List precompileLimitModules() { */ public boolean failureConditionForCreates = false; + public Address coinbaseAddress; + public boolean coinbaseWarmthAtTransactionEnd = false; + /** * @return a list of all modules for which to generate traces */ @@ -496,6 +499,7 @@ public void traceStartTransaction(final WorldView world, final Transaction tx) { if (!transactionProcessingMetadata.requiresEvmExecution()) { state.setProcessingPhase(TX_SKIP); + Address coinbaseAddress = Address.fromHexString("8f81e2e3f8b46467523463835f965ffe476e1c9e"); new TxSkipSection(this, world, transactionProcessingMetadata, transients); } else { if (transactionProcessingMetadata.requiresPrewarming()) { @@ -516,6 +520,8 @@ public void traceStartTransaction(final WorldView world, final Transaction tx) { } } + // the sender already received its gas refund + // the coinbase already received its gas reward public void traceEndTransaction( WorldView world, Transaction tx, @@ -529,7 +535,7 @@ public void traceEndTransaction( txStack.current().completeLineaTransaction(this, isSuccessful, logs, selfDestructs); - defers.resolvePostTransaction(this, world, tx, isSuccessful); + defers.resolveAtEndTransaction(this, world, tx, isSuccessful); // Warn: we need to call MMIO after resolving the defers for (Module m : modules) { @@ -546,6 +552,11 @@ public void traceContextEnter(MessageFrame frame) { // root and transaction call data context's if (frame.getDepth() == 0) { + coinbaseAddress = frame.getMiningBeneficiary(); + if (state.getProcessingPhase() == TX_SKIP) { + checkState(currentTraceSection() instanceof TxSkipSection); + ((TxSkipSection) currentTraceSection()).coinbaseSnapshots(this, frame); + } final TransactionProcessingMetadata currentTransaction = transients().tx(); final Address recipientAddress = frame.getRecipientAddress(); final Address senderAddress = frame.getSenderAddress(); @@ -633,12 +644,12 @@ public void traceContextEnter(MessageFrame frame) { this.currentFrame().initializeFrame(frame); - defers.resolveUponContextEntry(this, frame); - for (Module m : modules) { m.traceContextEnter(frame); } } + + defers.resolveUponContextEntry(this, frame); } @Override @@ -651,14 +662,13 @@ public void traceContextExit(MessageFrame frame) { if (frame.getDepth() == 0) { final long leftOverGas = frame.getRemainingGas(); final long gasRefund = frame.getGasRefund(); - final boolean coinbaseIsWarm = frame.isAddressWarm(txStack.current().getCoinbase()); txStack .current() .setPreFinalisationValues( leftOverGas, gasRefund, - coinbaseIsWarm, + coinbaseWarmthAtTransactionEnd, txStack.getAccumulativeGasUsedInBlockBeforeTxStart()); if (state.getProcessingPhase() != TX_SKIP @@ -735,6 +745,7 @@ public void tracePostExecution(MessageFrame frame, Operation.OperationResult ope if (frame.getDepth() == 0 && (isExceptional() || opCode() == REVERT)) { this.state.setProcessingPhase(TX_FINL); + coinbaseWarmthAtTransactionEnd = frame.isAddressWarm(coinbaseAddress); new TxFinalizationSection(this, frame.getWorldUpdater(), true); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java index d10c58033..32b559324 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java @@ -31,9 +31,10 @@ * Please DO NOT ATTEMPT TO MODIFY this code directly. */ public class Trace { - public static final int DOM_SUB_STAMP_OFFSET___REVERT = 0x6; - public static final int DOM_SUB_STAMP_OFFSET___SELFDESTRUCT = 0x7; - public static final int MULTIPLIER___DOM_SUB_STAMPS = 0x8; + public static final int DOM_SUB_STAMP_OFFSET___FINALIZATION = 0x9; + public static final int DOM_SUB_STAMP_OFFSET___REVERT = 0x8; + public static final int DOM_SUB_STAMP_OFFSET___SELFDESTRUCT = 0xa; + public static final int MULTIPLIER___DOM_SUB_STAMPS = 0x10; public static final int MULTIPLIER___STACK_STAMP = 0x8; private final BitSet filled = new BitSet(); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java index dba170a22..d196d7336 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java @@ -81,7 +81,7 @@ public void scheduleForContextExit(ContextExitDefer defer, Integer callFrameId) } /** Schedule an action to be executed at the end of the current transaction. */ - public void scheduleForPostTransaction(PostTransactionDefer defer) { + public void scheduleForEndTransaction(PostTransactionDefer defer) { postTransactionDefers.add(defer); } @@ -117,16 +117,16 @@ public void scheduleForPostRollback(PostRollbackDefer defer, CallFrame callFrame // TODO add docs to understand why we do two rounds of resolving (due to AccountFragment created // at endTx which are too deferEndTx), maybe no more the case, so not needed anymore @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView world, Transaction tx, boolean isSuccessful) { final List postTransactionDefersFirstRound = new ArrayList<>(postTransactionDefers); postTransactionDefers.clear(); for (PostTransactionDefer defer : postTransactionDefersFirstRound) { - defer.resolvePostTransaction(hub, world, tx, isSuccessful); + defer.resolveAtEndTransaction(hub, world, tx, isSuccessful); } for (PostTransactionDefer defer : postTransactionDefers) { - defer.resolvePostTransaction(hub, world, tx, isSuccessful); + defer.resolveAtEndTransaction(hub, world, tx, isSuccessful); } postTransactionDefers.clear(); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java index 22892be4f..ed665f0f6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java @@ -31,5 +31,5 @@ public interface PostTransactionDefer { * @param state a view onto the current blockchain state * @param tx the {@link Transaction} that just executed */ - void resolvePostTransaction(Hub hub, WorldView state, Transaction tx, boolean isSuccessful); + void resolveAtEndTransaction(Hub hub, WorldView state, Transaction tx, boolean isSuccessful); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TransactionFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TransactionFragment.java index 3e246a6a1..053129994 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TransactionFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TransactionFragment.java @@ -20,6 +20,7 @@ import static net.consensys.linea.zktracer.types.Conversions.bigIntegerToBytes; import lombok.Setter; +import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.Trace; import net.consensys.linea.zktracer.module.hub.section.TraceSection; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; @@ -29,16 +30,21 @@ import org.hyperledger.besu.datatypes.TransactionType; public final class TransactionFragment implements TraceFragment { + private final Hub hub; + private final Address coinbaseAddress; private final TransactionProcessingMetadata transactionProcessingMetadata; @Setter private TraceSection parentSection; - private TransactionFragment(TransactionProcessingMetadata transactionProcessingMetadata) { + private TransactionFragment( + Hub hub, TransactionProcessingMetadata transactionProcessingMetadata) { + this.hub = hub; + this.coinbaseAddress = Address.wrap(hub.coinbaseAddress.copy()); this.transactionProcessingMetadata = transactionProcessingMetadata; } public static TransactionFragment prepare( - TransactionProcessingMetadata transactionProcessingMetadata) { - return new TransactionFragment(transactionProcessingMetadata); + Hub hub, TransactionProcessingMetadata transactionProcessingMetadata) { + return new TransactionFragment(hub, transactionProcessingMetadata); } @Override @@ -46,7 +52,6 @@ public Trace trace(Trace trace) { final Transaction tx = transactionProcessingMetadata.getBesuTransaction(); final Address to = transactionProcessingMetadata.getEffectiveRecipient(); final Address from = transactionProcessingMetadata.getSender(); - final Address coinbase = transactionProcessingMetadata.getCoinbase(); return trace .peekAtTransaction(true) @@ -78,7 +83,7 @@ public Trace trace(Trace trace) { Bytes.minimalBytes(transactionProcessingMetadata.getRefundCounterMax())) .pTransactionRefundEffective( Bytes.minimalBytes(transactionProcessingMetadata.getGasRefunded())) - .pTransactionCoinbaseAddressHi(highPart(coinbase)) - .pTransactionCoinbaseAddressLo(lowPart(coinbase)); + .pTransactionCoinbaseAddressHi(highPart(coinbaseAddress)) + .pTransactionCoinbaseAddressLo(lowPart(coinbaseAddress)); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java index 013c31125..242324533 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java @@ -37,7 +37,6 @@ import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TraceFragment; import net.consensys.linea.zktracer.module.hub.section.halt.EphemeralAccount; -import net.consensys.linea.zktracer.module.romlex.ContractMetadata; import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes; @@ -111,7 +110,7 @@ public AccountFragment( // This allows us to properly fill MARKED_FOR_SELFDESTRUCT and MARKED_FOR_SELFDESTRUCT_NEW, // among other things - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); } @Override @@ -166,7 +165,7 @@ public Trace trace(Trace trace) { } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { final Map effectiveSelfDestructMap = transactionProcessingMetadata.getEffectiveSelfDestructMap(); @@ -189,12 +188,8 @@ public void resolvePostConflation(Hub hub, WorldView world) { existsInfinity = world.get(newState.address()) != null; codeFragmentIndex = requiresRomlex - ? hub.romLex() - .getCodeFragmentIndexByMetadata( - ContractMetadata.make( - newState.address(), - newState.deploymentNumber(), - newState.deploymentStatus())) + ? hub.getCfiByMetaData( + newState.address(), newState.deploymentNumber(), newState.deploymentStatus()) : 0; } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java index 74642ef23..fced974ec 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java @@ -20,6 +20,7 @@ import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.Trace; +import net.consensys.linea.zktracer.module.hub.defer.ContextEntryDefer; import net.consensys.linea.zktracer.module.hub.defer.ContextReEntryDefer; import net.consensys.linea.zktracer.module.hub.fragment.TraceFragment; import net.consensys.linea.zktracer.module.hub.fragment.TraceSubFragment; @@ -28,12 +29,13 @@ import net.consensys.linea.zktracer.module.hub.fragment.imc.oob.OobCall; import net.consensys.linea.zktracer.runtime.callstack.CallFrame; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.evm.frame.MessageFrame; /** * IMCFragments embed data required for Inter-Module Communication, i.e. data that are required to * correctly trigger other modules from the Hub. */ -public class ImcFragment implements TraceFragment, ContextReEntryDefer { +public class ImcFragment implements TraceFragment, ContextReEntryDefer, ContextEntryDefer { /** the list of modules to trigger withing this fragment. */ private final List moduleCalls = new ArrayList<>(5); @@ -160,6 +162,11 @@ public void resolveAtContextReEntry(Hub hub, CallFrame frame) { childFrame = hub.callStack().getById(frame.childFrameIds().getLast()); } + @Override + public void resolveUponContextEntry(Hub hub, MessageFrame frame) { + childFrame = hub.currentFrame(); + } + /** * The IMC fragment (or MISCELLANEOUS fragment in the specification) requires, for CALL and CREATE * instructions, to record the following data diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java index a6bcaf21a..0ac0d43e5 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java @@ -140,7 +140,7 @@ final MmuCall setEcData() { } public MmuCall(final Hub hub, final int instruction) { - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); this.instruction = instruction; } @@ -805,7 +805,7 @@ public Trace trace(Trace trace, State.TxState.Stamps stamps) { } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { if (traceMe) { hub.mmu().call(this); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/oob/precompiles/ModexpPricingOobCall.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/oob/precompiles/ModexpPricingOobCall.java index fe7d1e321..f99d08eb7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/oob/precompiles/ModexpPricingOobCall.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/oob/precompiles/ModexpPricingOobCall.java @@ -25,7 +25,6 @@ import lombok.Setter; import net.consensys.linea.zktracer.module.hub.Trace; import net.consensys.linea.zktracer.module.hub.fragment.imc.oob.OobCall; -import org.apache.tuweni.bytes.Bytes; @Getter @Setter @@ -55,7 +54,7 @@ public net.consensys.linea.zktracer.module.oob.Trace trace( .data4(booleanToBytes(ramSuccess)) .data5(bigIntegerToBytes(returnGas)) .data6(bigIntegerToBytes(exponentLog)) - .data7(Bytes.of(maxMbsBbs)) + .data7(bigIntegerToBytes(BigInteger.valueOf(maxMbsBbs))) .data8(booleanToBytes(returnAtCapacityNonZero)) .data9(ZERO); } @@ -71,7 +70,7 @@ public Trace trace(Trace trace) { .pMiscOobData4(booleanToBytes(ramSuccess)) .pMiscOobData5(bigIntegerToBytes(returnGas)) .pMiscOobData6(bigIntegerToBytes(exponentLog)) - .pMiscOobData7(Bytes.of(maxMbsBbs)) + .pMiscOobData7(bigIntegerToBytes(BigInteger.valueOf(maxMbsBbs))) .pMiscOobData8(booleanToBytes(returnAtCapacityNonZero)) .pMiscOobData9(ZERO); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/scenario/CallScenarioFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/scenario/CallScenarioFragment.java index 6648ff858..f27d26d24 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/scenario/CallScenarioFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/scenario/CallScenarioFragment.java @@ -99,7 +99,9 @@ public boolean noLongerUndefined() { } public Trace trace(Trace trace) { - checkArgument(scenario.noLongerUndefined(), "Final Scenario hasn't been set"); + checkArgument( + scenario.noLongerUndefined(), + "Final " + CallScenario.class.getSimpleName() + ", " + scenario + ", is still undefined"); return trace .peekAtScenario(true) // // CALL scenarios diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java index a56b3998f..28fce8e42 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java @@ -456,7 +456,7 @@ private void scheduleSection(Hub hub) { case CREATE_FAILURE_CONDITION_WONT_REVERT, CREATE_EMPTY_INIT_CODE_WONT_REVERT -> { hub.defers().scheduleForContextReEntry(this, currentFrame); hub.defers().scheduleForPostRollback(this, currentFrame); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); } case CREATE_NON_EMPTY_INIT_CODE_SUCCESS_WONT_REVERT -> { // The current execution context pays (63/64)ths of it current gas to the child context @@ -464,7 +464,7 @@ private void scheduleSection(Hub hub) { hub.defers().scheduleForContextEntry(this); hub.defers().scheduleForContextReEntry(this, currentFrame); hub.defers().scheduleForPostRollback(this, currentFrame); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); // we capture revert information about the child context: CCSR and CCRS hub.defers().scheduleForContextReEntry(imcFragment, hub.currentFrame()); @@ -496,7 +496,7 @@ public void resolvePostExecution( } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { addFragment(finalContextFragment); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java index d0900ee78..19b4d4b98 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java @@ -69,7 +69,7 @@ public LogSection(Hub hub) { // the unexceptional case checkArgument(Exceptions.none(exceptions)); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); final LogData logData = new LogData(hub); checkArgument(logData.nontrivialLog() == mxpCall.mayTriggerNontrivialMmuOperation); @@ -87,7 +87,7 @@ private static short maxNumberOfRows(Hub hub) { } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { final boolean logReverted = commonValues.callFrame().willRevert(); if (logReverted) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java index d1bcca5e8..6d52b069d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java @@ -151,6 +151,14 @@ private int computeContextNumberNew() { if (currentPhase == TX_WARM || currentPhase == TX_FINL || currentPhase == TX_SKIP) { return 0; } + + if (nextSection == null) { + throw new RuntimeException( + "NPE: nextSection is " + + nextSection + + ", current section is of type " + + this.getClass().getTypeName()); + } return nextSection.commonValues.hubProcessingPhase == TX_EXEC ? nextSection.commonValues.callFrame().contextNumber() : 0; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TransactionSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TransactionSection.java index 2f8c7dc51..d7a1873d4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TransactionSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TransactionSection.java @@ -26,6 +26,6 @@ public TransactionSection(Hub hub) { // 3 = 1 + 1 + 1 (stack, transaction, context) super(hub, Exceptions.none(hub.pch().exceptions()) ? (short) 2 : (short) 3); - this.addStackAndFragments(hub, TransactionFragment.prepare(hub.txStack().current())); + this.addStackAndFragments(hub, TransactionFragment.prepare(hub, hub.txStack().current())); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java index 067f04b88..8acdfcbd7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java @@ -17,7 +17,9 @@ import static com.google.common.base.Preconditions.*; -import lombok.Setter; +import java.util.List; +import java.util.Set; + import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; @@ -26,215 +28,114 @@ import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; import net.consensys.linea.zktracer.module.hub.transients.DeploymentInfo; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Transaction; -import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.evm.tracing.OperationTracer; import org.hyperledger.besu.evm.worldstate.WorldView; public class TxFinalizationSection extends TraceSection implements PostTransactionDefer { private final TransactionProcessingMetadata txMetadata; - private final AccountSnapshot senderSnapshotBeforeFinalization; - private final AccountSnapshot recipientSnapshotBeforeFinalization; - private final AccountSnapshot coinbaseSnapshotBeforeTxFinalization; - private @Setter AccountSnapshot senderSnapshotAfterTxFinalization; - private @Setter AccountSnapshot recipientSnapshotAfterTxFinalization; - private @Setter AccountSnapshot coinbaseSnapshotAfterFinalization; + + private AccountSnapshot senderGasRefund; + private AccountSnapshot senderGasRefundNew; + + private AccountSnapshot coinbaseGasRefund; + private AccountSnapshot coinbaseGasRefundNew; public TxFinalizationSection(Hub hub, WorldView world, boolean exceptionOrRevert) { super(hub, (short) 4); - + hub.defers().scheduleForEndTransaction(this); txMetadata = hub.txStack().current(); - - final Address senderAddress = txMetadata.getSender(); - final Address recipientAddress = txMetadata.getEffectiveRecipient(); - final Address coinbaseAddress = txMetadata.getCoinbase(); - - // recipient - senderSnapshotBeforeFinalization = - exceptionOrRevert - ? hub.txStack().getInitializationSection().getSenderAfterPayingForTransaction() - : AccountSnapshot.canonical(hub, world, senderAddress); - recipientSnapshotBeforeFinalization = - exceptionOrRevert - ? hub.txStack().getInitializationSection().getRecipientAfterValueTransfer() - : AccountSnapshot.canonical(hub, world, recipientAddress); - coinbaseSnapshotBeforeTxFinalization = AccountSnapshot.canonical(hub, world, coinbaseAddress); - - hub.defers().scheduleForPostTransaction(this); } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView world, Transaction tx, boolean isSuccessful) { - final boolean coinbaseWarmth = txMetadata.isCoinbaseWarmAtTransactionEnd(); - - final Address senderAddress = senderSnapshotBeforeFinalization.address(); - senderSnapshotAfterTxFinalization = AccountSnapshot.canonical(hub, world, senderAddress); - senderSnapshotAfterTxFinalization.turnOnWarmth(); // purely constraints based - - final Address recipientAddress = recipientSnapshotBeforeFinalization.address(); - recipientSnapshotAfterTxFinalization = AccountSnapshot.canonical(hub, world, recipientAddress); - recipientSnapshotAfterTxFinalization.turnOnWarmth(); // purely constraints based - - final Address coinbaseAddress = coinbaseSnapshotBeforeTxFinalization.address(); - coinbaseSnapshotAfterFinalization = AccountSnapshot.canonical(hub, world, coinbaseAddress); - coinbaseSnapshotAfterFinalization.setWarmthTo(coinbaseWarmth); // purely constraints based - - DeploymentInfo deploymentInfo = hub.transients().conflation().deploymentInfo(); checkArgument(isSuccessful == txMetadata.statusCode()); - // TODO: do we switch off the deployment status at the end of a deployment ? - // checkArgument( - // !deploymentInfo.getDeploymentStatus(senderAddress), - // "The sender may not be under deployment"); - // checkArgument( - // !deploymentInfo.getDeploymentStatus(recipientAddress), - // "The recipient may not be under deployment"); + DeploymentInfo deploymentInfo = hub.transients().conflation().deploymentInfo(); checkArgument( - !deploymentInfo.getDeploymentStatus(coinbaseAddress), + !deploymentInfo.getDeploymentStatus(hub.coinbaseAddress), "The coinbase may not be under deployment"); - if (isSuccessful) { - successFinalization(hub); - } else { - failureFinalization(hub); - } + setSnapshots(hub, world); + + final AccountFragment senderAccountFragment = + hub.factories() + .accountFragment() + .make( + senderGasRefund, + senderGasRefundNew, + DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); // + + final AccountFragment coinbaseAccountFragment = + hub.factories() + .accountFragment() + .makeWithTrm( + coinbaseGasRefund, + coinbaseGasRefundNew, + coinbaseGasRefund.address(), + DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); + + this.addFragment(senderAccountFragment); + this.addFragment(coinbaseAccountFragment); + this.addFragment(TransactionFragment.prepare(hub, hub.txStack().current())); // TXN i+2 } - private void successFinalization(Hub hub) { - - if (!txMetadata.senderIsCoinbase()) { - - final AccountFragment senderAccountFragment = - hub.factories() - .accountFragment() - .make( - senderSnapshotBeforeFinalization, - senderSnapshotAfterTxFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - final AccountFragment coinbaseAccountFragment = - hub.factories() - .accountFragment() - .make( - coinbaseSnapshotBeforeTxFinalization, - coinbaseSnapshotAfterFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - this.addFragments(senderAccountFragment, coinbaseAccountFragment); - } else { - // TODO: verify it works - final AccountFragment senderAccountFragment = - hub.factories() - .accountFragment() - .make( - senderSnapshotBeforeFinalization, - senderSnapshotBeforeFinalization - .deepCopy() - .incrementBalanceBy(txMetadata.getGasRefundInWei()), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - final AccountFragment coinbaseAccountFragment = - hub.factories() - .accountFragment() - .make( - senderSnapshotBeforeFinalization, - coinbaseSnapshotAfterFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - this.addFragments(senderAccountFragment, coinbaseAccountFragment); + /** + * Extracting the snapshots for the sender and the coinbase does not work as one may expect. One + * has to start with the `New` versions of the snapshots and then deduce the `Old` versions. This + * is due to that this method is called in the {@link + * OperationTracer#traceEndTransaction(WorldView, Transaction, boolean, Bytes, List, long, Set, + * long)} method, when gas refunds have already been honored, both for the sender and the + * coinbase. + * + *

1. snapshot the coinbase, this yields coinbaseNew + * + *

2. undo the gas reward, this yields coinbase + * + *

3.1. if {@link #senderIsCoinbase(Hub)} set {@link #senderGasRefundNew} = {@link + * #coinbaseGasRefund}.deepCopy() + * + *

3.2. else set {@link #senderGasRefundNew} = snapshot the sender + * + *

4. get sender by undoing the leftover gas refund which is already implicitly in coinbase + * + *

N.B. The processing is independent of the success or failure of the transaction. + */ + private void setSnapshots(Hub hub, WorldView world) { + final Address senderAddress = txMetadata.getSender(); + final Address coinbaseAddress = hub.coinbaseAddress; + + if (senderIsCoinbase(hub)) { + checkState(coinbaseWarmth()); } - final TransactionFragment currentTransactionFragment = - TransactionFragment.prepare(hub.txStack().current()); - this.addFragment(currentTransactionFragment); + coinbaseGasRefundNew = + AccountSnapshot.canonical(hub, world, coinbaseAddress) + .setWarmthTo(coinbaseWarmth()) + .setDeploymentInfo(hub); + coinbaseGasRefund = + coinbaseGasRefundNew.deepCopy().decrementBalanceBy(txMetadata.getCoinbaseReward()); + + senderGasRefundNew = + senderIsCoinbase(hub) + ? coinbaseGasRefund.deepCopy() + : AccountSnapshot.canonical(hub, world, senderAddress); + senderGasRefund = + senderGasRefundNew.deepCopy().decrementBalanceBy(txMetadata.getGasRefundInWei()); } - private void failureFinalization(Hub hub) { - if (txMetadata.noAddressCollisions()) { - - final AccountFragment senderAccountFragment = - hub.factories() - .accountFragment() - .make( - senderSnapshotBeforeFinalization, - senderSnapshotAfterTxFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - final AccountFragment recipientAccountFragment = - hub.factories() - .accountFragment() - .make( - recipientSnapshotBeforeFinalization, - recipientSnapshotAfterTxFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - final AccountFragment coinbaseAccountFragment = - hub.factories() - .accountFragment() - .make( - coinbaseSnapshotBeforeTxFinalization, - coinbaseSnapshotAfterFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 2)); - - this.addFragments(senderAccountFragment, recipientAccountFragment, coinbaseAccountFragment); - - } else { - - final Wei transactionValue = (Wei) txMetadata.getBesuTransaction().getValue(); - - // FIRST ROW - final AccountSnapshot senderSnapshotAfterValueAndGasRefunds = - senderSnapshotBeforeFinalization - .deepCopy() - .incrementBalanceBy(transactionValue) - .incrementBalanceBy(txMetadata.getGasRefundInWei()); - - final AccountFragment senderAccountFragment = - hub.factories() - .accountFragment() - .make( - senderSnapshotBeforeFinalization, - senderSnapshotAfterValueAndGasRefunds, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - // SECOND ROW - final AccountSnapshot recipientSnapshotBeforeSecondRow = - (txMetadata.senderIsRecipient()) - ? senderSnapshotAfterValueAndGasRefunds - : recipientSnapshotBeforeFinalization; - - final AccountSnapshot recipientSnapshotAfterSecondRow = - recipientSnapshotBeforeSecondRow.deepCopy().decrementBalanceBy(transactionValue); - - final AccountFragment recipientAccountFragment = - hub.factories() - .accountFragment() - .make( - recipientSnapshotBeforeSecondRow, - recipientSnapshotAfterSecondRow, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - // THIRD ROW - final AccountSnapshot coinbaseSnapshotBefore = - coinbaseSnapshotAfterFinalization - .deepCopy() - .decrementBalanceBy(txMetadata.getCoinbaseReward()); - - final AccountFragment coinbaseAccountFragment = - hub.factories() - .accountFragment() - .make( - coinbaseSnapshotBefore, - coinbaseSnapshotAfterFinalization, - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 2)); - - this.addFragments(senderAccountFragment, recipientAccountFragment, coinbaseAccountFragment); - } - final TransactionFragment currentTransactionFragment = - TransactionFragment.prepare(hub.txStack().current()); + private boolean coinbaseWarmth() { + return txMetadata.isCoinbaseWarmAtTransactionEnd(); + } - this.addFragment(currentTransactionFragment); + public static boolean senderIsCoinbase(Hub hub) { + final TransactionProcessingMetadata tx = hub.txStack().current(); + final Address senderAddress = tx.getSender(); + final Address coinbaseAddress = hub.coinbaseAddress; + return coinbaseAddress.equals(senderAddress); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java index 04d9d6eb1..6ccdee5a6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java @@ -15,12 +15,13 @@ package net.consensys.linea.zktracer.module.hub.section; +import static com.google.common.base.Preconditions.checkState; import static net.consensys.linea.zktracer.module.hub.HubProcessingPhase.TX_EXEC; -import com.google.common.base.Preconditions; import lombok.Getter; import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TransactionFragment; @@ -31,61 +32,81 @@ import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.worldstate.WorldView; -public class TxInitializationSection extends TraceSection { +public class TxInitializationSection extends TraceSection implements PostTransactionDefer { - @Getter private final AccountSnapshot senderAfterPayingForTransaction; - @Getter private final AccountSnapshot recipientAfterValueTransfer; + @Getter private final int hubStamp; + final AccountFragment.AccountFragmentFactory accountFragmentFactory; + + ImcFragment miscFragment; + + private final AccountFragment gasPaymentAccountFragment; + @Getter private final AccountSnapshot senderGasPayment; + @Getter private final AccountSnapshot senderGasPaymentNew; + + private final AccountFragment valueSendingAccountFragment; + @Getter private final AccountSnapshot senderValueTransfer; + @Getter private final AccountSnapshot senderValueTransferNew; + + private final AccountFragment valueReceptionAccountFragment; + @Getter private final AccountSnapshot recipientValueReception; + @Getter private final AccountSnapshot recipientValueReceptionNew; + + @Getter private AccountSnapshot senderUndoingValueTransfer; + @Getter private AccountSnapshot senderUndoingValueTransferNew; + + @Getter private AccountSnapshot recipientUndoingValueReception; + @Getter private AccountSnapshot recipientUndoingValueReceptionNew; + + @Getter private final ContextFragment initializationContextFragment; public TxInitializationSection(Hub hub, WorldView world) { - super(hub, (short) 5); + super(hub, (short) 8); + hub.defers().scheduleForEndTransaction(this); + + hubStamp = hub.stamp(); + accountFragmentFactory = hub.factories().accountFragment(); hub.txStack().setInitializationSection(this); final TransactionProcessingMetadata tx = hub.txStack().current(); - final boolean isDeployment = tx.isDeployment(); + final Address senderAddress = tx.getSender(); final Address recipientAddress = tx.getEffectiveRecipient(); + final Account senderAccount = world.get(senderAddress); final DeploymentInfo deploymentInfo = hub.transients().conflation().deploymentInfo(); - final Address senderAddress = tx.getSender(); - final Account senderAccount = world.get(senderAddress); - final AccountSnapshot senderBeforePayingForTransaction = + final boolean isDeployment = tx.isDeployment(); + final Wei transactionGasPrice = Wei.of(tx.getEffectiveGasPrice()); + final Wei gasCost = transactionGasPrice.multiply(tx.getBesuTransaction().getGasLimit()); + + senderGasPayment = AccountSnapshot.fromAccount( senderAccount, tx.isSenderPreWarmed(), deploymentInfo.deploymentNumber(senderAddress), deploymentInfo.getDeploymentStatus(senderAddress)); - final DomSubStampsSubFragment senderDomSubStamps = - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0); + senderGasPaymentNew = + senderGasPayment.deepCopy().decrementBalanceBy(gasCost).turnOnWarmth().raiseNonceByOne(); - final Wei transactionGasPrice = Wei.of(tx.getEffectiveGasPrice()); final Wei value = (Wei) tx.getBesuTransaction().getValue(); - final Wei valueAndGasCost = - transactionGasPrice.multiply(tx.getBesuTransaction().getGasLimit()).add(value); - - senderAfterPayingForTransaction = senderBeforePayingForTransaction.deepCopy(); - senderAfterPayingForTransaction - .decrementBalanceBy(valueAndGasCost) - .turnOnWarmth() - .raiseNonceByOne(); - final boolean isSelfCredit = recipientAddress.equals(senderAddress); + senderValueTransfer = senderGasPaymentNew.deepCopy(); + senderValueTransferNew = senderValueTransfer.deepCopy().decrementBalanceBy(value); final Account recipientAccount = world.get(recipientAddress); - AccountSnapshot recipientBeforeValueTransfer; - if (recipientAccount != null) { - recipientBeforeValueTransfer = - isSelfCredit - ? senderAfterPayingForTransaction + recipientValueReception = + senderIsRecipient(hub) + ? senderValueTransferNew : AccountSnapshot.canonical(hub, world, recipientAddress, tx.isRecipientPreWarmed()) .setWarmthTo(tx.isRecipientPreWarmed()); } else { - recipientBeforeValueTransfer = + recipientValueReception = AccountSnapshot.fromAddress( recipientAddress, tx.isRecipientPreWarmed(), @@ -93,54 +114,117 @@ public TxInitializationSection(Hub hub, WorldView world) { deploymentInfo.getDeploymentStatus(recipientAddress)); } + checkState( + !recipientValueReception.deploymentStatus(), + "recipient should not have been undergoing deployment before transaction start"); + + recipientValueReceptionNew = recipientValueReception.deepCopy(); + if (isDeployment) { + if (recipientAccount != null) { + checkState( + recipientAccount.getCode().equals(Bytes.EMPTY), + "the recipient of a deployment transaction must have empty code"); + checkState( + recipientAccount.getNonce() == 0, + "the recipient of a deployment transaction must have zero nonce"); + } + deploymentInfo.newDeploymentWithExecutionAt( recipientAddress, tx.getBesuTransaction().getInit().orElse(Bytes.EMPTY)); - } - - final Bytecode initCode = new Bytecode(tx.getBesuTransaction().getInit().orElse(Bytes.EMPTY)); - recipientAfterValueTransfer = recipientBeforeValueTransfer.deepCopy(); - if (isDeployment) { - Preconditions.checkState( - !recipientBeforeValueTransfer.deploymentStatus() - && deploymentInfo.getDeploymentStatus(recipientAddress) - && recipientBeforeValueTransfer.deploymentNumber() + 1 - == deploymentInfo.deploymentNumber(recipientAddress), - "Deployment status should be true and deployment number should be positive"); - - recipientAfterValueTransfer + // this should be useless + checkState( + deploymentInfo.getDeploymentStatus(recipientAddress), + "at this point the recipient should be undergoing deployment"); + checkState( + recipientValueReception.deploymentNumber() + 1 + == deploymentInfo.deploymentNumber(recipientAddress), + "Deployment status should be true and deployment number should have incremented by 1"); + + final Bytecode initCode = new Bytecode(tx.getBesuTransaction().getInit().orElse(Bytes.EMPTY)); + recipientValueReceptionNew .raiseNonceByOne() .incrementBalanceBy(value) .code(initCode) .turnOnWarmth() .setDeploymentInfo(deploymentInfo); } else { - recipientAfterValueTransfer.incrementBalanceBy(value).turnOnWarmth(); + recipientValueReceptionNew.incrementBalanceBy(value).turnOnWarmth(); } - - final DomSubStampsSubFragment recipientDomSubStamps = - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1); - - final TransactionFragment txFragment = TransactionFragment.prepare(tx); - - final AccountFragment.AccountFragmentFactory accountFragmentFactory = - hub.factories().accountFragment(); - - this.addFragment( + recipientUndoingValueReception = recipientValueReceptionNew.deepCopy(); + + miscFragment = ImcFragment.forTxInit(hub); + hub.defers().scheduleForContextEntry(miscFragment); + + gasPaymentAccountFragment = + accountFragmentFactory.makeWithTrm( + senderGasPayment, + senderGasPaymentNew, + senderGasPayment.address(), + DomSubStampsSubFragment.standardDomSubStamps(hubStamp, 0)); + valueSendingAccountFragment = accountFragmentFactory.make( - senderBeforePayingForTransaction, senderAfterPayingForTransaction, senderDomSubStamps)); - this.addFragment( + senderValueTransfer, + senderValueTransferNew, + DomSubStampsSubFragment.standardDomSubStamps(hubStamp, 1)); + valueReceptionAccountFragment = accountFragmentFactory .makeWithTrm( - recipientBeforeValueTransfer, - recipientAfterValueTransfer, - recipientAddress, - recipientDomSubStamps) - .requiresRomlex(true)); - this.addFragments( - ImcFragment.forTxInit(hub), ContextFragment.initializeExecutionContext(hub), txFragment); + recipientValueReception, + recipientValueReceptionNew, + recipientValueReception.address(), + DomSubStampsSubFragment.standardDomSubStamps(hubStamp, 2)) + .requiresRomlex(true); + + initializationContextFragment = ContextFragment.initializeExecutionContext(hub); hub.state.setProcessingPhase(TX_EXEC); } + + @Override + public void resolveAtEndTransaction( + Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { + + this.addFragment(miscFragment); // MISC i + 0 + this.addFragment(TransactionFragment.prepare(hub, hub.txStack().current())); // TXN i + 1 + this.addFragment(gasPaymentAccountFragment); // ACC i + 2 (sender: gas payment) + this.addFragment(valueSendingAccountFragment); // ACC i + 3 (sender: value transfer) + this.addFragment(valueReceptionAccountFragment); // ACC i + 4 (recipient: value reception) + + if (!isSuccessful) { + + senderUndoingValueTransfer = senderValueTransferNew.deepCopy().setDeploymentNumber(hub); + senderUndoingValueTransferNew = senderValueTransfer.deepCopy().setDeploymentNumber(hub); + + recipientUndoingValueReception = + recipientValueReceptionNew.deepCopy().setDeploymentNumber(hub); + recipientUndoingValueReceptionNew = + recipientValueReception.deepCopy().setDeploymentNumber(hub).turnOnWarmth(); + + final int revertStamp = hub.currentFrame().revertStamp(); + + this.addFragment( // ACC i + 5 (sender) + accountFragmentFactory.make( + senderUndoingValueTransfer, + senderUndoingValueTransferNew, + DomSubStampsSubFragment.revertWithCurrentDomSubStamps(hubStamp, revertStamp, 3))); + + this.addFragment( // ACC i + 6 (recipient) + accountFragmentFactory.make( + recipientUndoingValueReception, + recipientUndoingValueReceptionNew, + DomSubStampsSubFragment.revertWithCurrentDomSubStamps(hubStamp, revertStamp, 4))); + } + + this.addFragment(initializationContextFragment); // CON i + 5/7 + } + + public static boolean senderIsRecipient(Hub hub) { + final TransactionProcessingMetadata tx = hub.txStack().current(); + final Address senderAddress = tx.getSender(); + final Address recipientAddress = tx.getEffectiveRecipient(); + + return recipientAddress.equals(senderAddress); + } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java index da0ca65b5..ae27c4aaf 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java @@ -16,8 +16,11 @@ package net.consensys.linea.zktracer.module.hub.section; import static com.google.common.base.Preconditions.*; +import static net.consensys.linea.zktracer.module.hub.AccountSnapshot.canonical; import static net.consensys.linea.zktracer.types.AddressUtils.isPrecompile; +import java.math.BigInteger; + import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; @@ -29,6 +32,7 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.worldstate.WorldView; /** @@ -39,9 +43,18 @@ public class TxSkipSection extends TraceSection implements PostTransactionDefer { final TransactionProcessingMetadata txMetadata; - final AccountSnapshot senderAccountSnapshotBefore; - final AccountSnapshot recipientAccountSnapshotBefore; - final AccountSnapshot coinbaseAccountSnapshotBefore; + + Address senderAddress; + AccountSnapshot sender; + AccountSnapshot senderNew; + + Address recipientAddress; + AccountSnapshot recipient; + AccountSnapshot recipientNew; + + Address coinbaseAddress; + AccountSnapshot coinbase; + AccountSnapshot coinbaseNew; public TxSkipSection( Hub hub, @@ -49,21 +62,14 @@ public TxSkipSection( TransactionProcessingMetadata transactionProcessingMetadata, Transients transients) { super(hub, (short) 4); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); txMetadata = transactionProcessingMetadata; - final Address senderAddress = txMetadata.getBesuTransaction().getSender(); - final Address recipientAddress = txMetadata.getEffectiveRecipient(); - final Address coinbaseAddress = txMetadata.getCoinbase(); - - senderAccountSnapshotBefore = - AccountSnapshot.canonical(hub, world, senderAddress, isPrecompile(senderAddress)) - .turnOnWarmth(); - recipientAccountSnapshotBefore = - AccountSnapshot.canonical(hub, world, recipientAddress, isPrecompile(recipientAddress)) - .turnOnWarmth(); - coinbaseAccountSnapshotBefore = - AccountSnapshot.canonical(hub, world, coinbaseAddress, isPrecompile(coinbaseAddress)); + senderAddress = txMetadata.getBesuTransaction().getSender(); + recipientAddress = txMetadata.getEffectiveRecipient(); + + sender = canonical(hub, world, senderAddress, isPrecompile(senderAddress)); + recipient = canonical(hub, world, recipientAddress, isPrecompile(recipientAddress)); // arithmetization restriction checkArgument( @@ -78,7 +84,6 @@ public TxSkipSection( // at the start of every transaction checkArgument(!hub.deploymentStatusOf(senderAddress)); checkArgument(!hub.deploymentStatusOf(recipientAddress)); - checkArgument(!hub.deploymentStatusOf(coinbaseAddress)); // the updated deployment info appears in the "updated" account fragment if (txMetadata.isDeployment()) { @@ -86,120 +91,126 @@ public TxSkipSection( } } + /** + * The coinbase address isn't necessarily that of the block. We do, however, obtain it via the + * {@link MessageFrame} of the hub. + */ + public void coinbaseSnapshots(Hub hub, MessageFrame frame) { + coinbaseAddress = frame.getMiningBeneficiary(); + coinbase = + canonical(hub, frame.getWorldUpdater(), coinbaseAddress, isPrecompile(coinbaseAddress)); + checkArgument(!hub.deploymentStatusOf(coinbaseAddress)); + } + @Override - public void resolvePostTransaction(Hub hub, WorldView world, Transaction tx, boolean statusCode) { + public void resolveAtEndTransaction( + Hub hub, WorldView world, Transaction tx, boolean statusCode) { + checkArgument(statusCode, "TX_SKIP transactions should be successful"); checkArgument(txMetadata.statusCode(), "meta data suggests an unsuccessful TX_SKIP"); - if (txMetadata.noAddressCollisions()) { - - final AccountSnapshot senderAccountSnapshotAfter = - AccountSnapshot.canonical(hub, world, senderAccountSnapshotBefore.address()); - - final AccountSnapshot recipientAccountSnapshotAfter = - AccountSnapshot.canonical(hub, world, recipientAccountSnapshotBefore.address()); - - final AccountSnapshot coinbaseAccountSnapshotAfter = - AccountSnapshot.canonical(hub, world, coinbaseAccountSnapshotBefore.address()); - - // sender account fragment - final AccountFragment senderAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - senderAccountSnapshotBefore, - senderAccountSnapshotAfter, - senderAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - // recipient account fragment - final AccountFragment recipientAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - recipientAccountSnapshotBefore, - recipientAccountSnapshotAfter, - recipientAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - // coinbase account fragment - final AccountFragment coinbaseAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - coinbaseAccountSnapshotBefore, - coinbaseAccountSnapshotAfter, - coinbaseAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 2)); - - this.addFragments(senderAccountFragment, recipientAccountFragment, coinbaseAccountFragment); + // may have to be modified in case of address collision + senderNew = canonical(hub, world, sender.address(), isPrecompile(sender.address())); + recipientNew = canonical(hub, world, recipient.address(), isPrecompile(recipient.address())); + coinbaseNew = canonical(hub, world, coinbase.address(), isPrecompile(recipient.address())); + + final Wei value = (Wei) txMetadata.getBesuTransaction().getValue(); + + if (senderAddressCollision()) { + BigInteger gasUsed = BigInteger.valueOf(txMetadata.getGasUsed()); + BigInteger gasPrice = BigInteger.valueOf(txMetadata.getEffectiveGasPrice()); + BigInteger gasCost = gasUsed.multiply(gasPrice); + senderNew = + sender + .deepCopy() + .decrementBalanceBy(value) + .decrementBalanceBy(Wei.of(gasCost)) + .raiseNonceByOne(); + } + + if (senderIsRecipient()) { + recipient = senderNew.deepCopy(); + recipientNew = recipient.deepCopy().incrementBalanceBy(value); } else { - final Wei value = (Wei) txMetadata.getBesuTransaction().getValue(); - - final AccountSnapshot firstAccountFragmentSnapshotAfter = - txMetadata.senderAddressCollision() - ? senderAccountSnapshotBefore - .deepCopy() - .decrementBalanceBy( - value.add(txMetadata.getGasUsed() * txMetadata.getEffectiveGasPrice())) - .raiseNonceByOne() - : AccountSnapshot.canonical(hub, world, senderAccountSnapshotBefore.address()); - - final AccountSnapshot secondAccountFragmentSnapshotBefore = - txMetadata.senderIsRecipient() - ? firstAccountFragmentSnapshotAfter.deepCopy() - : recipientAccountSnapshotBefore; - - final AccountSnapshot secondAccountFragmentSnapshotAfter = - secondAccountFragmentSnapshotBefore.deepCopy().incrementBalanceBy(value); - - final AccountSnapshot coinbaseAccountSnapshotAfter = - AccountSnapshot.canonical(hub, world, coinbaseAccountSnapshotBefore.address()); - - final AccountSnapshot thirdAccountFragmentSnapshotBefore = - txMetadata.coinbaseAddressCollision() - ? coinbaseAccountSnapshotAfter - .deepCopy() - .decrementBalanceBy(txMetadata.getCoinbaseReward()) - : coinbaseAccountSnapshotBefore; - - // "sender" account fragment - final AccountFragment firstAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - senderAccountSnapshotBefore, - firstAccountFragmentSnapshotAfter, - senderAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); - - // "recipient" account fragment - final AccountFragment secondAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - secondAccountFragmentSnapshotBefore, - secondAccountFragmentSnapshotAfter, - recipientAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); - - // "coinbase" account fragment - final AccountFragment thirdAccountFragment = - hub.factories() - .accountFragment() - .makeWithTrm( - thirdAccountFragmentSnapshotBefore, - coinbaseAccountSnapshotAfter, - coinbaseAccountSnapshotBefore.address(), - DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 2)); - - this.addFragments(firstAccountFragment, secondAccountFragment, thirdAccountFragment); + if (recipientIsCoinbase()) { + recipientNew = coinbaseNew.deepCopy().decrementBalanceBy(txMetadata.getCoinbaseReward()); + recipient = recipientNew.deepCopy().decrementBalanceBy(value); + } } + if (coinbaseAddressCollision()) { + coinbase = coinbaseNew.deepCopy().decrementBalanceBy(txMetadata.getCoinbaseReward()); + } + + // "sender" account fragment + final AccountFragment senderAccountFragment = + hub.factories() + .accountFragment() + .makeWithTrm( + sender, + senderNew, + sender.address(), + DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 0)); + + // "recipient" account fragment + final AccountFragment recipientAccountFragment = + hub.factories() + .accountFragment() + .makeWithTrm( + recipient, + recipientNew, + recipient.address(), + DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 1)); + + // "coinbase" account fragment + final AccountFragment coinbaseAccountFragment = + hub.factories() + .accountFragment() + .makeWithTrm( + coinbase, + coinbaseNew, + coinbase.address(), + DomSubStampsSubFragment.standardDomSubStamps(hub.stamp(), 2)); + // transaction fragment final TransactionFragment transactionFragment = - TransactionFragment.prepare(hub.txStack().current()); + TransactionFragment.prepare(hub, hub.txStack().current()); + this.addFragment(senderAccountFragment); + this.addFragment(recipientAccountFragment); + this.addFragment(coinbaseAccountFragment); this.addFragment(transactionFragment); } + + public boolean senderIsRecipient() { + return senderAddress.equals(recipientAddress); + } + + public boolean senderIsCoinbase() { + return senderAddress.equals(coinbaseAddress); + } + + public boolean recipientIsCoinbase() { + return recipientAddress.equals(coinbaseAddress); + } + + public boolean senderAddressCollision() { + return senderIsRecipient() || senderIsCoinbase(); + } + + public boolean recipientAddressCollision() { + return senderIsRecipient() || recipientIsCoinbase(); + } + + public boolean coinbaseAddressCollision() { + return senderIsCoinbase() || recipientIsCoinbase(); + } + + public boolean addressCollision() { + return senderIsRecipient() || senderIsCoinbase() || recipientIsCoinbase(); + } + + public boolean noAddressCollisions() { + return !addressCollision(); + } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java index 5385e2191..b426c3c6b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java @@ -225,7 +225,7 @@ public CallSection(Hub hub, MessageFrame frame) { checkArgument(oobCall.isAbortingCondition() == aborts); hub.defers().scheduleForPostRollback(this, currentFrame); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); // The CALL is now unexceptional and un-aborted refineUndefinedScenario(hub, frame); @@ -370,6 +370,13 @@ private void prcProcessing(Hub hub) { && ((ModexpSubsection) precompileSubsection).transactionWillBePopped) { hub.defers().unscheduleForContextReEntry(this, hub.currentFrame()); hub.defers().unscheduleForPostTransaction(this); + System.out.println( + "WARNING: Illegal MODEXP arguments at" + + "\n\tHUB_STAMP = " + + hubStamp() + + "\n\tABS_TX_NUM = " + + hub.txStack().getCurrentAbsNumber() + + "\nTransaction must be popped!"); } } @@ -532,7 +539,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { final CallScenarioFragment.CallScenario scenario = scenarioFragment.getScenario(); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java index a62f2d4a3..6bae39253 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java @@ -202,7 +202,7 @@ public ReturnSection(Hub hub, MessageFrame frame) { .scheduleForContextReEntry( this, hub.callStack().parentCallFrame()); // post deployment account snapshot hub.defers().scheduleForPostRollback(this, callFrame); // undo deployment - hub.defers().scheduleForPostTransaction(this); // inserting the final context row; + hub.defers().scheduleForEndTransaction(this); // inserting the final context row; squashParentContextReturnData = ContextFragment.executionProvidesEmptyReturnData(hub); deploymentAddress = frame.getRecipientAddress(); @@ -307,7 +307,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { checkArgument(returnFromDeployment); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java index ae7575d0d..a1316d366 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java @@ -156,7 +156,7 @@ public SelfdestructSection(Hub hub, MessageFrame frame) { } hub.defers().scheduleForPostRollback(this, hub.currentFrame()); - hub.defers().scheduleForPostTransaction(this); + hub.defers().scheduleForEndTransaction(this); // Modify the current account and the recipient account // - The current account has its balance reduced to 0 (i+2) @@ -238,7 +238,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca } @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { if (selfDestructWasReverted) { @@ -259,6 +259,8 @@ public void resolvePostTransaction( checkArgument(hubStamp >= hubStampOfTheActionableSelfDestruct); + // This grabs the accounts right after the coinbase and sender got their gas money back + // in particular this will get the coinbase address post gas reward. accountWiping = transactionProcessingMetadata.getDestructedAccountsSnapshot().stream() .filter( diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java index ecd048eab..5caf267a7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java @@ -55,7 +55,7 @@ public StopSection(Hub hub) { "STOP is incapable of triggering an exception but " + Exceptions.prettyStringOf(OpCode.STOP, exceptions)); - hub.defers().scheduleForPostTransaction(this); // always + hub.defers().scheduleForEndTransaction(this); // always hubStamp = hub.stamp(); address = hub.messageFrame().getContractAddress(); @@ -142,7 +142,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca * @param isSuccessful */ @Override - public void resolvePostTransaction( + public void resolveAtEndTransaction( Hub hub, WorldView state, Transaction tx, boolean isSuccessful) { this.addFragments(this.parentContextReturnDataReset); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxn.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxn.java index 1d4a5f4c5..deb58f183 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxn.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxn.java @@ -111,7 +111,7 @@ public void traceStartTx(WorldView worldView, TransactionProcessingMetadata txMe final Transaction tx = txMetaData.getBesuTransaction(); // Contract Creation if (tx.getTo().isEmpty() && !tx.getInit().get().isEmpty()) { - this.operations.add(new RlpTxnOperation(tx, true)); + operations.add(new RlpTxnOperation(tx, true)); } // Call to a non-empty smart contract @@ -126,29 +126,30 @@ else if (tx.getTo().isPresent() } } - public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { + public void traceOperation(RlpTxnOperation operation, int absTxNum, Trace trace) { // Create the local row storage and specify transaction constant columns RlpTxnColumnsValue traceValue = new RlpTxnColumnsValue(); traceValue.resetDataHiLo(); traceValue.addrHi = bigIntegerToBytes(BigInteger.ZERO); traceValue.addrLo = bigIntegerToBytes(BigInteger.ZERO); traceValue.absTxNum = absTxNum; - traceValue.requiresEvmExecution = chunk.requireEvmExecution(); + traceValue.requiresEvmExecution = operation.requireEvmExecution(); traceValue.codeFragmentIndex = - chunk.tx().getTo().isEmpty() && chunk.requireEvmExecution() + operation.tx().getTo().isEmpty() && operation.requireEvmExecution() ? this.romLex.getCodeFragmentIndexByMetadata( ContractMetadata.make( - Address.contractAddress(chunk.tx().getSender(), chunk.tx().getNonce()), + Address.contractAddress(operation.tx().getSender(), operation.tx().getNonce()), 1, true)) : 0; - traceValue.txType = getTxTypeAsInt(chunk.tx().getType()); + traceValue.txType = getTxTypeAsInt(operation.tx().getType()); // Initialise RLP_LT and RLP_LX byte size + verify that we construct the right RLP this.reconstructedRlpLt = Bytes.EMPTY; this.reconstructedRlpLx = Bytes.EMPTY; Bytes besuRlpLt = - encodeOpaqueBytes((org.hyperledger.besu.ethereum.core.Transaction) chunk.tx(), BLOCK_BODY); + encodeOpaqueBytes( + (org.hyperledger.besu.ethereum.core.Transaction) operation.tx(), BLOCK_BODY); // the encodeOpaqueBytes method already concatenate with the first byte "transaction type" if (traceValue.txType == 0) { traceValue.rlpLtByteSize = innerRlpSize(besuRlpLt.size()); @@ -161,45 +162,45 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { case 0 -> { besuRlpLx = frontierPreimage( - chunk.tx().getNonce(), - (Wei) chunk.tx().getGasPrice().orElseThrow(), - chunk.tx().getGasLimit(), - chunk.tx().getTo().map(x -> (Address) x), - (Wei) chunk.tx().getValue(), - chunk.tx().getPayload(), - chunk.tx().getChainId()); + operation.tx().getNonce(), + (Wei) operation.tx().getGasPrice().orElseThrow(), + operation.tx().getGasLimit(), + operation.tx().getTo().map(x -> (Address) x), + (Wei) operation.tx().getValue(), + operation.tx().getPayload(), + operation.tx().getChainId()); traceValue.rlpLxByteSize = innerRlpSize(besuRlpLx.size()); } case 1 -> { List accessList = null; - if (chunk.tx().getAccessList().isPresent()) { - accessList = chunk.tx().getAccessList().orElseThrow(); + if (operation.tx().getAccessList().isPresent()) { + accessList = operation.tx().getAccessList().orElseThrow(); } besuRlpLx = accessListPreimage( - chunk.tx().getNonce(), - (Wei) chunk.tx().getGasPrice().orElseThrow(), - chunk.tx().getGasLimit(), - chunk.tx().getTo().map(x -> (Address) x), - (Wei) chunk.tx().getValue(), - chunk.tx().getPayload(), + operation.tx().getNonce(), + (Wei) operation.tx().getGasPrice().orElseThrow(), + operation.tx().getGasLimit(), + operation.tx().getTo().map(x -> (Address) x), + (Wei) operation.tx().getValue(), + operation.tx().getPayload(), accessList, - chunk.tx().getChainId()); + operation.tx().getChainId()); // the innerRlp method already concatenate with the first byte "transaction type" traceValue.rlpLxByteSize = innerRlpSize(besuRlpLx.size() - 1); } case 2 -> { besuRlpLx = eip1559Preimage( - chunk.tx().getNonce(), - (Wei) chunk.tx().getMaxPriorityFeePerGas().orElseThrow(), - (Wei) chunk.tx().getMaxFeePerGas().orElseThrow(), - chunk.tx().getGasLimit(), - chunk.tx().getTo().map(x -> (Address) x), - (Wei) chunk.tx().getValue(), - chunk.tx().getPayload(), - chunk.tx().getChainId(), - chunk.tx().getAccessList()); + operation.tx().getNonce(), + (Wei) operation.tx().getMaxPriorityFeePerGas().orElseThrow(), + (Wei) operation.tx().getMaxFeePerGas().orElseThrow(), + operation.tx().getGasLimit(), + operation.tx().getTo().map(x -> (Address) x), + (Wei) operation.tx().getValue(), + operation.tx().getPayload(), + operation.tx().getChainId(), + operation.tx().getAccessList()); // the innerRlp method already concatenate with the first byte "transaction type" traceValue.rlpLxByteSize = innerRlpSize(besuRlpLx.size() - 1); } @@ -214,20 +215,20 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { // Phase ChainId if (traceValue.txType == 1 || traceValue.txType == 2) { checkArgument( - bigIntegerToBytes(chunk.tx().getChainId().orElseThrow()).size() <= 8, + bigIntegerToBytes(operation.tx().getChainId().orElseThrow()).size() <= 8, "ChainId is longer than 8 bytes"); handlePhaseInteger( - traceValue, RLP_TXN_PHASE_CHAIN_ID, chunk.tx().getChainId().get(), 8, trace); + traceValue, RLP_TXN_PHASE_CHAIN_ID, operation.tx().getChainId().get(), 8, trace); } // Phase Nonce - BigInteger nonce = longToUnsignedBigInteger(chunk.tx().getNonce()); + BigInteger nonce = longToUnsignedBigInteger(operation.tx().getNonce()); traceValue.dataLo = nonce; handlePhaseInteger(traceValue, RLP_TXN_PHASE_NONCE, nonce, 8, trace); // Phase GasPrice if (traceValue.txType == 0 || traceValue.txType == 1) { - BigInteger gasPrice = chunk.tx().getGasPrice().orElseThrow().getAsBigInteger(); + BigInteger gasPrice = operation.tx().getGasPrice().orElseThrow().getAsBigInteger(); checkArgument(bigIntegerToBytes(gasPrice).size() <= 8, "GasPrice is longer than 8 bytes"); traceValue.dataLo = gasPrice; handlePhaseInteger(traceValue, RLP_TXN_PHASE_GAS_PRICE, gasPrice, 8, trace); @@ -236,7 +237,7 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { // Phase Max priority fee per gas (GasTipCap) if (traceValue.txType == 2) { BigInteger maxPriorityFeePerGas = - chunk.tx().getMaxPriorityFeePerGas().orElseThrow().getAsBigInteger(); + operation.tx().getMaxPriorityFeePerGas().orElseThrow().getAsBigInteger(); checkArgument( bigIntegerToBytes(maxPriorityFeePerGas).size() <= 8, "Max Priority Fee per Gas is longer than 8 bytes"); @@ -246,8 +247,8 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { // Phase Max fee per gas (GasFeeCap) if (traceValue.txType == 2) { - traceValue.dataHi = chunk.tx().getMaxPriorityFeePerGas().orElseThrow().getAsBigInteger(); - BigInteger maxFeePerGas = chunk.tx().getMaxFeePerGas().orElseThrow().getAsBigInteger(); + traceValue.dataHi = operation.tx().getMaxPriorityFeePerGas().orElseThrow().getAsBigInteger(); + BigInteger maxFeePerGas = operation.tx().getMaxFeePerGas().orElseThrow().getAsBigInteger(); checkArgument( bigIntegerToBytes(maxFeePerGas).size() <= 8, "Max Fee per Gas is longer than 8 bytes"); traceValue.dataLo = maxFeePerGas; @@ -255,24 +256,24 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { } // Phase GasLimit - BigInteger gasLimit = BigInteger.valueOf(chunk.tx().getGasLimit()); + BigInteger gasLimit = BigInteger.valueOf(operation.tx().getGasLimit()); traceValue.dataLo = gasLimit; handlePhaseInteger(traceValue, RLP_TXN_PHASE_GAS_LIMIT, gasLimit, 8, trace); // Phase To - if (chunk.tx().getTo().isPresent()) { - traceValue.dataHi = chunk.tx().getTo().orElseThrow().slice(0, 4).toUnsignedBigInteger(); - traceValue.dataLo = chunk.tx().getTo().orElseThrow().slice(4, 16).toUnsignedBigInteger(); + if (operation.tx().getTo().isPresent()) { + traceValue.dataHi = operation.tx().getTo().orElseThrow().slice(0, 4).toUnsignedBigInteger(); + traceValue.dataLo = operation.tx().getTo().orElseThrow().slice(4, 16).toUnsignedBigInteger(); } else { traceValue.dataHi = BigInteger.ZERO; traceValue.dataLo = BigInteger.ZERO; } - handlePhaseTo(traceValue, chunk.tx(), trace); + handlePhaseTo(traceValue, operation.tx(), trace); // Phase Value - BigInteger value = chunk.tx().getValue().getAsBigInteger(); + BigInteger value = operation.tx().getValue().getAsBigInteger(); traceValue.dataLo = value; - if (chunk.tx().getTo().isEmpty()) { + if (operation.tx().getTo().isEmpty()) { traceValue.dataHi = BigInteger.ONE; } else { traceValue.dataHi = BigInteger.ZERO; @@ -280,28 +281,28 @@ public void traceOperation(RlpTxnOperation chunk, int absTxNum, Trace trace) { handlePhaseInteger(traceValue, RLP_TXN_PHASE_VALUE, value, LLARGE, trace); // Phase Data - handlePhaseData(traceValue, chunk.tx(), trace); + handlePhaseData(traceValue, operation.tx(), trace); // Phase AccessList if (traceValue.txType == 1 || traceValue.txType == 2) { - handlePhaseAccessList(traceValue, chunk.tx(), trace); + handlePhaseAccessList(traceValue, operation.tx(), trace); } // Phase Beta / w if (traceValue.txType == 0) { - handlePhaseBeta(traceValue, chunk.tx(), trace); + handlePhaseBeta(traceValue, operation.tx(), trace); } // Phase y if (traceValue.txType == 1 || traceValue.txType == 2) { - handlePhaseY(traceValue, chunk.tx(), trace); + handlePhaseY(traceValue, operation.tx(), trace); } // Phase R - handle32BytesInteger(traceValue, RLP_TXN_PHASE_R, chunk.tx().getR(), trace); + handle32BytesInteger(traceValue, RLP_TXN_PHASE_R, operation.tx().getR(), trace); // Phase S - handle32BytesInteger(traceValue, RLP_TXN_PHASE_S, chunk.tx().getS(), trace); + handle32BytesInteger(traceValue, RLP_TXN_PHASE_S, operation.tx().getS(), trace); checkArgument( this.reconstructedRlpLt.equals(besuRlpLt), "Reconstructed RLP LT and Besu RLP LT differ"); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxnOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxnOperation.java index eeeb85f3f..e2612fd9e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxnOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/RlpTxnOperation.java @@ -31,9 +31,9 @@ public final class RlpTxnOperation extends ModuleOperation { private final Transaction tx; private final boolean requireEvmExecution; - public RlpTxnOperation(Transaction tx, boolean requireEvmExecution) { + public RlpTxnOperation(Transaction tx, boolean requiresEvmExecution) { this.tx = tx; - this.requireEvmExecution = requireEvmExecution; + this.requireEvmExecution = requiresEvmExecution; } @Override diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java index 4ab1f76dc..ef66f25cf 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java @@ -26,6 +26,7 @@ import net.consensys.linea.zktracer.container.module.OperationListModule; import net.consensys.linea.zktracer.container.stacked.ModuleOperationStackedList; import net.consensys.linea.zktracer.module.euc.Euc; +import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.hyperledger.besu.plugin.data.BlockBody; @@ -39,6 +40,7 @@ public class TxnData implements OperationListModule { private final ModuleOperationStackedList operations = new ModuleOperationStackedList<>(); + @Getter private final Hub hub; private final Wcp wcp; private final Euc euc; @@ -61,7 +63,7 @@ public final void traceStartBlock(final ProcessableBlockHeader blockHeader) { @Override public void traceEndTx(TransactionProcessingMetadata tx) { - operations.add(new TxndataOperation(wcp, euc, tx)); + operations.add(new TxndataOperation(hub, wcp, euc, tx)); } @Override diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java index 3979b4308..2ff14e3fd 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java @@ -49,6 +49,7 @@ import lombok.Getter; import net.consensys.linea.zktracer.container.ModuleOperation; import net.consensys.linea.zktracer.module.euc.Euc; +import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import net.consensys.linea.zktracer.types.UnsignedByte; @@ -56,6 +57,7 @@ import org.hyperledger.besu.datatypes.TransactionType; public class TxndataOperation extends ModuleOperation { + private final Hub hub; private final Wcp wcp; private final Euc euc; @Getter public final TransactionProcessingMetadata tx; @@ -69,7 +71,9 @@ public class TxndataOperation extends ModuleOperation { private final ArrayList valuesToRlpTxrcpt = new ArrayList<>(N_ROWS_TX_MAX); private static final Bytes BYTES_MAX_REFUND_QUOTIENT = Bytes.of(MAX_REFUND_QUOTIENT); - public TxndataOperation(Wcp wcp, Euc euc, TransactionProcessingMetadata tx) { + public TxndataOperation(Hub hub, Wcp wcp, Euc euc, TransactionProcessingMetadata tx) { + + this.hub = hub; this.wcp = wcp; this.euc = euc; this.tx = tx; @@ -336,8 +340,8 @@ public void traceTx(Trace trace, BlockSnapshot block, int absTxNumMax) { final Bytes gasPrice = Bytes.minimalBytes(tx.getEffectiveGasPrice()); final Bytes priorityFeePerGas = Bytes.minimalBytes(tx.feeRateForCoinbase()); final Bytes baseFee = block.getBaseFee().get().toMinimalBytes(); - final long coinbaseHi = highPart(block.getCoinbaseAddress()); - final Bytes coinbaseLo = lowPart(block.getCoinbaseAddress()); + final long coinbaseHi = highPart(hub.coinbaseAddress); + final Bytes coinbaseLo = lowPart(hub.coinbaseAddress); final int callDataSize = tx.isDeployment() ? 0 : tx.getBesuTransaction().getPayload().size(); final int initCodeSize = tx.isDeployment() ? tx.getBesuTransaction().getPayload().size() : 0; final Bytes gasLeftOver = Bytes.minimalBytes(tx.getLeftoverGas()); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/gas/projector/SStore.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/gas/projector/SStore.java index a7fcc7953..abe390b3b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/gas/projector/SStore.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/gas/projector/SStore.java @@ -15,7 +15,8 @@ package net.consensys.linea.zktracer.opcode.gas.projector; -import net.consensys.linea.zktracer.module.constants.GlobalConstants; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; + import org.apache.tuweni.units.bigints.UInt256; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.frame.MessageFrame; @@ -47,47 +48,48 @@ public long storageWarmth() { if (frame.getWarmedUpStorage().contains(frame.getRecipientAddress(), key)) { return 0L; } else { - return GlobalConstants.GAS_CONST_G_COLD_SLOAD; + return GAS_CONST_G_COLD_SLOAD; } } @Override public long sStoreValue() { if (newValue.equals(currentValue) || !originalValue.equals(currentValue)) { - return GlobalConstants.GAS_CONST_G_WARM_ACCESS; + return GAS_CONST_G_WARM_ACCESS; } else { - return originalValue.isZero() - ? GlobalConstants.GAS_CONST_G_SSET - : GlobalConstants.GAS_CONST_G_SRESET; + return originalValue.isZero() ? GAS_CONST_G_SSET : GAS_CONST_G_SRESET; } } @Override public long refund() { + + if (currentValue.equals(newValue)) { + return 0; + } + // beyond this point, v ≠ v' + + if (originalValue.equals(currentValue)) { + return newValue.isZero() ? REFUND_CONST_R_SCLEAR : 0; + } + // beyond this point, v ≠ v' and v0 ≠ v + long rDirtyClear = 0; if (!originalValue.isZero() && currentValue.isZero()) { - rDirtyClear = -GlobalConstants.REFUND_CONST_R_SCLEAR; + rDirtyClear = -REFUND_CONST_R_SCLEAR; } if (!originalValue.isZero() && newValue.isZero()) { - rDirtyClear = GlobalConstants.REFUND_CONST_R_SCLEAR; + rDirtyClear = REFUND_CONST_R_SCLEAR; } long rDirtyReset = 0; if (originalValue.equals(newValue) && originalValue.isZero()) { - rDirtyReset = GlobalConstants.GAS_CONST_G_SSET - GlobalConstants.GAS_CONST_G_WARM_ACCESS; + rDirtyReset = GAS_CONST_G_SSET - GAS_CONST_G_WARM_ACCESS; } if (originalValue.equals(newValue) && !originalValue.isZero()) { - rDirtyReset = GlobalConstants.GAS_CONST_G_SRESET - GlobalConstants.GAS_CONST_G_WARM_ACCESS; - } - - long r = 0; - if (!currentValue.equals(newValue) && currentValue.equals(originalValue) && newValue.isZero()) { - r = GlobalConstants.REFUND_CONST_R_SCLEAR; - } - if (!currentValue.equals(newValue) && !currentValue.equals(originalValue)) { - r = rDirtyClear + rDirtyReset; + rDirtyReset = GAS_CONST_G_SRESET - GAS_CONST_G_WARM_ACCESS; } - return r; + return rDirtyClear + rDirtyReset; } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java index 7ace6d966..fa217365f 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java @@ -51,7 +51,6 @@ public class TransactionProcessingMetadata { final int relativeBlockNumber; final Transaction besuTransaction; - final Address coinbase; final long baseFee; final boolean isDeployment; @@ -131,7 +130,6 @@ public TransactionProcessingMetadata( final int absoluteTransactionNumber) { this.absoluteTransactionNumber = absoluteTransactionNumber; relativeBlockNumber = block.blockNumber(); - coinbase = block.coinbaseAddress(); baseFee = block.baseFee().toLong(); besuTransaction = transaction; @@ -328,37 +326,4 @@ public void captureUpdatedInitialRecipientAddressDeploymentInfoAtTransactionStar public Bytes getTransactionCallData() { return besuTransaction.getData().orElse(Bytes.EMPTY); } - - public boolean senderIsRecipient() { - return besuTransaction.getTo().isPresent() - && besuTransaction.getTo().get().equals(besuTransaction.getSender()); - } - - public boolean senderIsCoinbase() { - return besuTransaction.getSender().equals(coinbase); - } - - public boolean recipientIsCoinbase() { - return besuTransaction.getTo().isPresent() && besuTransaction.getTo().get().equals(coinbase); - } - - public boolean senderAddressCollision() { - return senderIsRecipient() || senderIsCoinbase(); - } - - public boolean recipientAddressCollision() { - return senderIsRecipient() || recipientIsCoinbase(); - } - - public boolean coinbaseAddressCollision() { - return senderIsCoinbase() || recipientIsCoinbase(); - } - - public boolean addressCollision() { - return senderIsRecipient() || senderIsCoinbase() || recipientIsCoinbase(); - } - - public boolean noAddressCollisions() { - return !addressCollision(); - } } diff --git a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1280Tests.java b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1280Tests.java index 6643dbdb3..9640f66e0 100644 --- a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1280Tests.java +++ b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1280Tests.java @@ -17,11 +17,14 @@ import static net.consensys.linea.replaytests.ReplayTestTools.replay; import static net.consensys.linea.testing.ReplayExecutionEnvironment.LINEA_MAINNET; +import net.consensys.linea.UnitTestWatcher; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; @Tag("nightly") @Tag("replay") +@ExtendWith(UnitTestWatcher.class) public class Issue1280Tests { // 3901959-3902032 diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java index 5a5a2f5c0..f49c9b061 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/ExampleMultiBlockTest.java @@ -62,7 +62,7 @@ void test() { ToyAccount.builder() .balance(Wei.fromEth(1)) .nonce(116) - .address(Address.fromHexString("0xdead000000000000000000000000000beef")) + .address(Address.fromHexString("0xdeadbeef0000000000000000000deadbeef")) .build(); final KeyPair senderKeyPair1 = new SECP256K1().generateKeyPair(); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java index f9c844c13..35adea4b7 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java @@ -224,7 +224,9 @@ void receiverIsCoinbase() { .sender(senderAccount) .to(coinbaseAccount) .keyPair(senderKeyPair) - .value(Wei.of(123)) + .value(Wei.of(100)) + .gasPrice(Wei.of(8)) + .gasLimit(100000L) .build(); ToyExecutionEnvironmentV2.builder() diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/precompiles/ModexpTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/precompiles/ModexpTests.java index 0556d26ee..9f338ea38 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/precompiles/ModexpTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/precompiles/ModexpTests.java @@ -14,21 +14,26 @@ */ package net.consensys.linea.zktracer.precompiles; +import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.keyPair; +import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.userAccount; import static net.consensys.linea.zktracer.module.blake2fmodexpdata.BlakeModexpDataOperation.MODEXP_COMPONENT_BYTE_SIZE; import static net.consensys.linea.zktracer.module.hub.precompiles.ModexpMetadata.BASE_MIN_OFFSET; import static net.consensys.linea.zktracer.module.hub.precompiles.ModexpMetadata.BBS_MIN_OFFSET; import static net.consensys.linea.zktracer.module.hub.precompiles.ModexpMetadata.EBS_MIN_OFFSET; import static net.consensys.linea.zktracer.module.hub.precompiles.ModexpMetadata.MBS_MIN_OFFSET; +import java.util.ArrayList; import java.util.List; import net.consensys.linea.UnitTestWatcher; -import net.consensys.linea.testing.BytecodeCompiler; -import net.consensys.linea.testing.BytecodeRunner; +import net.consensys.linea.testing.*; import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -229,6 +234,53 @@ void variationsOnEmptyCalls() { BytecodeRunner.of(program.compile()).run(); } + /** + * This test was extracted from {@link BlockchainReferenceTest_339}, specifically {@link + * modexp_modsize0_returndatasize_d4g0v0_London}. It FAILS as our tests don't have a + * popping mechanism. + */ + @Disabled + @Test + void hugeMbsShortCdsModexpCallPlusReturnDataSize() { + + Bytes compiledCode = + Bytes.fromHexString( + "36600060003760206103e8366000600060055af26001556103e8516002553d60035500"); + Bytes transactionCallData = + Bytes.fromHexString( + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f3f140101010000000000000000000000000000000000000000000000000000000000"); + + final ToyAccount recipientAccount = + ToyAccount.builder() + .nonce(59) + .code(compiledCode) + .balance(Wei.fromEth(1)) + .address(Address.fromHexString("dddddddddddddddddddddddddddddddddddddddd")) + .build(); + + final Transaction transaction = + ToyTransaction.builder() + .sender(userAccount) + .to(recipientAccount) + .keyPair(keyPair) + .payload(transactionCallData) + .gasPrice(Wei.of(8)) + .value(Wei.of(123)) + .build(); + + List transactions = new ArrayList<>(); + transactions.add(transaction); + + List accounts = List.of(userAccount, recipientAccount); + + ToyExecutionEnvironmentV2.builder() + .accounts(accounts) + .transactions(transactions) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + void appendAllZeroCallDataModexpCalls(BytecodeCompiler program, int callDataSize) { program .push(Bytes.fromHexString("0200")) // rds 0x0200 ≡ 512 in decimal diff --git a/linea-constraints b/linea-constraints index b644a399a..51d098010 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit b644a399a81bc6fdd8c57abc050e9648e6117b15 +Subproject commit 51d0980104f37489d5ea749548d31ec0c71964ab diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index 76a1421f8..f7bdd8379 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -91,7 +91,7 @@ tasks.register('referenceGeneralStateTests', Test) { dependsOn buildReferenceTestsZkevmBin environment.put("ZKEVM_BIN", "zkevm_for_reference_tests.bin") - systemProperty("junit.jupiter.execution.timeout.default", "5 m") // 5 minutes + systemProperty("junit.jupiter.execution.timeout.default", "15 m") // 5 minutes systemProperty("junit.jupiter.execution.parallel.enabled", "true") systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent") diff --git a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java index f82737ab3..c06511e3c 100644 --- a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java @@ -88,7 +88,7 @@ public class BlockchainReferenceTestTools { PARAMS.ignore("dynamicAccountOverwriteEmpty_d0g0v0_London\\[London\\]"); // ignore tests that are failing because there is an account with nonce 0 and - // non empty code which can't happen in Linea since we are post LONDON only. + // non empty code which can't happen in Linea since we are post LONDON PARAMS.ignore("InitCollision_d0g0v0_London\\[London\\]"); PARAMS.ignore("InitCollision_d1g0v0_London\\[London\\]"); PARAMS.ignore("InitCollision_d2g0v0_London\\[London\\]"); @@ -120,14 +120,87 @@ public class BlockchainReferenceTestTools { PARAMS.ignore("randomStatetest94_\\w+"); // Balance is more than 128 bits + PARAMS.ignore("CALLCODE_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds4_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds4_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds4_d0g2v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALLCODE_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds2a_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds2a_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds3_d0g2v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CALL_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds3_d0g2v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE2_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds3_d0g2v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("CREATE_Bounds_d0g1v0_London\\[London\\]"); PARAMS.ignore("Call1024PreCalls_d0g0v0_London\\[London\\]"); PARAMS.ignore("Call1024PreCalls_d0g1v0_London\\[London\\]"); + PARAMS.ignore("Call1024PreCalls_d0g2v0_London\\[London\\]"); + PARAMS.ignore("Create2OnDepth1023_d0g0v0_London\\[London\\]"); + PARAMS.ignore("Create2OnDepth1024_d0g0v0_London\\[London\\]"); + PARAMS.ignore("Create2Recursive_d0g0v0_London\\[London\\]"); + PARAMS.ignore("Create2Recursive_d0g1v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds3_d0g2v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("DELEGATECALL_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("DelegateCallSpam_London\\[London\\]"); + PARAMS.ignore("HighGasLimit_d0g0v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds2a_d0g0v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds2a_d0g1v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("MSTORE_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("OutOfGasContractCreation_d0g0v0_London\\[London\\]"); + PARAMS.ignore("OutOfGasContractCreation_d0g1v0_London\\[London\\]"); + PARAMS.ignore("OutOfGasContractCreation_d1g0v0_London\\[London\\]"); + PARAMS.ignore("OutOfGasContractCreation_d1g1v0_London\\[London\\]"); + PARAMS.ignore("OverflowGasRequire2_d0g0v0_London\\[London\\]"); PARAMS.ignore("OverflowGasRequire_London\\[London\\]"); + PARAMS.ignore("RETURN_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("RETURN_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("RETURN_Bounds_d0g2v0_London\\[London\\]"); PARAMS.ignore("StrangeContractCreation_London\\[London\\]"); PARAMS.ignore("SuicideIssue_London\\[London\\]"); - PARAMS.ignore("DelegateCallSpam_London\\[London\\]"); - PARAMS.ignore("OverflowGasRequire2_d0g0v0_London\\[London\\]"); - PARAMS.ignore("HighGasLimit_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds2_d0g1v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds2a_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds2a_d0g1v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds3_d0g1v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_CALL_Bounds_d0g1v0_London\\[London\\]"); + PARAMS.ignore("static_Call1024PreCalls2_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_Call1024PreCalls2_d1g0v0_London\\[London\\]"); + PARAMS.ignore("static_Call1024PreCalls3_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_Call1024PreCalls3_d1g0v0_London\\[London\\]"); + PARAMS.ignore("static_Call1024PreCalls_d1g0v0_London\\[London\\]"); + PARAMS.ignore("static_RETURN_BoundsOOG_d0g0v0_London\\[London\\]"); + PARAMS.ignore("static_RETURN_BoundsOOG_d1g0v0_London\\[London\\]"); + PARAMS.ignore("static_RETURN_Bounds_d0g0v0_London\\[London\\]"); // Deployment transaction to an account with nonce / code PARAMS.ignore("TransactionCollisionToEmptyButCode_d0g0v0_London\\[London\\]"); @@ -139,18 +212,85 @@ public class BlockchainReferenceTestTools { PARAMS.ignore("TransactionCollisionToEmptyButNonce_d0g1v0_London\\[London\\]"); PARAMS.ignore("TransactionCollisionToEmptyButNonce_d0g1v1_London\\[London\\]"); PARAMS.ignore("createJS_ExampleContract_d0g0v0_London\\[London\\]"); + PARAMS.ignore("initCollidingWithNonEmptyAccount_d0g0v0_London\\[London\\]"); + PARAMS.ignore("initCollidingWithNonEmptyAccount_d1g0v0_London\\[London\\]"); + PARAMS.ignore("initCollidingWithNonEmptyAccount_d2g0v0_London\\[London\\]"); + PARAMS.ignore("initCollidingWithNonEmptyAccount_d3g0v0_London\\[London\\]"); + PARAMS.ignore("initCollidingWithNonEmptyAccount_d4g0v0_London\\[London\\]"); + + // Deployment transaction to an account with zero nonce, empty code (and zero balance) but + // nonempty storage. Given [EIP-7610](https://github.com/ethereum/EIPs/pull/8161), no Besu + // execution takes place, which means that no TraceSection's are created beyond the + // {@link TxInitializationSection}. This triggers a NPE when tracing, as at some point + // {@link TraceSection#nextSection} is null in {@link TraceSection#computeContextNumberNew()}. + PARAMS.ignore("FailedCreateRevertsDeletion_d0g0v0_London\\[London\\]"); + + // Ignore the following test as it is not supported in Linea. + // See [issue #1678](https://github.com/Consensys/linea-tracer/issues/1678) + PARAMS.ignore("suicideStorageCheck_London\\[London\\]"); // Don't do time-consuming tests. PARAMS.ignore("CALLBlake2f_MaxRounds.*"); PARAMS.ignore("loopMul_*"); // Inconclusive fork choice rule, since in merge CL should be choosing forks and setting the - // chain head. - // Perfectly valid test pre-merge. + // chain head. Perfectly valid test pre-merge. PARAMS.ignore("UncleFromSideChain_(Merge|Shanghai|Cancun|Prague|Osaka|Bogota)"); // EOF tests are written against an older version of the spec. PARAMS.ignore("/stEOF/"); + + // We ignore the following tests because they satisfy one of the following: + // - bbs > 512, bbs ≡ base byte size + // - ebs > 512, ebs ≡ exponent byte size + // - mbs > 512, mbs ≡ modulus byte size + PARAMS.ignore("modexp_d28g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d28g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d28g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d28g3v0_London\\[London\\]"); + PARAMS.ignore("modexp_d29g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d29g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d29g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d29g3v0_London\\[London\\]"); + PARAMS.ignore("modexp_d2g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d2g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d2g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d2g3v0_London\\[London\\]"); + PARAMS.ignore("modexp_d30g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d30g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d30g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d30g3v0_London\\[London\\]"); + PARAMS.ignore("modexp_d36g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d36g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d36g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d36g3v0_London\\[London\\]"); + PARAMS.ignore("modexp_d37g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_d37g1v0_London\\[London\\]"); + PARAMS.ignore("modexp_d37g2v0_London\\[London\\]"); + PARAMS.ignore("modexp_d37g3v0_London\\[London\\]"); + PARAMS.ignore("idPrecomps_d4g0v0_London\\[London\\]"); + PARAMS.ignore("modexp_modsize0_returndatasize_d4g0v0_London\\[London\\]"); + PARAMS.ignore("randomStatetest650_d0g0v0_London\\[London\\]"); + + // unsupported behaviour: uncle blocks, re-orgs, forks, side chain (?) + PARAMS.ignore("ChainAtoChainBCallContractFormA_London\\[London\\]"); + PARAMS.ignore("ChainAtoChainB_London\\[London\\]"); + PARAMS.ignore("ChainAtoChainB_difficultyB_London\\[London\\]"); + PARAMS.ignore("ChainAtoChainBtoChainA_London\\[London\\]"); + PARAMS.ignore("ForkStressTest_London\\[London\\]"); + PARAMS.ignore("newChainFrom4Block_London\\[London\\]"); + PARAMS.ignore("newChainFrom5Block_London\\[London\\]"); + PARAMS.ignore("newChainFrom6Block_London\\[London\\]"); + PARAMS.ignore("sideChainWithMoreTransactions2_London\\[London\\]"); + PARAMS.ignore("sideChainWithMoreTransactions_London\\[London\\]"); + PARAMS.ignore("sideChainWithNewMaxDifficultyStartingFromBlock3AfterBlock4_London\\[London\\]"); + PARAMS.ignore("uncleBlockAtBlock3AfterBlock3_London\\[London\\]"); + PARAMS.ignore("uncleBlockAtBlock3afterBlock4_London\\[London\\]"); + + // not sure what these tests are doing, but they blow up BLOCK_DATA, which is the simplest + // module in existence + PARAMS.ignore("CallContractFromNotBestBlock_London\\[London\\]"); + PARAMS.ignore("RPC_API_Test_London\\[London\\]"); } private BlockchainReferenceTestTools() { diff --git a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java index 74b9242cb..fb7f5e740 100644 --- a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java +++ b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java @@ -177,7 +177,6 @@ public BlockProcessingResult processBlock( return new BlockProcessingResult(Optional.empty(), e); } zkTracer.traceEndBlock(blockHeader, blockBody); - zkTracer.traceEndConflation(worldState); return new BlockProcessingResult(Optional.of(new BlockProcessingOutputs(worldState, receipts))); } From 44358771fb0dccffe320d804c31ad06ef124414c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Fri, 10 Jan 2025 18:14:22 +0100 Subject: [PATCH 08/54] fix: constraints update --- back to master (#1687) --- linea-constraints | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linea-constraints b/linea-constraints index 51d098010..05aa1c6be 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 51d0980104f37489d5ea749548d31ec0c71964ab +Subproject commit 05aa1c6bef87ef2387e079f726809eab6a3c5659 From bd8b4fd802af2f943a4b17c17122ca1642f2a885 Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Tue, 14 Jan 2025 12:29:08 +0100 Subject: [PATCH 09/54] 1679 blockhash update (#1681) --- .../module/blockdata/BlockdataOperation.java | 9 +- .../zktracer/module/blockhash/Blockhash.java | 72 +- .../module/blockhash/BlockhashComparator.java | 4 +- .../module/blockhash/BlockhashOperation.java | 191 ++- .../zktracer/module/blockhash/Trace.java | 1122 +++++------------ .../linea/zktracer/module/hub/Hub.java | 5 +- .../hub/section/TxFinalizationSection.java | 3 +- .../module/txndata/TxndataOperation.java | 7 +- .../linea/zktracer/opcode/OpCode.java | 4 + .../linea/zktracer/MultiBlockUtils.java | 92 ++ .../module/blockdata/GasLimitTest.java | 120 ++ .../blockdata/NextGasLimitScenario.java | 37 + .../module/blockhash/BlockhashTest.java | 140 +- gradle/trace-files.gradle | 4 +- linea-constraints | 2 +- .../linea/testing/ExecutionEnvironment.java | 12 +- .../MultiBlockExecutionEnvironment.java | 8 + .../testing/ToyExecutionEnvironmentV2.java | 2 +- 18 files changed, 849 insertions(+), 985 deletions(-) create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/MultiBlockUtils.java create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/NextGasLimitScenario.java diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index acb6d3fd1..d0c1cc28a 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -40,6 +40,7 @@ import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.plugin.data.BlockHeader; @Accessors(fluent = true) @@ -51,6 +52,7 @@ public class BlockdataOperation extends ModuleOperation { private final Bytes chainId; private final BlockHeader blockHeader; private final BlockHeader prevBlockHeader; + private final Address coinbaseAddress; private final EWord POWER_256_20 = EWord.of(BigInteger.ONE.shiftLeft(20 * 8)); private final EWord POWER_256_6 = EWord.of(BigInteger.ONE.shiftLeft(6 * 8)); @@ -83,6 +85,7 @@ public BlockdataOperation( this.hub = hub; this.blockHeader = blockHeader; this.prevBlockHeader = prevBlockHeader; + this.coinbaseAddress = hub.coinbaseAddress; this.chainId = chainId; this.ctMax = ctMax(opCode); @@ -172,9 +175,11 @@ private void handleGasLimit() { data = EWord.of(blockHeader.getGasLimit()); // row i + // comparison to minimum wcpCallToGEQ(0, data, EWord.of(LINEA_GAS_LIMIT_MINIMUM)); // row i + 1 + // comparison to maximum wcpCallToLEQ(1, data, EWord.of(Bytes.ofUnsignedLong(LINEA_GAS_LIMIT_MAXIMUM))); if (!firstBlockInConflation) { @@ -227,8 +232,8 @@ public void trace(Trace trace) { .isChainid(opCode == OpCode.CHAINID) .isBasefee(opCode == OpCode.BASEFEE) .inst(UnsignedByte.of(opCode.byteValue())) - .coinbaseHi(hub.coinbaseAddress.slice(0, 4).toLong()) - .coinbaseLo(hub.coinbaseAddress.slice(4, LLARGE)) + .coinbaseHi(coinbaseAddress.slice(0, 4).toLong()) + .coinbaseLo(coinbaseAddress.slice(4, LLARGE)) .blockGasLimit(Bytes.ofUnsignedLong(blockHeader.getGasLimit())) .basefee( Bytes.ofUnsignedLong(blockHeader.getBaseFee().get().getAsBigInteger().longValue())) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java index 8c63e235e..00a7b5930 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java @@ -16,8 +16,6 @@ package net.consensys.linea.zktracer.module.blockhash; import static com.google.common.base.Preconditions.checkArgument; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.BLOCKHASH_MAX_HISTORY; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import java.nio.MappedByteBuffer; import java.util.HashMap; @@ -33,7 +31,6 @@ import net.consensys.linea.zktracer.module.hub.defer.PostOpcodeDefer; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.opcode.OpCode; -import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.operation.Operation; @@ -52,20 +49,16 @@ public class Blockhash implements OperationSetModule, PostOp /* Stores the result of BLOCKHASH if the result of the opcode is not 0 */ private final Map blockHashMap = new HashMap<>(); - /* Store the number of call (capped to 2) of BLOCKHASH of a BLOCK_NUMBER*/ - private final Map numberOfCall = new HashMap<>(); - private long absoluteBlockNumber; - private short relativeBlock; + private short relBlock; + private long absBlock; - private Bytes32 opcodeArgument; - private boolean lowerBound; - private boolean upperBound; + private Bytes32 blockhashArg; public Blockhash(Hub hub, Wcp wcp) { this.hub = hub; this.wcp = wcp; - this.relativeBlock = 0; + this.relBlock = 0; } @Override @@ -75,8 +68,8 @@ public String moduleKey() { @Override public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) { - relativeBlock += 1; - absoluteBlockNumber = processableBlockHeader.getNumber(); + relBlock += 1; + absBlock = processableBlockHeader.getNumber(); } @Override @@ -84,22 +77,9 @@ public void tracePreOpcode(MessageFrame frame) { final OpCode opCode = OpCode.of(frame.getCurrentOperation().getOpcode()); checkArgument(opCode == OpCode.BLOCKHASH, "Expected BLOCKHASH opcode"); - opcodeArgument = Bytes32.leftPad(frame.getStackItem(0)); - lowerBound = - wcp.callGEQ( - opcodeArgument, Bytes.ofUnsignedLong(absoluteBlockNumber - BLOCKHASH_MAX_HISTORY)); - upperBound = wcp.callLT(opcodeArgument, Bytes.ofUnsignedLong(absoluteBlockNumber)); + blockhashArg = Bytes32.leftPad(frame.getStackItem(0)); hub.defers().scheduleForPostExecution(this); - - /* To prove the lex order of BLOCK_NUMBER_HI/LO, we call WCP at endConflation, so we need to add rows in WCP now. - If a BLOCK_NUMBER is already called at least two times, no need for additional rows in WCP*/ - final int numberOfCall = this.numberOfCall.getOrDefault(opcodeArgument, 0); - if (numberOfCall < 2) { - wcp.additionalRows.add( - Math.max(Math.min(LLARGE, opcodeArgument.trimLeadingZeros().size()), 1)); - this.numberOfCall.replace(opcodeArgument, numberOfCall, numberOfCall + 1); - } } @Override @@ -108,26 +88,27 @@ public void resolvePostExecution( final OpCode opCode = OpCode.of(frame.getCurrentOperation().getOpcode()); if (opCode == OpCode.BLOCKHASH) { - final Bytes32 result = Bytes32.leftPad(frame.getStackItem(0)); - operations.add( - new BlockhashOperation( - relativeBlock, opcodeArgument, absoluteBlockNumber, lowerBound, upperBound, result)); - if (result != Bytes32.ZERO) { - blockHashMap.put(opcodeArgument, result); + final Bytes32 blockhashRes = Bytes32.leftPad(frame.getStackItem(0)); + operations.add(new BlockhashOperation(relBlock, absBlock, blockhashArg, blockhashRes, wcp)); + if (blockhashRes != Bytes32.ZERO) { + blockHashMap.put(blockhashArg, blockhashRes); } } } + /** + * Operations are sorted wrt blockhashArg and the wcp module is called accordingly. We must call + * the WCP module before calling {@link #commit(List)} as the headers sizes must + * be computed with the final list of operations ready. + */ @Override public void traceEndConflation(WorldView state) { OperationSetModule.super.traceEndConflation(state); sortedOperations = sortOperations(new BlockhashComparator()); - if (!sortedOperations.isEmpty()) { - wcp.callGEQ(sortedOperations.getFirst().opcodeArgument(), Bytes32.ZERO); - for (int i = 1; i < sortedOperations.size(); i++) { - wcp.callGEQ( - sortedOperations.get(i).opcodeArgument(), sortedOperations.get(i - 1).opcodeArgument()); - } + Bytes32 prevBlockhashArg = Bytes32.ZERO; + for (BlockhashOperation op : sortedOperations) { + op.handlePreprocessing(prevBlockhashArg); + prevBlockhashArg = op.blockhashArg(); } } @@ -139,13 +120,14 @@ public List columnsHeaders() { @Override public void commit(List buffers) { final Trace trace = new Trace(buffers); - for (BlockhashOperation op : sortedOperations) { - final Bytes32 hash = - op.result() == Bytes32.ZERO - ? this.blockHashMap.getOrDefault(op.opcodeArgument(), Bytes32.ZERO) - : op.result(); - op.trace(trace, hash); + for (BlockhashOperation op : sortedOperations) { + final Bytes32 blockhashVal = + op.blockhashRes() == Bytes32.ZERO + ? this.blockHashMap.getOrDefault(op.blockhashArg(), Bytes32.ZERO) + : op.blockhashRes(); + op.traceMacro(trace, blockhashVal); + op.tracePreprocessing(trace); } } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashComparator.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashComparator.java index 0bcbc0302..9b272a605 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashComparator.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashComparator.java @@ -21,12 +21,12 @@ public class BlockhashComparator implements Comparator { @Override public int compare(BlockhashOperation o1, BlockhashOperation o2) { // First, sort by BLOCK_NUMBER - final int blockNumberComparison = o1.opcodeArgument().compareTo(o2.opcodeArgument()); + final int blockNumberComparison = o1.blockhashArg().compareTo(o2.blockhashArg()); if (blockNumberComparison != 0) { return blockNumberComparison; } else { // Second, sort by RELATIVE_BLOCK - return o1.relativeBlock() - o2.relativeBlock(); + return o1.relBlock() - o2.relBlock(); } } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java index e23589a14..f0285cb51 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java @@ -15,78 +15,159 @@ package net.consensys.linea.zktracer.module.blockhash; +import static net.consensys.linea.zktracer.module.blockhash.Trace.BLOCKHASH_DEPTH; +import static net.consensys.linea.zktracer.module.blockhash.Trace.nROWS_PRPRC; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_EQ; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_LT; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; import lombok.EqualsAndHashCode; import lombok.Getter; -import lombok.RequiredArgsConstructor; import lombok.experimental.Accessors; import net.consensys.linea.zktracer.container.ModuleOperation; -import net.consensys.linea.zktracer.types.UnsignedByte; +import net.consensys.linea.zktracer.module.wcp.Wcp; +import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; @Accessors(fluent = true) @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false) -@RequiredArgsConstructor public class BlockhashOperation extends ModuleOperation { - @Getter @EqualsAndHashCode.Include private final short relativeBlock; - @Getter @EqualsAndHashCode.Include private final Bytes32 opcodeArgument; - private final long absoluteBlockNumber; - private final boolean lowerBound; - private final boolean upperBound; - @Getter private final Bytes32 result; + @Getter @EqualsAndHashCode.Include private final short relBlock; + @Getter @EqualsAndHashCode.Include private final Bytes32 blockhashArg; + private final long absBlock; + @Getter private final Bytes32 blockhashRes; + private final Wcp wcp; + + private final Bytes[] exoArg1Hi = new Bytes[nROWS_PRPRC]; + private final Bytes[] exoArg1Lo = new Bytes[nROWS_PRPRC]; + private final Bytes[] exoArg2Hi = new Bytes[nROWS_PRPRC]; + private final Bytes[] exoArg2Lo = new Bytes[nROWS_PRPRC]; + private final long[] exoInst = new long[nROWS_PRPRC]; + private final boolean[] exoRes = new boolean[nROWS_PRPRC]; + + public BlockhashOperation( + final short relBlock, + final long absBlock, + final Bytes32 blockhashArg, + final Bytes32 blockhashRes, + final Wcp wcp) { + this.relBlock = relBlock; + this.absBlock = absBlock; + this.blockhashArg = blockhashArg; + this.blockhashRes = blockhashRes; + this.wcp = wcp; + } + + void handlePreprocessing(Bytes32 prevBlockhashArg) { + final Bytes prevBHArgHi = prevBlockhashArg.slice(0, LLARGE); + final Bytes prevBHArgLo = prevBlockhashArg.slice(LLARGE, LLARGE); + final Bytes currBHArgHi = blockhashArg.slice(0, LLARGE); + final Bytes curBHArgLo = blockhashArg.slice(LLARGE, LLARGE); + + // NOTE: w goes from 0 to 4 because it refers to the array + // however, rows go from i+1 to i+5 because it refers the MACRO row (index i) + // row i + 1 + wcpCallToLEQ(0, prevBHArgHi, prevBHArgLo, currBHArgHi, curBHArgLo); + + // row i + 2 + boolean sameBHArg = wcpCallToEQ(1, prevBHArgHi, prevBHArgLo, currBHArgHi, curBHArgLo); + + // row i + 3 + boolean res3 = + wcpCallToLEQ( + 2, Bytes.of(0), Bytes.ofUnsignedInt(256), Bytes.of(0), Bytes.ofUnsignedLong(absBlock)); + long minimalReachable = 0; + if (res3) { + minimalReachable = absBlock - 256; + } + + // row i + 4 + boolean upperBoundOk = + wcpCallToLT(3, currBHArgHi, curBHArgLo, Bytes.of(0), Bytes.ofUnsignedLong(absBlock)); + + // row i + 5 + boolean lowerBoundOk = + wcpCallToLEQ( + 4, Bytes.of(0), Bytes.ofUnsignedLong(minimalReachable), currBHArgHi, curBHArgLo); + } @Override protected int computeLineCount() { - return 1; + return BLOCKHASH_DEPTH; } - public void trace(Trace trace, final Bytes32 hash) { + public void traceMacro(Trace trace, final Bytes32 blockhashVal) { trace .iomf(true) - .blockNumberHi(opcodeArgument.slice(0, LLARGE)) - .blockNumberLo(opcodeArgument.slice(LLARGE, LLARGE)) - .resHi(result.slice(0, LLARGE)) - .resLo(result.slice(LLARGE, LLARGE)) - .relBlock(relativeBlock) - .absBlock(absoluteBlockNumber) - .lowerBoundCheck(lowerBound) - .upperBoundCheck(upperBound) - .inRange(lowerBound && upperBound) - .blockHashHi(hash.slice(0, LLARGE)) - .blockHashLo(hash.slice(LLARGE, LLARGE)) - .byteHi0(UnsignedByte.of(hash.get(0))) - .byteHi1(UnsignedByte.of(hash.get(1))) - .byteHi2(UnsignedByte.of(hash.get(2))) - .byteHi3(UnsignedByte.of(hash.get(3))) - .byteHi4(UnsignedByte.of(hash.get(4))) - .byteHi5(UnsignedByte.of(hash.get(5))) - .byteHi6(UnsignedByte.of(hash.get(6))) - .byteHi7(UnsignedByte.of(hash.get(7))) - .byteHi8(UnsignedByte.of(hash.get(8))) - .byteHi9(UnsignedByte.of(hash.get(9))) - .byteHi10(UnsignedByte.of(hash.get(10))) - .byteHi11(UnsignedByte.of(hash.get(11))) - .byteHi12(UnsignedByte.of(hash.get(12))) - .byteHi13(UnsignedByte.of(hash.get(13))) - .byteHi14(UnsignedByte.of(hash.get(14))) - .byteHi15(UnsignedByte.of(hash.get(15))) - .byteLo0(UnsignedByte.of(hash.get(LLARGE + 0))) - .byteLo1(UnsignedByte.of(hash.get(LLARGE + 1))) - .byteLo2(UnsignedByte.of(hash.get(LLARGE + 2))) - .byteLo3(UnsignedByte.of(hash.get(LLARGE + 3))) - .byteLo4(UnsignedByte.of(hash.get(LLARGE + 4))) - .byteLo5(UnsignedByte.of(hash.get(LLARGE + 5))) - .byteLo6(UnsignedByte.of(hash.get(LLARGE + 6))) - .byteLo7(UnsignedByte.of(hash.get(LLARGE + 7))) - .byteLo8(UnsignedByte.of(hash.get(LLARGE + 8))) - .byteLo9(UnsignedByte.of(hash.get(LLARGE + 9))) - .byteLo10(UnsignedByte.of(hash.get(LLARGE + 10))) - .byteLo11(UnsignedByte.of(hash.get(LLARGE + 11))) - .byteLo12(UnsignedByte.of(hash.get(LLARGE + 12))) - .byteLo13(UnsignedByte.of(hash.get(LLARGE + 13))) - .byteLo14(UnsignedByte.of(hash.get(LLARGE + 14))) - .byteLo15(UnsignedByte.of(hash.get(LLARGE + 15))) - .validateRow(); + .macro(true) + .ct(0) + .ctMax(0) + .pMacroRelBlock(relBlock) + .pMacroAbsBlock(absBlock) + .pMacroBlockhashValHi(blockhashVal.slice(0, LLARGE)) + .pMacroBlockhashValLo(blockhashVal.slice(LLARGE, LLARGE)) + .pMacroBlockhashArgHi(blockhashArg.slice(0, LLARGE)) + .pMacroBlockhashArgLo(blockhashArg.slice(LLARGE, LLARGE)) + .pMacroBlockhashResHi(blockhashRes.slice(0, LLARGE)) + .pMacroBlockhashResLo(blockhashRes.slice(LLARGE, LLARGE)) + .fillAndValidateRow(); + } + + public void tracePreprocessing(Trace trace) { + for (int ct = 0; ct < nROWS_PRPRC; ct++) { + trace + .iomf(true) + .prprc(true) + .ct(ct) + .ctMax(nROWS_PRPRC - 1) + .pPreprocessingExoInst(exoInst[ct]) + .pPreprocessingExoArg1Hi(exoArg1Hi[ct]) + .pPreprocessingExoArg1Lo(exoArg1Lo[ct]) + .pPreprocessingExoArg2Hi(exoArg2Hi[ct]) + .pPreprocessingExoArg2Lo(exoArg2Lo[ct]) + .pPreprocessingExoRes(exoRes[ct]) + .fillAndValidateRow(); + } + } + + // WCP calls + private boolean wcpCallToLT( + int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + this.exoInst[w] = EVM_INST_LT; + this.exoArg1Hi[w] = exoArg1Hi; + this.exoArg1Lo[w] = exoArg1Lo; + this.exoArg2Hi[w] = exoArg2Hi; + this.exoArg2Lo[w] = exoArg2Lo; + this.exoRes[w] = + wcp.callLT( + Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + return this.exoRes[w]; + } + + private boolean wcpCallToLEQ( + int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + this.exoInst[w] = WCP_INST_LEQ; + this.exoArg1Hi[w] = exoArg1Hi; + this.exoArg1Lo[w] = exoArg1Lo; + this.exoArg2Hi[w] = exoArg2Hi; + this.exoArg2Lo[w] = exoArg2Lo; + this.exoRes[w] = + wcp.callLEQ( + Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + return this.exoRes[w]; + } + + private boolean wcpCallToEQ( + int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + this.exoInst[w] = EVM_INST_EQ; + this.exoArg1Hi[w] = exoArg1Hi; + this.exoArg1Lo[w] = exoArg1Lo; + this.exoArg2Hi[w] = exoArg2Hi; + this.exoArg2Lo[w] = exoArg2Lo; + this.exoRes[w] = + wcp.callEQ( + Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + return this.exoRes[w]; } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java index 40e93fc2e..19f600a33 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java @@ -21,7 +21,6 @@ import java.util.List; import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; /** @@ -31,149 +30,71 @@ * Please DO NOT ATTEMPT TO MODIFY this code directly. */ public class Trace { + public static final int BLOCKHASH_DEPTH = 0x6; + public static final int NEGATIVE_OF_BLOCKHASH_DEPTH = -0x6; + public static final int ROFF___ABS___comparison_to_256 = 0x3; + public static final int ROFF___BLOCKHASH_arguments___equality_test = 0x2; + public static final int ROFF___BLOCKHASH_arguments___monotony = 0x1; + public static final int ROFF___curr_BLOCKHASH_argument___comparison_to_max = 0x4; + public static final int ROFF___curr_BLOCKHASH_argument___comparison_to_min = 0x5; + public static final int nROWS_MACRO = 0x1; + public static final int nROWS_PRPRC = 0x5; private final BitSet filled = new BitSet(); private int currentLine = 0; private final MappedByteBuffer absBlock; - private final MappedByteBuffer blockHashHi; - private final MappedByteBuffer blockHashLo; - private final MappedByteBuffer blockNumberHi; - private final MappedByteBuffer blockNumberLo; - private final MappedByteBuffer byteHi0; - private final MappedByteBuffer byteHi1; - private final MappedByteBuffer byteHi10; - private final MappedByteBuffer byteHi11; - private final MappedByteBuffer byteHi12; - private final MappedByteBuffer byteHi13; - private final MappedByteBuffer byteHi14; - private final MappedByteBuffer byteHi15; - private final MappedByteBuffer byteHi2; - private final MappedByteBuffer byteHi3; - private final MappedByteBuffer byteHi4; - private final MappedByteBuffer byteHi5; - private final MappedByteBuffer byteHi6; - private final MappedByteBuffer byteHi7; - private final MappedByteBuffer byteHi8; - private final MappedByteBuffer byteHi9; - private final MappedByteBuffer byteLo0; - private final MappedByteBuffer byteLo1; - private final MappedByteBuffer byteLo10; - private final MappedByteBuffer byteLo11; - private final MappedByteBuffer byteLo12; - private final MappedByteBuffer byteLo13; - private final MappedByteBuffer byteLo14; - private final MappedByteBuffer byteLo15; - private final MappedByteBuffer byteLo2; - private final MappedByteBuffer byteLo3; - private final MappedByteBuffer byteLo4; - private final MappedByteBuffer byteLo5; - private final MappedByteBuffer byteLo6; - private final MappedByteBuffer byteLo7; - private final MappedByteBuffer byteLo8; - private final MappedByteBuffer byteLo9; - private final MappedByteBuffer inRange; + private final MappedByteBuffer blockhashArgHiXorExoArg1Hi; + private final MappedByteBuffer blockhashArgLoXorExoArg1Lo; + private final MappedByteBuffer blockhashResHiXorExoArg2Hi; + private final MappedByteBuffer blockhashResLoXorExoArg2Lo; + private final MappedByteBuffer blockhashValHi; + private final MappedByteBuffer blockhashValLo; + private final MappedByteBuffer ct; + private final MappedByteBuffer ctMax; + private final MappedByteBuffer exoInst; + private final MappedByteBuffer exoRes; private final MappedByteBuffer iomf; - private final MappedByteBuffer lowerBoundCheck; + private final MappedByteBuffer macro; + private final MappedByteBuffer prprc; private final MappedByteBuffer relBlock; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer upperBoundCheck; static List headers(int length) { List headers = new ArrayList<>(); headers.add(new ColumnHeader("blockhash.ABS_BLOCK", 6, length)); - headers.add(new ColumnHeader("blockhash.BLOCK_HASH_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCK_HASH_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCK_NUMBER_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCK_NUMBER_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_0", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_1", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_10", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_11", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_12", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_13", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_14", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_15", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_2", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_3", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_4", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_5", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_6", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_7", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_8", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_HI_9", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_0", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_1", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_10", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_11", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_12", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_13", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_14", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_15", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_2", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_3", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_4", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_5", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_6", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_7", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_8", 1, length)); - headers.add(new ColumnHeader("blockhash.BYTE_LO_9", 1, length)); - headers.add(new ColumnHeader("blockhash.IN_RANGE", 1, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.CT", 1, length)); + headers.add(new ColumnHeader("blockhash.CT_MAX", 1, length)); + headers.add(new ColumnHeader("blockhash.EXO_INST", 1, length)); + headers.add(new ColumnHeader("blockhash.EXO_RES", 1, length)); headers.add(new ColumnHeader("blockhash.IOMF", 1, length)); - headers.add(new ColumnHeader("blockhash.LOWER_BOUND_CHECK", 1, length)); - headers.add(new ColumnHeader("blockhash.REL_BLOCK", 1, length)); - headers.add(new ColumnHeader("blockhash.RES_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.RES_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.UPPER_BOUND_CHECK", 1, length)); + headers.add(new ColumnHeader("blockhash.MACRO", 1, length)); + headers.add(new ColumnHeader("blockhash.PRPRC", 1, length)); + headers.add(new ColumnHeader("blockhash.REL_BLOCK", 2, length)); return headers; } public Trace(List buffers) { this.absBlock = buffers.get(0); - this.blockHashHi = buffers.get(1); - this.blockHashLo = buffers.get(2); - this.blockNumberHi = buffers.get(3); - this.blockNumberLo = buffers.get(4); - this.byteHi0 = buffers.get(5); - this.byteHi1 = buffers.get(6); - this.byteHi10 = buffers.get(7); - this.byteHi11 = buffers.get(8); - this.byteHi12 = buffers.get(9); - this.byteHi13 = buffers.get(10); - this.byteHi14 = buffers.get(11); - this.byteHi15 = buffers.get(12); - this.byteHi2 = buffers.get(13); - this.byteHi3 = buffers.get(14); - this.byteHi4 = buffers.get(15); - this.byteHi5 = buffers.get(16); - this.byteHi6 = buffers.get(17); - this.byteHi7 = buffers.get(18); - this.byteHi8 = buffers.get(19); - this.byteHi9 = buffers.get(20); - this.byteLo0 = buffers.get(21); - this.byteLo1 = buffers.get(22); - this.byteLo10 = buffers.get(23); - this.byteLo11 = buffers.get(24); - this.byteLo12 = buffers.get(25); - this.byteLo13 = buffers.get(26); - this.byteLo14 = buffers.get(27); - this.byteLo15 = buffers.get(28); - this.byteLo2 = buffers.get(29); - this.byteLo3 = buffers.get(30); - this.byteLo4 = buffers.get(31); - this.byteLo5 = buffers.get(32); - this.byteLo6 = buffers.get(33); - this.byteLo7 = buffers.get(34); - this.byteLo8 = buffers.get(35); - this.byteLo9 = buffers.get(36); - this.inRange = buffers.get(37); - this.iomf = buffers.get(38); - this.lowerBoundCheck = buffers.get(39); - this.relBlock = buffers.get(40); - this.resHi = buffers.get(41); - this.resLo = buffers.get(42); - this.upperBoundCheck = buffers.get(43); + this.blockhashArgHiXorExoArg1Hi = buffers.get(1); + this.blockhashArgLoXorExoArg1Lo = buffers.get(2); + this.blockhashResHiXorExoArg2Hi = buffers.get(3); + this.blockhashResLoXorExoArg2Lo = buffers.get(4); + this.blockhashValHi = buffers.get(5); + this.blockhashValLo = buffers.get(6); + this.ct = buffers.get(7); + this.ctMax = buffers.get(8); + this.exoInst = buffers.get(9); + this.exoRes = buffers.get(10); + this.iomf = buffers.get(11); + this.macro = buffers.get(12); + this.prprc = buffers.get(13); + this.relBlock = buffers.get(14); } public int size() { @@ -184,15 +105,69 @@ public int size() { return this.currentLine; } - public Trace absBlock(final long b) { + public Trace ct(final long b) { if (filled.get(0)) { - throw new IllegalStateException("blockhash.ABS_BLOCK already set"); + throw new IllegalStateException("blockhash.CT already set"); } else { filled.set(0); } + if (b >= 256L) { + throw new IllegalArgumentException("blockhash.CT has invalid value (" + b + ")"); + } + ct.put((byte) b); + + return this; + } + + public Trace ctMax(final long b) { + if (filled.get(1)) { + throw new IllegalStateException("blockhash.CT_MAX already set"); + } else { + filled.set(1); + } + + if (b >= 256L) { + throw new IllegalArgumentException("blockhash.CT_MAX has invalid value (" + b + ")"); + } + ctMax.put((byte) b); + + return this; + } + + public Trace iomf(final Boolean b) { + if (filled.get(2)) { + throw new IllegalStateException("blockhash.IOMF already set"); + } else { + filled.set(2); + } + + iomf.put((byte) (b ? 1 : 0)); + + return this; + } + + public Trace macro(final Boolean b) { + if (filled.get(3)) { + throw new IllegalStateException("blockhash.MACRO already set"); + } else { + filled.set(3); + } + + macro.put((byte) (b ? 1 : 0)); + + return this; + } + + public Trace pMacroAbsBlock(final long b) { + if (filled.get(8)) { + throw new IllegalStateException("blockhash.macro/ABS_BLOCK already set"); + } else { + filled.set(8); + } + if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockhash.ABS_BLOCK has invalid value (" + b + ")"); + throw new IllegalArgumentException("blockhash.macro/ABS_BLOCK has invalid value (" + b + ")"); } absBlock.put((byte) (b >> 40)); absBlock.put((byte) (b >> 32)); @@ -204,11 +179,11 @@ public Trace absBlock(final long b) { return this; } - public Trace blockHashHi(final Bytes b) { - if (filled.get(1)) { - throw new IllegalStateException("blockhash.BLOCK_HASH_HI already set"); + public Trace pMacroBlockhashArgHi(final Bytes b) { + if (filled.get(9)) { + throw new IllegalStateException("blockhash.macro/BLOCKHASH_ARG_HI already set"); } else { - filled.set(1); + filled.set(9); } // Trim array to size @@ -216,25 +191,25 @@ public Trace blockHashHi(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.BLOCK_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.macro/BLOCKHASH_ARG_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - blockHashHi.put((byte) 0); + blockhashArgHiXorExoArg1Hi.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - blockHashHi.put(bs.get(j)); + blockhashArgHiXorExoArg1Hi.put(bs.get(j)); } return this; } - public Trace blockHashLo(final Bytes b) { - if (filled.get(2)) { - throw new IllegalStateException("blockhash.BLOCK_HASH_LO already set"); + public Trace pMacroBlockhashArgLo(final Bytes b) { + if (filled.get(10)) { + throw new IllegalStateException("blockhash.macro/BLOCKHASH_ARG_LO already set"); } else { - filled.set(2); + filled.set(10); } // Trim array to size @@ -242,25 +217,25 @@ public Trace blockHashLo(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.BLOCK_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.macro/BLOCKHASH_ARG_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - blockHashLo.put((byte) 0); + blockhashArgLoXorExoArg1Lo.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - blockHashLo.put(bs.get(j)); + blockhashArgLoXorExoArg1Lo.put(bs.get(j)); } return this; } - public Trace blockNumberHi(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("blockhash.BLOCK_NUMBER_HI already set"); + public Trace pMacroBlockhashResHi(final Bytes b) { + if (filled.get(11)) { + throw new IllegalStateException("blockhash.macro/BLOCKHASH_RES_HI already set"); } else { - filled.set(3); + filled.set(11); } // Trim array to size @@ -268,25 +243,25 @@ public Trace blockNumberHi(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.BLOCK_NUMBER_HI has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.macro/BLOCKHASH_RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - blockNumberHi.put((byte) 0); + blockhashResHiXorExoArg2Hi.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - blockNumberHi.put(bs.get(j)); + blockhashResHiXorExoArg2Hi.put(bs.get(j)); } return this; } - public Trace blockNumberLo(final Bytes b) { - if (filled.get(4)) { - throw new IllegalStateException("blockhash.BLOCK_NUMBER_LO already set"); + public Trace pMacroBlockhashResLo(final Bytes b) { + if (filled.get(12)) { + throw new IllegalStateException("blockhash.macro/BLOCKHASH_RES_LO already set"); } else { - filled.set(4); + filled.set(12); } // Trim array to size @@ -294,460 +269,145 @@ public Trace blockNumberLo(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.BLOCK_NUMBER_LO has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.macro/BLOCKHASH_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - blockNumberLo.put((byte) 0); + blockhashResLoXorExoArg2Lo.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - blockNumberLo.put(bs.get(j)); - } - - return this; - } - - public Trace byteHi0(final UnsignedByte b) { - if (filled.get(5)) { - throw new IllegalStateException("blockhash.BYTE_HI_0 already set"); - } else { - filled.set(5); - } - - byteHi0.put(b.toByte()); - - return this; - } - - public Trace byteHi1(final UnsignedByte b) { - if (filled.get(6)) { - throw new IllegalStateException("blockhash.BYTE_HI_1 already set"); - } else { - filled.set(6); - } - - byteHi1.put(b.toByte()); - - return this; - } - - public Trace byteHi10(final UnsignedByte b) { - if (filled.get(7)) { - throw new IllegalStateException("blockhash.BYTE_HI_10 already set"); - } else { - filled.set(7); - } - - byteHi10.put(b.toByte()); - - return this; - } - - public Trace byteHi11(final UnsignedByte b) { - if (filled.get(8)) { - throw new IllegalStateException("blockhash.BYTE_HI_11 already set"); - } else { - filled.set(8); - } - - byteHi11.put(b.toByte()); - - return this; - } - - public Trace byteHi12(final UnsignedByte b) { - if (filled.get(9)) { - throw new IllegalStateException("blockhash.BYTE_HI_12 already set"); - } else { - filled.set(9); - } - - byteHi12.put(b.toByte()); - - return this; - } - - public Trace byteHi13(final UnsignedByte b) { - if (filled.get(10)) { - throw new IllegalStateException("blockhash.BYTE_HI_13 already set"); - } else { - filled.set(10); - } - - byteHi13.put(b.toByte()); - - return this; - } - - public Trace byteHi14(final UnsignedByte b) { - if (filled.get(11)) { - throw new IllegalStateException("blockhash.BYTE_HI_14 already set"); - } else { - filled.set(11); - } - - byteHi14.put(b.toByte()); - - return this; - } - - public Trace byteHi15(final UnsignedByte b) { - if (filled.get(12)) { - throw new IllegalStateException("blockhash.BYTE_HI_15 already set"); - } else { - filled.set(12); + blockhashResLoXorExoArg2Lo.put(bs.get(j)); } - byteHi15.put(b.toByte()); - return this; } - public Trace byteHi2(final UnsignedByte b) { + public Trace pMacroBlockhashValHi(final Bytes b) { if (filled.get(13)) { - throw new IllegalStateException("blockhash.BYTE_HI_2 already set"); + throw new IllegalStateException("blockhash.macro/BLOCKHASH_VAL_HI already set"); } else { filled.set(13); } - byteHi2.put(b.toByte()); - - return this; - } - - public Trace byteHi3(final UnsignedByte b) { - if (filled.get(14)) { - throw new IllegalStateException("blockhash.BYTE_HI_3 already set"); - } else { - filled.set(14); - } - - byteHi3.put(b.toByte()); - - return this; - } - - public Trace byteHi4(final UnsignedByte b) { - if (filled.get(15)) { - throw new IllegalStateException("blockhash.BYTE_HI_4 already set"); - } else { - filled.set(15); - } - - byteHi4.put(b.toByte()); - - return this; - } - - public Trace byteHi5(final UnsignedByte b) { - if (filled.get(16)) { - throw new IllegalStateException("blockhash.BYTE_HI_5 already set"); - } else { - filled.set(16); - } - - byteHi5.put(b.toByte()); - - return this; - } - - public Trace byteHi6(final UnsignedByte b) { - if (filled.get(17)) { - throw new IllegalStateException("blockhash.BYTE_HI_6 already set"); - } else { - filled.set(17); - } - - byteHi6.put(b.toByte()); - - return this; - } - - public Trace byteHi7(final UnsignedByte b) { - if (filled.get(18)) { - throw new IllegalStateException("blockhash.BYTE_HI_7 already set"); - } else { - filled.set(18); - } - - byteHi7.put(b.toByte()); - - return this; - } - - public Trace byteHi8(final UnsignedByte b) { - if (filled.get(19)) { - throw new IllegalStateException("blockhash.BYTE_HI_8 already set"); - } else { - filled.set(19); - } - - byteHi8.put(b.toByte()); - - return this; - } - - public Trace byteHi9(final UnsignedByte b) { - if (filled.get(20)) { - throw new IllegalStateException("blockhash.BYTE_HI_9 already set"); - } else { - filled.set(20); - } - - byteHi9.put(b.toByte()); - - return this; - } - - public Trace byteLo0(final UnsignedByte b) { - if (filled.get(21)) { - throw new IllegalStateException("blockhash.BYTE_LO_0 already set"); - } else { - filled.set(21); - } - - byteLo0.put(b.toByte()); - - return this; - } - - public Trace byteLo1(final UnsignedByte b) { - if (filled.get(22)) { - throw new IllegalStateException("blockhash.BYTE_LO_1 already set"); - } else { - filled.set(22); - } - - byteLo1.put(b.toByte()); - - return this; - } - - public Trace byteLo10(final UnsignedByte b) { - if (filled.get(23)) { - throw new IllegalStateException("blockhash.BYTE_LO_10 already set"); - } else { - filled.set(23); - } - - byteLo10.put(b.toByte()); - - return this; - } - - public Trace byteLo11(final UnsignedByte b) { - if (filled.get(24)) { - throw new IllegalStateException("blockhash.BYTE_LO_11 already set"); - } else { - filled.set(24); - } - - byteLo11.put(b.toByte()); - - return this; - } - - public Trace byteLo12(final UnsignedByte b) { - if (filled.get(25)) { - throw new IllegalStateException("blockhash.BYTE_LO_12 already set"); - } else { - filled.set(25); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockhash.macro/BLOCKHASH_VAL_HI has invalid width (" + bs.bitLength() + "bits)"); } - - byteLo12.put(b.toByte()); - - return this; - } - - public Trace byteLo13(final UnsignedByte b) { - if (filled.get(26)) { - throw new IllegalStateException("blockhash.BYTE_LO_13 already set"); - } else { - filled.set(26); + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + blockhashValHi.put((byte) 0); } - - byteLo13.put(b.toByte()); - - return this; - } - - public Trace byteLo14(final UnsignedByte b) { - if (filled.get(27)) { - throw new IllegalStateException("blockhash.BYTE_LO_14 already set"); - } else { - filled.set(27); + // Write bytes + for (int j = 0; j < bs.size(); j++) { + blockhashValHi.put(bs.get(j)); } - byteLo14.put(b.toByte()); - return this; } - public Trace byteLo15(final UnsignedByte b) { - if (filled.get(28)) { - throw new IllegalStateException("blockhash.BYTE_LO_15 already set"); + public Trace pMacroBlockhashValLo(final Bytes b) { + if (filled.get(14)) { + throw new IllegalStateException("blockhash.macro/BLOCKHASH_VAL_LO already set"); } else { - filled.set(28); + filled.set(14); } - byteLo15.put(b.toByte()); - - return this; - } - - public Trace byteLo2(final UnsignedByte b) { - if (filled.get(29)) { - throw new IllegalStateException("blockhash.BYTE_LO_2 already set"); - } else { - filled.set(29); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockhash.macro/BLOCKHASH_VAL_LO has invalid width (" + bs.bitLength() + "bits)"); } - - byteLo2.put(b.toByte()); - - return this; - } - - public Trace byteLo3(final UnsignedByte b) { - if (filled.get(30)) { - throw new IllegalStateException("blockhash.BYTE_LO_3 already set"); - } else { - filled.set(30); + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + blockhashValLo.put((byte) 0); } - - byteLo3.put(b.toByte()); - - return this; - } - - public Trace byteLo4(final UnsignedByte b) { - if (filled.get(31)) { - throw new IllegalStateException("blockhash.BYTE_LO_4 already set"); - } else { - filled.set(31); + // Write bytes + for (int j = 0; j < bs.size(); j++) { + blockhashValLo.put(bs.get(j)); } - byteLo4.put(b.toByte()); - return this; } - public Trace byteLo5(final UnsignedByte b) { - if (filled.get(32)) { - throw new IllegalStateException("blockhash.BYTE_LO_5 already set"); + public Trace pMacroRelBlock(final long b) { + if (filled.get(7)) { + throw new IllegalStateException("blockhash.macro/REL_BLOCK already set"); } else { - filled.set(32); + filled.set(7); } - byteLo5.put(b.toByte()); - - return this; - } - - public Trace byteLo6(final UnsignedByte b) { - if (filled.get(33)) { - throw new IllegalStateException("blockhash.BYTE_LO_6 already set"); - } else { - filled.set(33); + if (b >= 65536L) { + throw new IllegalArgumentException("blockhash.macro/REL_BLOCK has invalid value (" + b + ")"); } - - byteLo6.put(b.toByte()); + relBlock.put((byte) (b >> 8)); + relBlock.put((byte) b); return this; } - public Trace byteLo7(final UnsignedByte b) { - if (filled.get(34)) { - throw new IllegalStateException("blockhash.BYTE_LO_7 already set"); + public Trace pPreprocessingExoArg1Hi(final Bytes b) { + if (filled.get(9)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_ARG_1_HI already set"); } else { - filled.set(34); + filled.set(9); } - byteLo7.put(b.toByte()); - - return this; - } - - public Trace byteLo8(final UnsignedByte b) { - if (filled.get(35)) { - throw new IllegalStateException("blockhash.BYTE_LO_8 already set"); - } else { - filled.set(35); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockhash.preprocessing/EXO_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - - byteLo8.put(b.toByte()); - - return this; - } - - public Trace byteLo9(final UnsignedByte b) { - if (filled.get(36)) { - throw new IllegalStateException("blockhash.BYTE_LO_9 already set"); - } else { - filled.set(36); + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + blockhashArgHiXorExoArg1Hi.put((byte) 0); } - - byteLo9.put(b.toByte()); - - return this; - } - - public Trace inRange(final Boolean b) { - if (filled.get(37)) { - throw new IllegalStateException("blockhash.IN_RANGE already set"); - } else { - filled.set(37); + // Write bytes + for (int j = 0; j < bs.size(); j++) { + blockhashArgHiXorExoArg1Hi.put(bs.get(j)); } - inRange.put((byte) (b ? 1 : 0)); - return this; } - public Trace iomf(final Boolean b) { - if (filled.get(38)) { - throw new IllegalStateException("blockhash.IOMF already set"); + public Trace pPreprocessingExoArg1Lo(final Bytes b) { + if (filled.get(10)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_ARG_1_LO already set"); } else { - filled.set(38); + filled.set(10); } - iomf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace lowerBoundCheck(final Boolean b) { - if (filled.get(39)) { - throw new IllegalStateException("blockhash.LOWER_BOUND_CHECK already set"); - } else { - filled.set(39); + // Trim array to size + Bytes bs = b.trimLeadingZeros(); + // Sanity check against expected width + if (bs.bitLength() > 128) { + throw new IllegalArgumentException( + "blockhash.preprocessing/EXO_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - - lowerBoundCheck.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace relBlock(final long b) { - if (filled.get(40)) { - throw new IllegalStateException("blockhash.REL_BLOCK already set"); - } else { - filled.set(40); + // Write padding (if necessary) + for (int i = bs.size(); i < 16; i++) { + blockhashArgLoXorExoArg1Lo.put((byte) 0); } - - if (b >= 256L) { - throw new IllegalArgumentException("blockhash.REL_BLOCK has invalid value (" + b + ")"); + // Write bytes + for (int j = 0; j < bs.size(); j++) { + blockhashArgLoXorExoArg1Lo.put(bs.get(j)); } - relBlock.put((byte) b); return this; } - public Trace resHi(final Bytes b) { - if (filled.get(41)) { - throw new IllegalStateException("blockhash.RES_HI already set"); + public Trace pPreprocessingExoArg2Hi(final Bytes b) { + if (filled.get(11)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_ARG_2_HI already set"); } else { - filled.set(41); + filled.set(11); } // Trim array to size @@ -755,25 +415,25 @@ public Trace resHi(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.RES_HI has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.preprocessing/EXO_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); + blockhashResHiXorExoArg2Hi.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); + blockhashResHiXorExoArg2Hi.put(bs.get(j)); } return this; } - public Trace resLo(final Bytes b) { - if (filled.get(42)) { - throw new IllegalStateException("blockhash.RES_LO already set"); + public Trace pPreprocessingExoArg2Lo(final Bytes b) { + if (filled.get(12)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_ARG_2_LO already set"); } else { - filled.set(42); + filled.set(12); } // Trim array to size @@ -781,207 +441,123 @@ public Trace resLo(final Bytes b) { // Sanity check against expected width if (bs.bitLength() > 128) { throw new IllegalArgumentException( - "blockhash.RES_LO has invalid width (" + bs.bitLength() + "bits)"); + "blockhash.preprocessing/EXO_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); + blockhashResLoXorExoArg2Lo.put((byte) 0); } // Write bytes for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); + blockhashResLoXorExoArg2Lo.put(bs.get(j)); } return this; } - public Trace upperBoundCheck(final Boolean b) { - if (filled.get(43)) { - throw new IllegalStateException("blockhash.UPPER_BOUND_CHECK already set"); + public Trace pPreprocessingExoInst(final long b) { + if (filled.get(6)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_INST already set"); } else { - filled.set(43); + filled.set(6); } - upperBoundCheck.put((byte) (b ? 1 : 0)); + if (b >= 256L) { + throw new IllegalArgumentException( + "blockhash.preprocessing/EXO_INST has invalid value (" + b + ")"); + } + exoInst.put((byte) b); return this; } - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("blockhash.ABS_BLOCK has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("blockhash.BLOCK_HASH_HI has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("blockhash.BLOCK_HASH_LO has not been filled"); + public Trace pPreprocessingExoRes(final Boolean b) { + if (filled.get(5)) { + throw new IllegalStateException("blockhash.preprocessing/EXO_RES already set"); + } else { + filled.set(5); } - if (!filled.get(3)) { - throw new IllegalStateException("blockhash.BLOCK_NUMBER_HI has not been filled"); - } + exoRes.put((byte) (b ? 1 : 0)); - if (!filled.get(4)) { - throw new IllegalStateException("blockhash.BLOCK_NUMBER_LO has not been filled"); - } + return this; + } - if (!filled.get(5)) { - throw new IllegalStateException("blockhash.BYTE_HI_0 has not been filled"); + public Trace prprc(final Boolean b) { + if (filled.get(4)) { + throw new IllegalStateException("blockhash.PRPRC already set"); + } else { + filled.set(4); } - if (!filled.get(6)) { - throw new IllegalStateException("blockhash.BYTE_HI_1 has not been filled"); - } + prprc.put((byte) (b ? 1 : 0)); - if (!filled.get(7)) { - throw new IllegalStateException("blockhash.BYTE_HI_10 has not been filled"); - } + return this; + } + public Trace validateRow() { if (!filled.get(8)) { - throw new IllegalStateException("blockhash.BYTE_HI_11 has not been filled"); + throw new IllegalStateException("blockhash.ABS_BLOCK has not been filled"); } if (!filled.get(9)) { - throw new IllegalStateException("blockhash.BYTE_HI_12 has not been filled"); + throw new IllegalStateException( + "blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI has not been filled"); } if (!filled.get(10)) { - throw new IllegalStateException("blockhash.BYTE_HI_13 has not been filled"); + throw new IllegalStateException( + "blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO has not been filled"); } if (!filled.get(11)) { - throw new IllegalStateException("blockhash.BYTE_HI_14 has not been filled"); + throw new IllegalStateException( + "blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI has not been filled"); } if (!filled.get(12)) { - throw new IllegalStateException("blockhash.BYTE_HI_15 has not been filled"); + throw new IllegalStateException( + "blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO has not been filled"); } if (!filled.get(13)) { - throw new IllegalStateException("blockhash.BYTE_HI_2 has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_VAL_HI has not been filled"); } if (!filled.get(14)) { - throw new IllegalStateException("blockhash.BYTE_HI_3 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("blockhash.BYTE_HI_4 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("blockhash.BYTE_HI_5 has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_VAL_LO has not been filled"); } - if (!filled.get(17)) { - throw new IllegalStateException("blockhash.BYTE_HI_6 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("blockhash.BYTE_HI_7 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("blockhash.BYTE_HI_8 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("blockhash.BYTE_HI_9 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("blockhash.BYTE_LO_0 has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("blockhash.BYTE_LO_1 has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("blockhash.BYTE_LO_10 has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("blockhash.BYTE_LO_11 has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("blockhash.BYTE_LO_12 has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("blockhash.BYTE_LO_13 has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("blockhash.BYTE_LO_14 has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("blockhash.BYTE_LO_15 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("blockhash.BYTE_LO_2 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("blockhash.BYTE_LO_3 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("blockhash.BYTE_LO_4 has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("blockhash.BYTE_LO_5 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("blockhash.BYTE_LO_6 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("blockhash.BYTE_LO_7 has not been filled"); + if (!filled.get(0)) { + throw new IllegalStateException("blockhash.CT has not been filled"); } - if (!filled.get(35)) { - throw new IllegalStateException("blockhash.BYTE_LO_8 has not been filled"); + if (!filled.get(1)) { + throw new IllegalStateException("blockhash.CT_MAX has not been filled"); } - if (!filled.get(36)) { - throw new IllegalStateException("blockhash.BYTE_LO_9 has not been filled"); + if (!filled.get(6)) { + throw new IllegalStateException("blockhash.EXO_INST has not been filled"); } - if (!filled.get(37)) { - throw new IllegalStateException("blockhash.IN_RANGE has not been filled"); + if (!filled.get(5)) { + throw new IllegalStateException("blockhash.EXO_RES has not been filled"); } - if (!filled.get(38)) { + if (!filled.get(2)) { throw new IllegalStateException("blockhash.IOMF has not been filled"); } - if (!filled.get(39)) { - throw new IllegalStateException("blockhash.LOWER_BOUND_CHECK has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("blockhash.REL_BLOCK has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("blockhash.RES_HI has not been filled"); + if (!filled.get(3)) { + throw new IllegalStateException("blockhash.MACRO has not been filled"); } - if (!filled.get(42)) { - throw new IllegalStateException("blockhash.RES_LO has not been filled"); + if (!filled.get(4)) { + throw new IllegalStateException("blockhash.PRPRC has not been filled"); } - if (!filled.get(43)) { - throw new IllegalStateException("blockhash.UPPER_BOUND_CHECK has not been filled"); + if (!filled.get(7)) { + throw new IllegalStateException("blockhash.REL_BLOCK has not been filled"); } filled.clear(); @@ -991,180 +567,64 @@ public Trace validateRow() { } public Trace fillAndValidateRow() { - if (!filled.get(0)) { - absBlock.position(absBlock.position() + 6); - } - - if (!filled.get(1)) { - blockHashHi.position(blockHashHi.position() + 16); - } - - if (!filled.get(2)) { - blockHashLo.position(blockHashLo.position() + 16); - } - - if (!filled.get(3)) { - blockNumberHi.position(blockNumberHi.position() + 16); - } - - if (!filled.get(4)) { - blockNumberLo.position(blockNumberLo.position() + 16); - } - - if (!filled.get(5)) { - byteHi0.position(byteHi0.position() + 1); - } - - if (!filled.get(6)) { - byteHi1.position(byteHi1.position() + 1); - } - - if (!filled.get(7)) { - byteHi10.position(byteHi10.position() + 1); - } - if (!filled.get(8)) { - byteHi11.position(byteHi11.position() + 1); + absBlock.position(absBlock.position() + 6); } if (!filled.get(9)) { - byteHi12.position(byteHi12.position() + 1); + blockhashArgHiXorExoArg1Hi.position(blockhashArgHiXorExoArg1Hi.position() + 16); } if (!filled.get(10)) { - byteHi13.position(byteHi13.position() + 1); + blockhashArgLoXorExoArg1Lo.position(blockhashArgLoXorExoArg1Lo.position() + 16); } if (!filled.get(11)) { - byteHi14.position(byteHi14.position() + 1); + blockhashResHiXorExoArg2Hi.position(blockhashResHiXorExoArg2Hi.position() + 16); } if (!filled.get(12)) { - byteHi15.position(byteHi15.position() + 1); + blockhashResLoXorExoArg2Lo.position(blockhashResLoXorExoArg2Lo.position() + 16); } if (!filled.get(13)) { - byteHi2.position(byteHi2.position() + 1); + blockhashValHi.position(blockhashValHi.position() + 16); } if (!filled.get(14)) { - byteHi3.position(byteHi3.position() + 1); - } - - if (!filled.get(15)) { - byteHi4.position(byteHi4.position() + 1); - } - - if (!filled.get(16)) { - byteHi5.position(byteHi5.position() + 1); - } - - if (!filled.get(17)) { - byteHi6.position(byteHi6.position() + 1); - } - - if (!filled.get(18)) { - byteHi7.position(byteHi7.position() + 1); - } - - if (!filled.get(19)) { - byteHi8.position(byteHi8.position() + 1); - } - - if (!filled.get(20)) { - byteHi9.position(byteHi9.position() + 1); - } - - if (!filled.get(21)) { - byteLo0.position(byteLo0.position() + 1); - } - - if (!filled.get(22)) { - byteLo1.position(byteLo1.position() + 1); - } - - if (!filled.get(23)) { - byteLo10.position(byteLo10.position() + 1); - } - - if (!filled.get(24)) { - byteLo11.position(byteLo11.position() + 1); - } - - if (!filled.get(25)) { - byteLo12.position(byteLo12.position() + 1); - } - - if (!filled.get(26)) { - byteLo13.position(byteLo13.position() + 1); - } - - if (!filled.get(27)) { - byteLo14.position(byteLo14.position() + 1); - } - - if (!filled.get(28)) { - byteLo15.position(byteLo15.position() + 1); - } - - if (!filled.get(29)) { - byteLo2.position(byteLo2.position() + 1); - } - - if (!filled.get(30)) { - byteLo3.position(byteLo3.position() + 1); - } - - if (!filled.get(31)) { - byteLo4.position(byteLo4.position() + 1); + blockhashValLo.position(blockhashValLo.position() + 16); } - if (!filled.get(32)) { - byteLo5.position(byteLo5.position() + 1); - } - - if (!filled.get(33)) { - byteLo6.position(byteLo6.position() + 1); - } - - if (!filled.get(34)) { - byteLo7.position(byteLo7.position() + 1); + if (!filled.get(0)) { + ct.position(ct.position() + 1); } - if (!filled.get(35)) { - byteLo8.position(byteLo8.position() + 1); + if (!filled.get(1)) { + ctMax.position(ctMax.position() + 1); } - if (!filled.get(36)) { - byteLo9.position(byteLo9.position() + 1); + if (!filled.get(6)) { + exoInst.position(exoInst.position() + 1); } - if (!filled.get(37)) { - inRange.position(inRange.position() + 1); + if (!filled.get(5)) { + exoRes.position(exoRes.position() + 1); } - if (!filled.get(38)) { + if (!filled.get(2)) { iomf.position(iomf.position() + 1); } - if (!filled.get(39)) { - lowerBoundCheck.position(lowerBoundCheck.position() + 1); - } - - if (!filled.get(40)) { - relBlock.position(relBlock.position() + 1); - } - - if (!filled.get(41)) { - resHi.position(resHi.position() + 16); + if (!filled.get(3)) { + macro.position(macro.position() + 1); } - if (!filled.get(42)) { - resLo.position(resLo.position() + 16); + if (!filled.get(4)) { + prprc.position(prprc.position() + 1); } - if (!filled.get(43)) { - upperBoundCheck.position(upperBoundCheck.position() + 1); + if (!filled.get(7)) { + relBlock.position(relBlock.position() + 2); } filled.clear(); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index 738fe7a60..b923ddcac 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -743,9 +743,12 @@ public void tracePostExecution(MessageFrame frame, Operation.OperationResult ope this.unlatchStack(frame, currentSection); } - if (frame.getDepth() == 0 && (isExceptional() || opCode() == REVERT)) { + if (frame.getDepth() == 0 && (isExceptional() || opCode().isHalt())) { this.state.setProcessingPhase(TX_FINL); coinbaseWarmthAtTransactionEnd = frame.isAddressWarm(coinbaseAddress); + } + + if (frame.getDepth() == 0 && (isExceptional() || opCode() == REVERT)) { new TxFinalizationSection(this, frame.getWorldUpdater(), true); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java index 8acdfcbd7..58ed063fa 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java @@ -135,7 +135,6 @@ private boolean coinbaseWarmth() { public static boolean senderIsCoinbase(Hub hub) { final TransactionProcessingMetadata tx = hub.txStack().current(); final Address senderAddress = tx.getSender(); - final Address coinbaseAddress = hub.coinbaseAddress; - return coinbaseAddress.equals(senderAddress); + return hub.coinbaseAddress.equals(senderAddress); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java index 2ff14e3fd..b341a162c 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxndataOperation.java @@ -54,6 +54,7 @@ import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.TransactionType; public class TxndataOperation extends ModuleOperation { @@ -61,6 +62,7 @@ public class TxndataOperation extends ModuleOperation { private final Wcp wcp; private final Euc euc; @Getter public final TransactionProcessingMetadata tx; + private final Address coinbaseAddress; private static final Bytes EIP_2681_MAX_NONCE = Bytes.minimalBytes(EIP2681_MAX_NONCE); private static final int N_ROWS_TX_MAX = @@ -77,6 +79,7 @@ public TxndataOperation(Hub hub, Wcp wcp, Euc euc, TransactionProcessingMetadata this.wcp = wcp; this.euc = euc; this.tx = tx; + this.coinbaseAddress = hub.coinbaseAddress; this.setCallsToEucAndWcp(); } @@ -340,8 +343,8 @@ public void traceTx(Trace trace, BlockSnapshot block, int absTxNumMax) { final Bytes gasPrice = Bytes.minimalBytes(tx.getEffectiveGasPrice()); final Bytes priorityFeePerGas = Bytes.minimalBytes(tx.feeRateForCoinbase()); final Bytes baseFee = block.getBaseFee().get().toMinimalBytes(); - final long coinbaseHi = highPart(hub.coinbaseAddress); - final Bytes coinbaseLo = lowPart(hub.coinbaseAddress); + final long coinbaseHi = highPart(coinbaseAddress); + final Bytes coinbaseLo = lowPart(coinbaseAddress); final int callDataSize = tx.isDeployment() ? 0 : tx.getBesuTransaction().getPayload().size(); final int initCodeSize = tx.isDeployment() ? tx.getBesuTransaction().getPayload().size() : 0; final Bytes gasLeftOver = Bytes.minimalBytes(tx.getLeftoverGas()); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCode.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCode.java index f13cc31e6..17589d948 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCode.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/opcode/OpCode.java @@ -237,6 +237,10 @@ public boolean isCall() { return getData().isCall(); } + public boolean isHalt() { + return getData().isHalt(); + } + public boolean isCallOrCreate() { return isCall() || isCreate(); } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/MultiBlockUtils.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/MultiBlockUtils.java new file mode 100644 index 000000000..9e84e5e98 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/MultiBlockUtils.java @@ -0,0 +1,92 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.google.common.base.Preconditions; +import net.consensys.linea.testing.MultiBlockExecutionEnvironment; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyTransaction; +import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Hash; +import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.Transaction; + +public class MultiBlockUtils { + + public static void multiBlocksTest(List programs) { + multiBlocksTest(programs, List.of()); + } + + public static void multiBlocksTest(List programs, List gasLimits) { + Preconditions.checkArgument(gasLimits.isEmpty() || programs.size() == gasLimits.size()); + + List keyPairs = new ArrayList<>(); + List

senderAddresses = new ArrayList<>(); + List senderAccounts = new ArrayList<>(); + List receiverAccounts = new ArrayList<>(); + List transactions = new ArrayList<>(); + + for (int i = 0; i < programs.size(); i++) { + Bytes program = programs.get(i); + keyPairs.add(new SECP256K1().generateKeyPair()); + senderAddresses.add( + Address.extract( + Hash.hash(keyPairs.get(keyPairs.size() - 1).getPublicKey().getEncodedBytes()))); + senderAccounts.add( + ToyAccount.builder() + .balance(Wei.fromEth(1 + i)) + .nonce(3 + i) + .address(senderAddresses.get(senderAddresses.size() - 1)) + .build()); + receiverAccounts.add( + ToyAccount.builder() + .balance(Wei.ONE) + .nonce(5 + i) + .address(Address.fromHexString("0x" + (20 + i))) + .code(program) + .build()); + transactions.add( + ToyTransaction.builder() + .sender(senderAccounts.get(senderAccounts.size() - 1)) + .to(receiverAccounts.get(receiverAccounts.size() - 1)) + .keyPair(keyPairs.get(keyPairs.size() - 1)) + .build()); + } + + MultiBlockExecutionEnvironment.MultiBlockExecutionEnvironmentBuilder builder = + MultiBlockExecutionEnvironment.builder() + .accounts( + Stream.concat(senderAccounts.stream(), receiverAccounts.stream()) + .collect(Collectors.toList())); + + for (int i = 0; i < transactions.size(); i++) { + if (gasLimits.isEmpty()) { + builder.addBlock(List.of(transactions.get(i))); + } else { + builder.addBlock(List.of(transactions.get(i)), gasLimits.get(i)); + } + } + + builder.build().run(); + } +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java new file mode 100644 index 000000000..023c83705 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java @@ -0,0 +1,120 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.module.blockdata; + +import static net.consensys.linea.zktracer.MultiBlockUtils.multiBlocksTest; +import static net.consensys.linea.zktracer.module.blockdata.NextGasLimitScenario.*; +import static net.consensys.linea.zktracer.module.constants.Trace.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +import net.consensys.linea.UnitTestWatcher; +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.apache.tuweni.bytes.Bytes; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +@ExtendWith(UnitTestWatcher.class) +public class GasLimitTest { + + @Test + void legalGasLimitVariationsTest() { + Bytes p = BytecodeCompiler.newProgram().push(1).compile(); + + long gasLimit = LINEA_GAS_LIMIT_MINIMUM; + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_SAME))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_INCREMENT))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MAX))); + + gasLimit = 100_000_000L; + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_SAME))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_INCREMENT))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_DECREMENT))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MAX))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MIN))); + + gasLimit = LINEA_GAS_LIMIT_MAXIMUM; + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_SAME))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_DECREMENT))); + multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MIN))); + } + + /** + * The test below deliberately contains test vectors that are expected to fail. The test + * is @Disabled as a consequence. + * + * @param gasLimit + * @param nextGasLimitScenario + */ + @Disabled + @ParameterizedTest + @MethodSource("blockDataVariableGasLimitTestSource") + void variableGasLimitTest(long gasLimit, NextGasLimitScenario nextGasLimitScenario) { + Bytes program = BytecodeCompiler.newProgram().op(OpCode.STOP).compile(); + + multiBlocksTest( + List.of(program, program), List.of(gasLimit, nextGasLimit(gasLimit, nextGasLimitScenario))); + } + + private static Stream blockDataVariableGasLimitTestSource() { + List arguments = new ArrayList<>(); + // TODO: use LINEA_BLOCK_GAS_LIMIT_MIN, LINEA_BLOCK_GAS_LIMIT_MAX and something in between, + // e.g., 100M + List gasLimits = + List.of( + 0L, + (long) ETHEREUM_GAS_LIMIT_MINIMUM, + (long) LINEA_GAS_LIMIT_MINIMUM, + 100_000_000L, + (long) LINEA_GAS_LIMIT_MAXIMUM, + Long.MAX_VALUE); + for (Long gasLimit : gasLimits) { + for (NextGasLimitScenario scenario : values()) { + arguments.add(Arguments.of(gasLimit, scenario)); + } + } + return arguments.stream(); + } + + private long nextGasLimit(long gasLimit, NextGasLimitScenario nextGasLimitScenario) { + long maxDeviation = maxDeviation(gasLimit); + return switch (nextGasLimitScenario) { + case IN_RANGE_SAME -> gasLimit; + case IN_RANGE_INCREMENT -> gasLimit + maxDeviation / 2; + case IN_RANGE_DECREMENT -> gasLimit - maxDeviation / 2; + case IN_RANGE_MAX -> gasLimit + maxDeviation - 1; + case IN_RANGE_MIN -> gasLimit - maxDeviation + 1; + case OUT_OF_RANGE_INCREMENT -> gasLimit + maxDeviation; + case OUT_OF_RANGE_DECREMENT -> gasLimit - maxDeviation; + case OUT_OF_RANGE_GENERIC -> 200_000_000L; + }; + } + + private boolean isInRange(long gasLimit, long nextGasLimit) { + long maxDeviation = maxDeviation(gasLimit); + return nextGasLimit < gasLimit + maxDeviation && nextGasLimit > gasLimit - maxDeviation; + } + + private long maxDeviation(long gasLimit) { + return gasLimit / GAS_LIMIT_ADJUSTMENT_FACTOR; + } +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/NextGasLimitScenario.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/NextGasLimitScenario.java new file mode 100644 index 000000000..9d4dc8e31 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/NextGasLimitScenario.java @@ -0,0 +1,37 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.module.blockdata; + +public enum NextGasLimitScenario { + IN_RANGE_SAME, + IN_RANGE_INCREMENT, + IN_RANGE_DECREMENT, + IN_RANGE_MAX, + IN_RANGE_MIN, + OUT_OF_RANGE_INCREMENT, + OUT_OF_RANGE_DECREMENT, + OUT_OF_RANGE_GENERIC; + + public boolean isInRange() { + return this == IN_RANGE_SAME || this == IN_RANGE_INCREMENT || this == IN_RANGE_DECREMENT; + } + + public boolean isOutOfRange() { + return this == OUT_OF_RANGE_INCREMENT + || this == OUT_OF_RANGE_DECREMENT + || this == IN_RANGE_MAX + || this == IN_RANGE_MIN; + } +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java index 2112b86c0..ae364e76d 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockhash/BlockhashTest.java @@ -15,8 +15,14 @@ package net.consensys.linea.zktracer.module.blockhash; +import static net.consensys.linea.zktracer.MultiBlockUtils.multiBlocksTest; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.BLOCKHASH_MAX_HISTORY; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import net.consensys.linea.UnitTestWatcher; import net.consensys.linea.testing.BytecodeCompiler; import net.consensys.linea.testing.BytecodeRunner; @@ -29,119 +35,173 @@ public class BlockhashTest { @Test - void someBlockhash() { + void severalBlockhash() { BytecodeRunner.of( BytecodeCompiler.newProgram() - // arg of BlockHash is Blocknumber +1 - .op(OpCode.NUMBER) + // arg is NUMBER - 1 .push(1) - .op(OpCode.ADD) + .op(OpCode.NUMBER) + .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber + // arg is NUMBER .op(OpCode.NUMBER) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is ridiculously big + // arg is NUMBER + 1 + .op(OpCode.NUMBER) + .push(1) + .op(OpCode.ADD) + .op(OpCode.BLOCKHASH) + .op(OpCode.POP) + + // arg is ridiculously big .push(256) .op(OpCode.NUMBER) .op(OpCode.MUL) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is ridiculously small + // arg is NUMBER / 256 << NUMBER .push(256) .op(OpCode.NUMBER) .op(OpCode.DIV) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is 0 + // arg is 0 << NUMBER .push(0) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is 1 (ie ridiculously small) + // arg is 1 << NUMBER .push(1) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // another arg of BlockHash is ridiculously big + // arg is ridiculously big .push( Bytes.fromHexString( - "0x123456789012345678901234567890123456789012345678901234567890")) + "0x123456789012345678901234567890123456789012345678901234567890ffff")) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber -256 -2 + // arg of BlockHash is NUMBER - (256 + 2) .push(BLOCKHASH_MAX_HISTORY + 2) .op(OpCode.NUMBER) .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber -256 -1 + // arg of BlockHash is NUMBER - (256 + 1) .push(BLOCKHASH_MAX_HISTORY + 1) .op(OpCode.NUMBER) .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber -256 + // arg of BlockHash is NUMBER - 256 .push(BLOCKHASH_MAX_HISTORY) .op(OpCode.NUMBER) .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber -256 +1 + // arg of BlockHash is NUMBER - (256 - 1) .push(BLOCKHASH_MAX_HISTORY - 1) .op(OpCode.NUMBER) .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - // arg of BlockHash is Blocknumber -256 +2 + // arg of BlockHash is NUMBER - (256 - 2) .push(BLOCKHASH_MAX_HISTORY - 2) .op(OpCode.NUMBER) .op(OpCode.SUB) .op(OpCode.BLOCKHASH) .op(OpCode.POP) + .compile()) + .run(); + } - // arg of BlockHash is Blocknumber -1 - .push(1) - .op(OpCode.NUMBER) - .op(OpCode.ADD) - .op(OpCode.BLOCKHASH) - .op(OpCode.POP) + @Test + void singleBlockhash() { + BytecodeRunner.of( + BytecodeCompiler.newProgram() - // Duplicate of arg of BlockHash is Blocknumber -1 - .push(1) + // arg of BlockHash is Blocknumber +1 .op(OpCode.NUMBER) - .op(OpCode.ADD) - .op(OpCode.BLOCKHASH) - .op(OpCode.POP) - - // Truplicate of arg of BlockHash is Blocknumber -1 .push(1) - .op(OpCode.NUMBER) .op(OpCode.ADD) .op(OpCode.BLOCKHASH) .op(OpCode.POP) - - // arg of BlockHash is Blocknumber -2 - .push(2) - .op(OpCode.NUMBER) - .op(OpCode.ADD) - .op(OpCode.BLOCKHASH) - .op(OpCode.POP) - - // TODO: add test with different block in the conflated batch - .compile()) .run(); } + + @Test + void blockhashArgumentUpperRangeCheckMultiBlockTest() { + // Block 1 + Bytes program1 = BytecodeCompiler.newProgram().op(OpCode.NUMBER).op(OpCode.BLOCKHASH).compile(); + + // Block 2 + Bytes program2 = + BytecodeCompiler.newProgram() + .push(1) + .op(OpCode.NUMBER) + .op(OpCode.SUB) + .op(OpCode.BLOCKHASH) + .compile(); + + multiBlocksTest(List.of(program1, program2)); + } + + @Test + void blockhashArgumentLowerRangeCheckMultiBlockTest() { + Bytes fillerProgram = BytecodeCompiler.newProgram().op(OpCode.COINBASE).compile(); + + Bytes program0 = + BytecodeCompiler.newProgram() + .push(1) + .op(OpCode.NUMBER) + .op(OpCode.SUB) + .op(OpCode.BLOCKHASH) + .compile(); + + // Block no longer available + // Block 1 + Bytes program1 = + BytecodeCompiler.newProgram() + .push(256) + .op(OpCode.NUMBER) + .op(OpCode.SUB) + .op(OpCode.BLOCKHASH) + .compile(); + + // Block 2 + Bytes program2 = + BytecodeCompiler.newProgram() + .push(257) + .op(OpCode.NUMBER) + .op(OpCode.SUB) + .op(OpCode.BLOCKHASH) + .compile(); + + Bytes program3 = + BytecodeCompiler.newProgram() + .push(16) + .op(OpCode.NUMBER) + .op(OpCode.SUB) + .op(OpCode.BLOCKHASH) + .compile(); + + multiBlocksTest( + Stream.concat( + Collections.nCopies(256, fillerProgram).stream(), + List.of(program0, program1, program2, program3).stream()) + .collect(Collectors.toList())); + } } diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index a65fd0d19..c693636d0 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -63,7 +63,7 @@ tasks.register('binreftable', TraceFilesTask) { // // Put here modules following the conventional MODULE/columns.lisp naming scheme. // -['bin', 'blockhash', 'euc', 'mmio', 'shf', 'wcp', 'rlptxn', 'rom', 'romlex', 'trm', 'stp', 'loginfo', 'logdata', 'gas'].each {moduleName -> +['bin', 'euc', 'mmio', 'shf', 'wcp', 'rlptxn', 'rom', 'romlex', 'trm', 'stp', 'loginfo', 'logdata', 'gas'].each {moduleName -> tasks.register(moduleName, TraceFilesTask) { group "Trace files generation" dependsOn corsetExists @@ -75,7 +75,7 @@ tasks.register('binreftable', TraceFilesTask) { // // Put here modules following the conventional MODULE/columns.lisp, MODULE/constants.lisp naming scheme. // -['mmu', 'blake2fmodexpdata', 'blockdata', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata'].each {moduleName -> +['mmu', 'blake2fmodexpdata', 'blockdata', 'blockhash', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata'].each {moduleName -> tasks.register(moduleName, TraceFilesTask) { group "Trace files generation" dependsOn corsetExists diff --git a/linea-constraints b/linea-constraints index 05aa1c6be..2a343faa8 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 05aa1c6bef87ef2387e079f726809eab6a3c5659 +Subproject commit 2a343faa803194c2c5853ee449364039324b1439 diff --git a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java index b818fae81..9cf635ec5 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java @@ -38,6 +38,7 @@ import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; import org.hyperledger.besu.cryptoservices.KeyPairSecurityModule; import org.hyperledger.besu.cryptoservices.NodeKey; +import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; @@ -59,6 +60,14 @@ public class ExecutionEnvironment { static GenesisConfigFile GENESIS_CONFIG = GenesisConfigFile.fromSource(GenesisConfigFile.class.getResource("/linea.json")); + static final BlockHeaderBuilder DEFAULT_BLOCK_HEADER_BUILDER = + BlockHeaderBuilder.createDefault() + .number(ToyExecutionEnvironmentV2.DEFAULT_BLOCK_NUMBER) + .timestamp(123456789) + .parentHash(Hash.EMPTY_TRIE_HASH) + .nonce(0) + .blockHeaderFunctions(new CliqueBlockHeaderFunctions()); + public static void checkTracer( ZkTracer zkTracer, CorsetValidator corsetValidator, Optional logger) { Path traceFilePath = null; @@ -90,6 +99,7 @@ public static void checkTracer( public static BlockHeaderBuilder getLineaBlockHeaderBuilder( Optional parentBlockHeader) { + BlockHeaderBuilder blockHeaderBuilder = parentBlockHeader.isPresent() ? BlockHeaderBuilder.fromHeader(parentBlockHeader.get()) @@ -98,7 +108,7 @@ public static BlockHeaderBuilder getLineaBlockHeaderBuilder( .parentHash(parentBlockHeader.get().getHash()) .nonce(parentBlockHeader.get().getNonce() + 1) .blockHeaderFunctions(new CliqueBlockHeaderFunctions()) - : BlockHeaderBuilder.createDefault(); + : DEFAULT_BLOCK_HEADER_BUILDER; return blockHeaderBuilder .baseFee(Wei.of(LINEA_BASE_FEE)) diff --git a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java index ef3500926..4cf9e09cd 100644 --- a/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/MultiBlockExecutionEnvironment.java @@ -15,6 +15,8 @@ package net.consensys.linea.testing; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_BLOCK_GAS_LIMIT; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -48,12 +50,18 @@ public static class MultiBlockExecutionEnvironmentBuilder { private List blocks = new ArrayList<>(); public MultiBlockExecutionEnvironmentBuilder addBlock(List transactions) { + return addBlock(transactions, LINEA_BLOCK_GAS_LIMIT); + } + + public MultiBlockExecutionEnvironmentBuilder addBlock( + List transactions, long gasLimit) { BlockHeaderBuilder blockHeaderBuilder = this.blocks.isEmpty() ? ExecutionEnvironment.getLineaBlockHeaderBuilder(Optional.empty()) : ExecutionEnvironment.getLineaBlockHeaderBuilder( Optional.of(this.blocks.getLast().header().toBlockHeader())); blockHeaderBuilder.coinbase(ToyExecutionEnvironmentV2.DEFAULT_COINBASE_ADDRESS); + blockHeaderBuilder.gasLimit(gasLimit); BlockBody blockBody = new BlockBody(transactions, Collections.emptyList()); this.blocks.add(BlockSnapshot.of(blockHeaderBuilder.buildBlockHeader(), blockBody)); diff --git a/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java b/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java index 61748a581..b9240ef27 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java +++ b/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java @@ -39,7 +39,7 @@ public class ToyExecutionEnvironmentV2 { public static final BigInteger CHAIN_ID = BigInteger.valueOf(1337); public static final Address DEFAULT_COINBASE_ADDRESS = Address.fromHexString("0xc019ba5e00000000c019ba5e00000000c019ba5e"); - private static final long DEFAULT_BLOCK_NUMBER = 6678980; + public static final long DEFAULT_BLOCK_NUMBER = 6678980; private static final long DEFAULT_TIME_STAMP = 1347310; private static final Hash DEFAULT_HASH = From b9ddc4fffd77ce1542a18a68041c1b39a1daa32b Mon Sep 17 00:00:00 2001 From: David Pearce Date: Wed, 15 Jan 2025 09:17:49 +1300 Subject: [PATCH 10/54] feat: always rebuild `Trace.java` files (#1696) --- .github/workflows/gradle-tests.yml | 4 +- .../linea/zktracer/module/add/Trace.java | 146 +- .../linea/zktracer/module/bin/Trace.java | 246 +- .../module/blake2fmodexpdata/Trace.java | 56 +- .../module/blockdata/BlockdataOperation.java | 4 +- .../zktracer/module/blockdata/Trace.java | 228 +- .../zktracer/module/blockhash/Trace.java | 206 +- .../module/constants/GlobalConstants.java | 30 +- .../zktracer/module/constants/Trace.java | 407 -- .../linea/zktracer/module/ecdata/Trace.java | 352 +- .../linea/zktracer/module/euc/Trace.java | 105 +- .../linea/zktracer/module/exp/Trace.java | 245 +- .../linea/zktracer/module/ext/Trace.java | 998 ++-- .../linea/zktracer/module/gas/Trace.java | 93 +- .../linea/zktracer/module/hub/Trace.java | 4436 ++++++----------- .../module/hub/fragment/StackFragment.java | 2 +- .../linea/zktracer/module/logdata/Trace.java | 67 +- .../linea/zktracer/module/loginfo/Trace.java | 243 +- .../linea/zktracer/module/mmio/Trace.java | 588 +-- .../linea/zktracer/module/mmu/Trace.java | 611 +-- .../linea/zktracer/module/mod/Trace.java | 530 +- .../linea/zktracer/module/mul/Trace.java | 418 +- .../linea/zktracer/module/mxp/Trace.java | 488 +- .../linea/zktracer/module/oob/Trace.java | 299 +- .../linea/zktracer/module/rlpaddr/Trace.java | 223 +- .../linea/zktracer/module/rlptxn/Trace.java | 358 +- .../zktracer/module/rlptxrcpt/Trace.java | 300 +- .../linea/zktracer/module/rom/Trace.java | 142 +- .../linea/zktracer/module/romlex/Trace.java | 96 +- .../zktracer/module/shakiradata/Trace.java | 91 +- .../linea/zktracer/module/shf/Trace.java | 280 +- .../linea/zktracer/module/stp/Trace.java | 243 +- .../zktracer/module/tables/bin/Trace.java | 16 +- .../tables/instructionDecoder/Trace.java | 115 +- .../zktracer/module/tables/shf/Trace.java | 20 +- .../linea/zktracer/module/trm/Trace.java | 105 +- .../linea/zktracer/module/txndata/Trace.java | 462 +- .../linea/zktracer/module/wcp/Trace.java | 218 +- .../module/blockdata/GasLimitTest.java | 2 +- .../src/main/groovy/TraceFilesTask.groovy | 7 +- gradle/lint.gradle | 15 +- gradle/tests.gradle | 3 +- gradle/trace-files.gradle | 21 + linea-constraints | 2 +- plugins/build.gradle | 7 +- reference-tests/build.gradle | 3 +- testing/build.gradle | 5 +- 47 files changed, 4363 insertions(+), 9173 deletions(-) delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index bc111388d..01645de73 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -28,7 +28,9 @@ jobs: - name: Setup Environment uses: ./.github/actions/setup-environment - + with: + rust-corset: true + - name: Set up GCC uses: egor-tensin/setup-gcc@v1 diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java index 3a32ee8a0..a720fdd3e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.add; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -52,26 +53,26 @@ public class Trace { private final MappedByteBuffer stamp; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("add.ACC_1", 16, length)); - headers.add(new ColumnHeader("add.ACC_2", 16, length)); - headers.add(new ColumnHeader("add.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("add.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("add.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("add.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("add.BYTE_1", 1, length)); - headers.add(new ColumnHeader("add.BYTE_2", 1, length)); - headers.add(new ColumnHeader("add.CT", 1, length)); - headers.add(new ColumnHeader("add.CT_MAX", 1, length)); - headers.add(new ColumnHeader("add.INST", 1, length)); - headers.add(new ColumnHeader("add.OVERFLOW", 1, length)); - headers.add(new ColumnHeader("add.RES_HI", 16, length)); - headers.add(new ColumnHeader("add.RES_LO", 16, length)); - headers.add(new ColumnHeader("add.STAMP", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("add.ACC_1", 16, length)); + headers.add(new ColumnHeader("add.ACC_2", 16, length)); + headers.add(new ColumnHeader("add.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("add.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("add.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("add.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("add.BYTE_1", 1, length)); + headers.add(new ColumnHeader("add.BYTE_2", 1, length)); + headers.add(new ColumnHeader("add.CT", 1, length)); + headers.add(new ColumnHeader("add.CT_MAX", 1, length)); + headers.add(new ColumnHeader("add.INST", 1, length)); + headers.add(new ColumnHeader("add.OVERFLOW", 1, length)); + headers.add(new ColumnHeader("add.RES_HI", 16, length)); + headers.add(new ColumnHeader("add.RES_LO", 16, length)); + headers.add(new ColumnHeader("add.STAMP", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.arg1Hi = buffers.get(2); @@ -107,18 +108,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "add.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "add.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("add.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("add.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java index 8956f0f7e..a5ad49fd7 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.bin; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -74,48 +75,48 @@ public class Trace { private final MappedByteBuffer xxxByteLo; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("bin.ACC_1", 16, length)); - headers.add(new ColumnHeader("bin.ACC_2", 16, length)); - headers.add(new ColumnHeader("bin.ACC_3", 16, length)); - headers.add(new ColumnHeader("bin.ACC_4", 16, length)); - headers.add(new ColumnHeader("bin.ACC_5", 16, length)); - headers.add(new ColumnHeader("bin.ACC_6", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_1_HI", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_1_LO", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_2_HI", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_2_LO", 16, length)); - headers.add(new ColumnHeader("bin.BIT_1", 1, length)); - headers.add(new ColumnHeader("bin.BIT_B_4", 1, length)); - headers.add(new ColumnHeader("bin.BITS", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_1", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_2", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_3", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_4", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_5", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_6", 1, length)); - headers.add(new ColumnHeader("bin.COUNTER", 1, length)); - headers.add(new ColumnHeader("bin.CT_MAX", 1, length)); - headers.add(new ColumnHeader("bin.INST", 1, length)); - headers.add(new ColumnHeader("bin.IS_AND", 1, length)); - headers.add(new ColumnHeader("bin.IS_BYTE", 1, length)); - headers.add(new ColumnHeader("bin.IS_NOT", 1, length)); - headers.add(new ColumnHeader("bin.IS_OR", 1, length)); - headers.add(new ColumnHeader("bin.IS_SIGNEXTEND", 1, length)); - headers.add(new ColumnHeader("bin.IS_XOR", 1, length)); - headers.add(new ColumnHeader("bin.LOW_4", 1, length)); - headers.add(new ColumnHeader("bin.NEG", 1, length)); - headers.add(new ColumnHeader("bin.PIVOT", 1, length)); - headers.add(new ColumnHeader("bin.RESULT_HI", 16, length)); - headers.add(new ColumnHeader("bin.RESULT_LO", 16, length)); - headers.add(new ColumnHeader("bin.SMALL", 1, length)); - headers.add(new ColumnHeader("bin.STAMP", 4, length)); - headers.add(new ColumnHeader("bin.XXX_BYTE_HI", 1, length)); - headers.add(new ColumnHeader("bin.XXX_BYTE_LO", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("bin.ACC_1", 16, length)); + headers.add(new ColumnHeader("bin.ACC_2", 16, length)); + headers.add(new ColumnHeader("bin.ACC_3", 16, length)); + headers.add(new ColumnHeader("bin.ACC_4", 16, length)); + headers.add(new ColumnHeader("bin.ACC_5", 16, length)); + headers.add(new ColumnHeader("bin.ACC_6", 16, length)); + headers.add(new ColumnHeader("bin.ARGUMENT_1_HI", 16, length)); + headers.add(new ColumnHeader("bin.ARGUMENT_1_LO", 16, length)); + headers.add(new ColumnHeader("bin.ARGUMENT_2_HI", 16, length)); + headers.add(new ColumnHeader("bin.ARGUMENT_2_LO", 16, length)); + headers.add(new ColumnHeader("bin.BIT_1", 1, length)); + headers.add(new ColumnHeader("bin.BIT_B_4", 1, length)); + headers.add(new ColumnHeader("bin.BITS", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_1", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_2", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_3", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_4", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_5", 1, length)); + headers.add(new ColumnHeader("bin.BYTE_6", 1, length)); + headers.add(new ColumnHeader("bin.COUNTER", 1, length)); + headers.add(new ColumnHeader("bin.CT_MAX", 1, length)); + headers.add(new ColumnHeader("bin.INST", 1, length)); + headers.add(new ColumnHeader("bin.IS_AND", 1, length)); + headers.add(new ColumnHeader("bin.IS_BYTE", 1, length)); + headers.add(new ColumnHeader("bin.IS_NOT", 1, length)); + headers.add(new ColumnHeader("bin.IS_OR", 1, length)); + headers.add(new ColumnHeader("bin.IS_SIGNEXTEND", 1, length)); + headers.add(new ColumnHeader("bin.IS_XOR", 1, length)); + headers.add(new ColumnHeader("bin.LOW_4", 1, length)); + headers.add(new ColumnHeader("bin.NEG", 1, length)); + headers.add(new ColumnHeader("bin.PIVOT", 1, length)); + headers.add(new ColumnHeader("bin.RESULT_HI", 16, length)); + headers.add(new ColumnHeader("bin.RESULT_LO", 16, length)); + headers.add(new ColumnHeader("bin.SMALL", 1, length)); + headers.add(new ColumnHeader("bin.STAMP", 4, length)); + headers.add(new ColumnHeader("bin.XXX_BYTE_HI", 1, length)); + headers.add(new ColumnHeader("bin.XXX_BYTE_LO", 1, length)); + return headers; + } + + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.acc3 = buffers.get(2); @@ -173,18 +174,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "bin.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc6.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc6.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.RESULT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.RESULT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resultHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resultHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resultHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "bin.RESULT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.RESULT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resultLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resultLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resultLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("bin.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("bin.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java index 00b48d093..120e48663 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.blake2fmodexpdata; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -58,24 +59,24 @@ public class Trace { private final MappedByteBuffer stamp; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blake2fmodexpdata.ID", 4, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.INDEX", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.INDEX_MAX", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_DATA", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_PARAMS", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_RESULT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_BASE", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_EXPONENT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_MODULUS", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_RESULT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.LIMB", 16, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.PHASE", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.STAMP", 2, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("blake2fmodexpdata.ID", 4, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.INDEX", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.INDEX_MAX", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_DATA", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_PARAMS", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_RESULT", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_BASE", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_EXPONENT", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_MODULUS", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_RESULT", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.LIMB", 16, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.PHASE", 1, length)); + headers.add(new ColumnHeader("blake2fmodexpdata.STAMP", 2, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.id = buffers.get(0); this.index = buffers.get(1); this.indexMax = buffers.get(2); @@ -106,14 +107,13 @@ public Trace id(final long b) { filled.set(0); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("blake2fmodexpdata.ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("blake2fmodexpdata.ID has invalid value (" + b + ")"); } id.put((byte) (b >> 24)); id.put((byte) (b >> 16)); id.put((byte) (b >> 8)); id.put((byte) b); + return this; } @@ -235,18 +235,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blake2fmodexpdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blake2fmodexpdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 1024L) { - throw new IllegalArgumentException("blake2fmodexpdata.STAMP has invalid value (" + b + ")"); - } + if(b >= 1024L) { throw new IllegalArgumentException("blake2fmodexpdata.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index d0c1cc28a..7cd0526ff 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -20,10 +20,12 @@ import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_GT; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_ISZERO; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_LT; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_LIMIT_ADJUSTMENT_FACTOR; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_GAS_LIMIT_MAXIMUM; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_GAS_LIMIT_MINIMUM; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_GEQ; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; -import static net.consensys.linea.zktracer.module.constants.Trace.*; import static net.consensys.linea.zktracer.types.Conversions.booleanToBytes; import java.math.BigInteger; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java index ae8e03b22..92ea77303 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.blockdata; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -73,39 +74,39 @@ public class Trace { private final MappedByteBuffer wcpFlag; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blockdata.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.BASEFEE", 8, length)); - headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("blockdata.COINBASE_HI", 4, length)); - headers.add(new ColumnHeader("blockdata.COINBASE_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.CT", 1, length)); - headers.add(new ColumnHeader("blockdata.CT_MAX", 1, length)); - headers.add(new ColumnHeader("blockdata.DATA_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.DATA_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("blockdata.EXO_INST", 1, length)); - headers.add(new ColumnHeader("blockdata.FIRST_BLOCK_NUMBER", 6, length)); - headers.add(new ColumnHeader("blockdata.INST", 1, length)); - headers.add(new ColumnHeader("blockdata.IOMF", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_BASEFEE", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_CHAINID", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_COINBASE", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_DIFFICULTY", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_GASLIMIT", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_NUMBER", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_TIMESTAMP", 1, length)); - headers.add(new ColumnHeader("blockdata.REL_BLOCK", 2, length)); - headers.add(new ColumnHeader("blockdata.REL_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("blockdata.RES", 16, length)); - headers.add(new ColumnHeader("blockdata.WCP_FLAG", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("blockdata.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("blockdata.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.BASEFEE", 8, length)); + headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 8, length)); + headers.add(new ColumnHeader("blockdata.COINBASE_HI", 4, length)); + headers.add(new ColumnHeader("blockdata.COINBASE_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.CT", 1, length)); + headers.add(new ColumnHeader("blockdata.CT_MAX", 1, length)); + headers.add(new ColumnHeader("blockdata.DATA_HI", 16, length)); + headers.add(new ColumnHeader("blockdata.DATA_LO", 16, length)); + headers.add(new ColumnHeader("blockdata.EUC_FLAG", 1, length)); + headers.add(new ColumnHeader("blockdata.EXO_INST", 1, length)); + headers.add(new ColumnHeader("blockdata.FIRST_BLOCK_NUMBER", 6, length)); + headers.add(new ColumnHeader("blockdata.INST", 1, length)); + headers.add(new ColumnHeader("blockdata.IOMF", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_BASEFEE", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_CHAINID", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_COINBASE", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_DIFFICULTY", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_GASLIMIT", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_NUMBER", 1, length)); + headers.add(new ColumnHeader("blockdata.IS_TIMESTAMP", 1, length)); + headers.add(new ColumnHeader("blockdata.REL_BLOCK", 2, length)); + headers.add(new ColumnHeader("blockdata.REL_TX_NUM_MAX", 2, length)); + headers.add(new ColumnHeader("blockdata.RES", 16, length)); + headers.add(new ColumnHeader("blockdata.WCP_FLAG", 1, length)); + return headers; + } + + public Trace (List buffers) { this.arg1Hi = buffers.get(0); this.arg1Lo = buffers.get(1); this.arg2Hi = buffers.get(2); @@ -154,18 +155,11 @@ public Trace arg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockdata.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockdata.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockdata.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "blockdata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("blockdata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - basefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { basefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - basefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "blockdata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("blockdata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - blockGasLimit.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { blockGasLimit.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockGasLimit.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("blockdata.COINBASE_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("blockdata.COINBASE_HI has invalid value (" + b + ")"); } coinbaseHi.put((byte) (b >> 24)); coinbaseHi.put((byte) (b >> 16)); coinbaseHi.put((byte) (b >> 8)); coinbaseHi.put((byte) b); + return this; } @@ -328,18 +286,11 @@ public Trace coinbaseLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - coinbaseLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { coinbaseLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - coinbaseLo.put(bs.get(j)); - } + for(int j=0; j= 8L) { - throw new IllegalArgumentException("blockdata.CT has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("blockdata.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -366,11 +316,10 @@ public Trace ctMax(final long b) { filled.set(9); } - if (b >= 8L) { - throw new IllegalArgumentException("blockdata.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("blockdata.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -384,18 +333,11 @@ public Trace dataHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockdata.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataLo.put(bs.get(j)); - } + for(int j=0; j= 281474976710656L) { - throw new IllegalArgumentException( - "blockdata.FIRST_BLOCK_NUMBER has invalid value (" + b + ")"); - } + if(b >= 281474976710656L) { throw new IllegalArgumentException("blockdata.FIRST_BLOCK_NUMBER has invalid value (" + b + ")"); } firstBlockNumber.put((byte) (b >> 40)); firstBlockNumber.put((byte) (b >> 32)); firstBlockNumber.put((byte) (b >> 24)); @@ -468,6 +400,7 @@ public Trace firstBlockNumber(final long b) { firstBlockNumber.put((byte) (b >> 8)); firstBlockNumber.put((byte) b); + return this; } @@ -586,12 +519,11 @@ public Trace relBlock(final long b) { filled.set(24); } - if (b >= 65536L) { - throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); } relBlock.put((byte) (b >> 8)); relBlock.put((byte) b); + return this; } @@ -602,12 +534,11 @@ public Trace relTxNumMax(final long b) { filled.set(25); } - if (b >= 65536L) { - throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); } relTxNumMax.put((byte) (b >> 8)); relTxNumMax.put((byte) b); + return this; } @@ -621,18 +552,11 @@ public Trace res(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockdata.RES has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.RES has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - res.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { res.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - res.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blockhash.ABS_BLOCK", 6, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.CT", 1, length)); - headers.add(new ColumnHeader("blockhash.CT_MAX", 1, length)); - headers.add(new ColumnHeader("blockhash.EXO_INST", 1, length)); - headers.add(new ColumnHeader("blockhash.EXO_RES", 1, length)); - headers.add(new ColumnHeader("blockhash.IOMF", 1, length)); - headers.add(new ColumnHeader("blockhash.MACRO", 1, length)); - headers.add(new ColumnHeader("blockhash.PRPRC", 1, length)); - headers.add(new ColumnHeader("blockhash.REL_BLOCK", 2, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("blockhash.ABS_BLOCK", 6, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_HI", 16, length)); + headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_LO", 16, length)); + headers.add(new ColumnHeader("blockhash.CT", 1, length)); + headers.add(new ColumnHeader("blockhash.CT_MAX", 1, length)); + headers.add(new ColumnHeader("blockhash.EXO_INST", 1, length)); + headers.add(new ColumnHeader("blockhash.EXO_RES", 1, length)); + headers.add(new ColumnHeader("blockhash.IOMF", 1, length)); + headers.add(new ColumnHeader("blockhash.MACRO", 1, length)); + headers.add(new ColumnHeader("blockhash.PRPRC", 1, length)); + headers.add(new ColumnHeader("blockhash.REL_BLOCK", 2, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.absBlock = buffers.get(0); this.blockhashArgHiXorExoArg1Hi = buffers.get(1); this.blockhashArgLoXorExoArg1Lo = buffers.get(2); @@ -112,11 +114,10 @@ public Trace ct(final long b) { filled.set(0); } - if (b >= 256L) { - throw new IllegalArgumentException("blockhash.CT has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("blockhash.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -127,11 +128,10 @@ public Trace ctMax(final long b) { filled.set(1); } - if (b >= 256L) { - throw new IllegalArgumentException("blockhash.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("blockhash.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -166,9 +166,7 @@ public Trace pMacroAbsBlock(final long b) { filled.set(8); } - if (b >= 281474976710656L) { - throw new IllegalArgumentException("blockhash.macro/ABS_BLOCK has invalid value (" + b + ")"); - } + if(b >= 281474976710656L) { throw new IllegalArgumentException("blockhash.macro/ABS_BLOCK has invalid value (" + b + ")"); } absBlock.put((byte) (b >> 40)); absBlock.put((byte) (b >> 32)); absBlock.put((byte) (b >> 24)); @@ -176,6 +174,7 @@ public Trace pMacroAbsBlock(final long b) { absBlock.put((byte) (b >> 8)); absBlock.put((byte) b); + return this; } @@ -189,18 +188,11 @@ public Trace pMacroBlockhashArgHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_ARG_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_ARG_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashArgHiXorExoArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashArgHiXorExoArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashArgHiXorExoArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_ARG_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_ARG_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashArgLoXorExoArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashArgLoXorExoArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashArgLoXorExoArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashResHiXorExoArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashResHiXorExoArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashResHiXorExoArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashResLoXorExoArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashResLoXorExoArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashResLoXorExoArg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_VAL_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_VAL_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashValHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashValHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashValHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.macro/BLOCKHASH_VAL_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_VAL_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashValLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashValLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashValLo.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("blockhash.macro/REL_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("blockhash.macro/REL_BLOCK has invalid value (" + b + ")"); } relBlock.put((byte) (b >> 8)); relBlock.put((byte) b); + return this; } @@ -361,18 +317,11 @@ public Trace pPreprocessingExoArg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "blockhash.preprocessing/EXO_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashArgHiXorExoArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashArgHiXorExoArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashArgHiXorExoArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.preprocessing/EXO_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashArgLoXorExoArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashArgLoXorExoArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashArgLoXorExoArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.preprocessing/EXO_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashResHiXorExoArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashResHiXorExoArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashResHiXorExoArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "blockhash.preprocessing/EXO_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - blockhashResLoXorExoArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { blockhashResLoXorExoArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockhashResLoXorExoArg2Lo.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException( - "blockhash.preprocessing/EXO_INST has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_INST has invalid value (" + b + ")"); } exoInst.put((byte) b); + return this; } @@ -501,23 +427,19 @@ public Trace validateRow() { } if (!filled.get(9)) { - throw new IllegalStateException( - "blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI has not been filled"); } if (!filled.get(10)) { - throw new IllegalStateException( - "blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO has not been filled"); } if (!filled.get(11)) { - throw new IllegalStateException( - "blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI has not been filled"); } if (!filled.get(12)) { - throw new IllegalStateException( - "blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO has not been filled"); + throw new IllegalStateException("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO has not been filled"); } if (!filled.get(13)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java index 0397c833f..7971e3797 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java @@ -22,6 +22,8 @@ import java.util.List; import net.consensys.linea.zktracer.ColumnHeader; +import net.consensys.linea.zktracer.types.UnsignedByte; +import org.apache.tuweni.bytes.Bytes; /** * WARNING: This code is generated automatically. @@ -34,17 +36,14 @@ public class GlobalConstants { public static final int CREATE2_SHIFT = 0xff; public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; public static final int EIP_3541_MARKER = 0xef; - public static final BigInteger EMPTY_KECCAK_HI = - new BigInteger("262949717399590921288928019264691438528"); - public static final BigInteger EMPTY_KECCAK_LO = - new BigInteger("304396909071904405792975023732328604784"); + public static final BigInteger EMPTY_KECCAK_HI = new BigInteger("262949717399590921288928019264691438528"); + public static final BigInteger EMPTY_KECCAK_LO = new BigInteger("304396909071904405792975023732328604784"); public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; - public static final BigInteger EMPTY_RIPEMD_LO = - new BigInteger("263072838190121256777638892741499129137"); - public static final BigInteger EMPTY_SHA2_HI = - new BigInteger("302652579918965577886386472538583578916"); - public static final BigInteger EMPTY_SHA2_LO = - new BigInteger("52744687940778649747319168982913824853"); + public static final BigInteger EMPTY_RIPEMD_LO = new BigInteger("263072838190121256777638892741499129137"); + public static final BigInteger EMPTY_SHA2_HI = new BigInteger("302652579918965577886386472538583578916"); + public static final BigInteger EMPTY_SHA2_LO = new BigInteger("52744687940778649747319168982913824853"); + public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; + public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; public static final int EVM_INST_ADD = 0x1; public static final int EVM_INST_ADDMOD = 0x8; public static final int EVM_INST_ADDRESS = 0x30; @@ -238,10 +237,13 @@ public class GlobalConstants { public static final int GAS_CONST_G_VERY_LOW = 0x3; public static final int GAS_CONST_G_WARM_ACCESS = 0x64; public static final int GAS_CONST_G_ZERO = 0x0; + public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; public static final int LINEA_BASE_FEE = 0x7; public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; public static final int LINEA_CHAIN_ID = 0xe708; public static final int LINEA_DIFFICULTY = 0x2; + public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; + public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; @@ -365,12 +367,14 @@ public class GlobalConstants { private final BitSet filled = new BitSet(); private int currentLine = 0; + static List headers(int length) { - List headers = new ArrayList<>(); - return headers; + List headers = new ArrayList<>(); + return headers; } - public GlobalConstants(List buffers) {} + public GlobalConstants (List buffers) { + } public int size() { if (!filled.isEmpty()) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java deleted file mode 100644 index ca220a1bf..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/Trace.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.constants; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int BLOCKHASH_MAX_HISTORY = 0x100; - public static final int CREATE2_SHIFT = 0xff; - public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; - public static final int EIP_3541_MARKER = 0xef; - public static final BigInteger EMPTY_KECCAK_HI = - new BigInteger("262949717399590921288928019264691438528"); - public static final BigInteger EMPTY_KECCAK_LO = - new BigInteger("304396909071904405792975023732328604784"); - public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; - public static final BigInteger EMPTY_RIPEMD_LO = - new BigInteger("263072838190121256777638892741499129137"); - public static final BigInteger EMPTY_SHA2_HI = - new BigInteger("302652579918965577886386472538583578916"); - public static final BigInteger EMPTY_SHA2_LO = - new BigInteger("52744687940778649747319168982913824853"); - public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; - public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; - public static final int EVM_INST_ADD = 0x1; - public static final int EVM_INST_ADDMOD = 0x8; - public static final int EVM_INST_ADDRESS = 0x30; - public static final int EVM_INST_AND = 0x16; - public static final int EVM_INST_BALANCE = 0x31; - public static final int EVM_INST_BASEFEE = 0x48; - public static final int EVM_INST_BLOCKHASH = 0x40; - public static final int EVM_INST_BYTE = 0x1a; - public static final int EVM_INST_CALL = 0xf1; - public static final int EVM_INST_CALLCODE = 0xf2; - public static final int EVM_INST_CALLDATACOPY = 0x37; - public static final int EVM_INST_CALLDATALOAD = 0x35; - public static final int EVM_INST_CALLDATASIZE = 0x36; - public static final int EVM_INST_CALLER = 0x33; - public static final int EVM_INST_CALLVALUE = 0x34; - public static final int EVM_INST_CHAINID = 0x46; - public static final int EVM_INST_CODECOPY = 0x39; - public static final int EVM_INST_CODESIZE = 0x38; - public static final int EVM_INST_COINBASE = 0x41; - public static final int EVM_INST_CREATE = 0xf0; - public static final int EVM_INST_CREATE2 = 0xf5; - public static final int EVM_INST_DELEGATECALL = 0xf4; - public static final int EVM_INST_DIFFICULTY = 0x44; - public static final int EVM_INST_DIV = 0x4; - public static final int EVM_INST_DUP1 = 0x80; - public static final int EVM_INST_DUP10 = 0x89; - public static final int EVM_INST_DUP11 = 0x8a; - public static final int EVM_INST_DUP12 = 0x8b; - public static final int EVM_INST_DUP13 = 0x8c; - public static final int EVM_INST_DUP14 = 0x8d; - public static final int EVM_INST_DUP15 = 0x8e; - public static final int EVM_INST_DUP16 = 0x8f; - public static final int EVM_INST_DUP2 = 0x81; - public static final int EVM_INST_DUP3 = 0x82; - public static final int EVM_INST_DUP4 = 0x83; - public static final int EVM_INST_DUP5 = 0x84; - public static final int EVM_INST_DUP6 = 0x85; - public static final int EVM_INST_DUP7 = 0x86; - public static final int EVM_INST_DUP8 = 0x87; - public static final int EVM_INST_DUP9 = 0x88; - public static final int EVM_INST_EQ = 0x14; - public static final int EVM_INST_EXP = 0xa; - public static final int EVM_INST_EXTCODECOPY = 0x3c; - public static final int EVM_INST_EXTCODEHASH = 0x3f; - public static final int EVM_INST_EXTCODESIZE = 0x3b; - public static final int EVM_INST_GAS = 0x5a; - public static final int EVM_INST_GASLIMIT = 0x45; - public static final int EVM_INST_GASPRICE = 0x3a; - public static final int EVM_INST_GT = 0x11; - public static final int EVM_INST_INVALID = 0xfe; - public static final int EVM_INST_ISZERO = 0x15; - public static final int EVM_INST_JUMP = 0x56; - public static final int EVM_INST_JUMPDEST = 0x5b; - public static final int EVM_INST_JUMPI = 0x57; - public static final int EVM_INST_LOG0 = 0xa0; - public static final int EVM_INST_LOG1 = 0xa1; - public static final int EVM_INST_LOG2 = 0xa2; - public static final int EVM_INST_LOG3 = 0xa3; - public static final int EVM_INST_LOG4 = 0xa4; - public static final int EVM_INST_LT = 0x10; - public static final int EVM_INST_MLOAD = 0x51; - public static final int EVM_INST_MOD = 0x6; - public static final int EVM_INST_MSIZE = 0x59; - public static final int EVM_INST_MSTORE = 0x52; - public static final int EVM_INST_MSTORE8 = 0x53; - public static final int EVM_INST_MUL = 0x2; - public static final int EVM_INST_MULMOD = 0x9; - public static final int EVM_INST_NOT = 0x19; - public static final int EVM_INST_NUMBER = 0x43; - public static final int EVM_INST_OR = 0x17; - public static final int EVM_INST_ORIGIN = 0x32; - public static final int EVM_INST_PC = 0x58; - public static final int EVM_INST_POP = 0x50; - public static final int EVM_INST_PUSH1 = 0x60; - public static final int EVM_INST_PUSH10 = 0x69; - public static final int EVM_INST_PUSH11 = 0x6a; - public static final int EVM_INST_PUSH12 = 0x6b; - public static final int EVM_INST_PUSH13 = 0x6c; - public static final int EVM_INST_PUSH14 = 0x6d; - public static final int EVM_INST_PUSH15 = 0x6e; - public static final int EVM_INST_PUSH16 = 0x6f; - public static final int EVM_INST_PUSH17 = 0x70; - public static final int EVM_INST_PUSH18 = 0x71; - public static final int EVM_INST_PUSH19 = 0x72; - public static final int EVM_INST_PUSH2 = 0x61; - public static final int EVM_INST_PUSH20 = 0x73; - public static final int EVM_INST_PUSH21 = 0x74; - public static final int EVM_INST_PUSH22 = 0x75; - public static final int EVM_INST_PUSH23 = 0x76; - public static final int EVM_INST_PUSH24 = 0x77; - public static final int EVM_INST_PUSH25 = 0x78; - public static final int EVM_INST_PUSH26 = 0x79; - public static final int EVM_INST_PUSH27 = 0x7a; - public static final int EVM_INST_PUSH28 = 0x7b; - public static final int EVM_INST_PUSH29 = 0x7c; - public static final int EVM_INST_PUSH3 = 0x62; - public static final int EVM_INST_PUSH30 = 0x7d; - public static final int EVM_INST_PUSH31 = 0x7e; - public static final int EVM_INST_PUSH32 = 0x7f; - public static final int EVM_INST_PUSH4 = 0x63; - public static final int EVM_INST_PUSH5 = 0x64; - public static final int EVM_INST_PUSH6 = 0x65; - public static final int EVM_INST_PUSH7 = 0x66; - public static final int EVM_INST_PUSH8 = 0x67; - public static final int EVM_INST_PUSH9 = 0x68; - public static final int EVM_INST_RETURN = 0xf3; - public static final int EVM_INST_RETURNDATACOPY = 0x3e; - public static final int EVM_INST_RETURNDATASIZE = 0x3d; - public static final int EVM_INST_REVERT = 0xfd; - public static final int EVM_INST_SAR = 0x1d; - public static final int EVM_INST_SDIV = 0x5; - public static final int EVM_INST_SELFBALANCE = 0x47; - public static final int EVM_INST_SELFDESTRUCT = 0xff; - public static final int EVM_INST_SGT = 0x13; - public static final int EVM_INST_SHA3 = 0x20; - public static final int EVM_INST_SHL = 0x1b; - public static final int EVM_INST_SHR = 0x1c; - public static final int EVM_INST_SIGNEXTEND = 0xb; - public static final int EVM_INST_SLOAD = 0x54; - public static final int EVM_INST_SLT = 0x12; - public static final int EVM_INST_SMOD = 0x7; - public static final int EVM_INST_SSTORE = 0x55; - public static final int EVM_INST_STATICCALL = 0xfa; - public static final int EVM_INST_STOP = 0x0; - public static final int EVM_INST_SUB = 0x3; - public static final int EVM_INST_SWAP1 = 0x90; - public static final int EVM_INST_SWAP10 = 0x99; - public static final int EVM_INST_SWAP11 = 0x9a; - public static final int EVM_INST_SWAP12 = 0x9b; - public static final int EVM_INST_SWAP13 = 0x9c; - public static final int EVM_INST_SWAP14 = 0x9d; - public static final int EVM_INST_SWAP15 = 0x9e; - public static final int EVM_INST_SWAP16 = 0x9f; - public static final int EVM_INST_SWAP2 = 0x91; - public static final int EVM_INST_SWAP3 = 0x92; - public static final int EVM_INST_SWAP4 = 0x93; - public static final int EVM_INST_SWAP5 = 0x94; - public static final int EVM_INST_SWAP6 = 0x95; - public static final int EVM_INST_SWAP7 = 0x96; - public static final int EVM_INST_SWAP8 = 0x97; - public static final int EVM_INST_SWAP9 = 0x98; - public static final int EVM_INST_TIMESTAMP = 0x42; - public static final int EVM_INST_XOR = 0x18; - public static final int EXO_SUM_INDEX_BLAKEMODEXP = 0x6; - public static final int EXO_SUM_INDEX_ECDATA = 0x4; - public static final int EXO_SUM_INDEX_KEC = 0x1; - public static final int EXO_SUM_INDEX_LOG = 0x2; - public static final int EXO_SUM_INDEX_RIPSHA = 0x5; - public static final int EXO_SUM_INDEX_ROM = 0x0; - public static final int EXO_SUM_INDEX_TXCD = 0x3; - public static final int EXO_SUM_WEIGHT_BLAKEMODEXP = 0x40; - public static final int EXO_SUM_WEIGHT_ECDATA = 0x10; - public static final int EXO_SUM_WEIGHT_KEC = 0x2; - public static final int EXO_SUM_WEIGHT_LOG = 0x4; - public static final int EXO_SUM_WEIGHT_RIPSHA = 0x20; - public static final int EXO_SUM_WEIGHT_ROM = 0x1; - public static final int EXO_SUM_WEIGHT_TXCD = 0x8; - public static final int EXP_INST_EXPLOG = 0xee0a; - public static final int EXP_INST_MODEXPLOG = 0xee05; - public static final int GAS_CONST_G_ACCESS_LIST_ADRESS = 0x960; - public static final int GAS_CONST_G_ACCESS_LIST_STORAGE = 0x76c; - public static final int GAS_CONST_G_BASE = 0x2; - public static final int GAS_CONST_G_BLOCKHASH = 0x14; - public static final int GAS_CONST_G_CALL_STIPEND = 0x8fc; - public static final int GAS_CONST_G_CALL_VALUE = 0x2328; - public static final int GAS_CONST_G_CODE_DEPOSIT = 0xc8; - public static final int GAS_CONST_G_COLD_ACCOUNT_ACCESS = 0xa28; - public static final int GAS_CONST_G_COLD_SLOAD = 0x834; - public static final int GAS_CONST_G_COPY = 0x3; - public static final int GAS_CONST_G_CREATE = 0x7d00; - public static final int GAS_CONST_G_EXP = 0xa; - public static final int GAS_CONST_G_EXP_BYTE = 0x32; - public static final int GAS_CONST_G_HIGH = 0xa; - public static final int GAS_CONST_G_JUMPDEST = 0x1; - public static final int GAS_CONST_G_KECCAK_256 = 0x1e; - public static final int GAS_CONST_G_KECCAK_256_WORD = 0x6; - public static final int GAS_CONST_G_LOG = 0x177; - public static final int GAS_CONST_G_LOG_DATA = 0x8; - public static final int GAS_CONST_G_LOG_TOPIC = 0x177; - public static final int GAS_CONST_G_LOW = 0x5; - public static final int GAS_CONST_G_MEMORY = 0x3; - public static final int GAS_CONST_G_MID = 0x8; - public static final int GAS_CONST_G_NEW_ACCOUNT = 0x61a8; - public static final int GAS_CONST_G_SELFDESTRUCT = 0x1388; - public static final int GAS_CONST_G_SRESET = 0xb54; - public static final int GAS_CONST_G_SSET = 0x4e20; - public static final int GAS_CONST_G_TRANSACTION = 0x5208; - public static final int GAS_CONST_G_TX_CREATE = 0x7d00; - public static final int GAS_CONST_G_TX_DATA_NONZERO = 0x10; - public static final int GAS_CONST_G_TX_DATA_ZERO = 0x4; - public static final int GAS_CONST_G_VERY_LOW = 0x3; - public static final int GAS_CONST_G_WARM_ACCESS = 0x64; - public static final int GAS_CONST_G_ZERO = 0x0; - public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; - public static final int LINEA_BASE_FEE = 0x7; - public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; - public static final int LINEA_CHAIN_ID = 0xe708; - public static final int LINEA_DIFFICULTY = 0x2; - public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; - public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; - public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; - public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; - public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; - public static final int LLARGE = 0x10; - public static final int LLARGEMO = 0xf; - public static final int LLARGEPO = 0x11; - public static final int MAX_CODE_SIZE = 0x6000; - public static final int MAX_REFUND_QUOTIENT = 0x5; - public static final int MISC_WEIGHT_EXP = 0x1; - public static final int MISC_WEIGHT_MMU = 0x2; - public static final int MISC_WEIGHT_MXP = 0x4; - public static final int MISC_WEIGHT_OOB = 0x8; - public static final int MISC_WEIGHT_STP = 0x10; - public static final int MMEDIUM = 0x8; - public static final int MMEDIUMMO = 0x7; - public static final int MMIO_INST_LIMB_TO_RAM_ONE_TARGET = 0xfe12; - public static final int MMIO_INST_LIMB_TO_RAM_TRANSPLANT = 0xfe11; - public static final int MMIO_INST_LIMB_TO_RAM_TWO_TARGET = 0xfe13; - public static final int MMIO_INST_LIMB_VANISHES = 0xfe01; - public static final int MMIO_INST_RAM_EXCISION = 0xfe41; - public static final int MMIO_INST_RAM_TO_LIMB_ONE_SOURCE = 0xfe22; - public static final int MMIO_INST_RAM_TO_LIMB_TRANSPLANT = 0xfe21; - public static final int MMIO_INST_RAM_TO_LIMB_TWO_SOURCE = 0xfe23; - public static final int MMIO_INST_RAM_TO_RAM_PARTIAL = 0xfe32; - public static final int MMIO_INST_RAM_TO_RAM_TRANSPLANT = 0xfe31; - public static final int MMIO_INST_RAM_TO_RAM_TWO_SOURCE = 0xfe34; - public static final int MMIO_INST_RAM_TO_RAM_TWO_TARGET = 0xfe33; - public static final int MMIO_INST_RAM_VANISHES = 0xfe42; - public static final int MMU_INST_ANY_TO_RAM_WITH_PADDING = 0xfe50; - public static final int MMU_INST_BLAKE = 0xfe80; - public static final int MMU_INST_EXO_TO_RAM_TRANSPLANTS = 0xfe30; - public static final int MMU_INST_INVALID_CODE_PREFIX = 0xfe00; - public static final int MMU_INST_MLOAD = 0xfe01; - public static final int MMU_INST_MODEXP_DATA = 0xfe70; - public static final int MMU_INST_MODEXP_ZERO = 0xfe60; - public static final int MMU_INST_MSTORE = 0xfe02; - public static final int MMU_INST_MSTORE8 = 0xfe03; - public static final int MMU_INST_RAM_TO_EXO_WITH_PADDING = 0xfe20; - public static final int MMU_INST_RAM_TO_RAM_SANS_PADDING = 0xfe40; - public static final int MMU_INST_RIGHT_PADDED_WORD_EXTRACTION = 0xfe10; - public static final int OOB_INST_BLAKE_CDS = 0xfa09; - public static final int OOB_INST_BLAKE_PARAMS = 0xfb09; - public static final int OOB_INST_CALL = 0xca; - public static final int OOB_INST_CDL = 0x35; - public static final int OOB_INST_CREATE = 0xce; - public static final int OOB_INST_DEPLOYMENT = 0xf3; - public static final int OOB_INST_ECADD = 0xff06; - public static final int OOB_INST_ECMUL = 0xff07; - public static final int OOB_INST_ECPAIRING = 0xff08; - public static final int OOB_INST_ECRECOVER = 0xff01; - public static final int OOB_INST_IDENTITY = 0xff04; - public static final int OOB_INST_JUMP = 0x56; - public static final int OOB_INST_JUMPI = 0x57; - public static final int OOB_INST_MODEXP_CDS = 0xfa05; - public static final int OOB_INST_MODEXP_EXTRACT = 0xfe05; - public static final int OOB_INST_MODEXP_LEAD = 0xfc05; - public static final int OOB_INST_MODEXP_PRICING = 0xfd05; - public static final int OOB_INST_MODEXP_XBS = 0xfb05; - public static final int OOB_INST_RDC = 0x3e; - public static final int OOB_INST_RIPEMD = 0xff03; - public static final int OOB_INST_SHA2 = 0xff02; - public static final int OOB_INST_SSTORE = 0x55; - public static final int OOB_INST_XCALL = 0xcc; - public static final int PHASE_BLAKE_DATA = 0x5; - public static final int PHASE_BLAKE_PARAMS = 0x6; - public static final int PHASE_BLAKE_RESULT = 0x7; - public static final int PHASE_ECADD_DATA = 0x60a; - public static final int PHASE_ECADD_RESULT = 0x60b; - public static final int PHASE_ECMUL_DATA = 0x70a; - public static final int PHASE_ECMUL_RESULT = 0x70b; - public static final int PHASE_ECPAIRING_DATA = 0x80a; - public static final int PHASE_ECPAIRING_RESULT = 0x80b; - public static final int PHASE_ECRECOVER_DATA = 0x10a; - public static final int PHASE_ECRECOVER_RESULT = 0x10b; - public static final int PHASE_KECCAK_DATA = 0x5; - public static final int PHASE_KECCAK_RESULT = 0x6; - public static final int PHASE_MODEXP_BASE = 0x1; - public static final int PHASE_MODEXP_EXPONENT = 0x2; - public static final int PHASE_MODEXP_MODULUS = 0x3; - public static final int PHASE_MODEXP_RESULT = 0x4; - public static final int PHASE_RIPEMD_DATA = 0x3; - public static final int PHASE_RIPEMD_RESULT = 0x4; - public static final int PHASE_SHA2_DATA = 0x1; - public static final int PHASE_SHA2_RESULT = 0x2; - public static final int REFUND_CONST_R_SCLEAR = 0x12c0; - public static final int RLP_ADDR_RECIPE_1 = 0x1; - public static final int RLP_ADDR_RECIPE_2 = 0x2; - public static final int RLP_PREFIX_INT_LONG = 0xb7; - public static final int RLP_PREFIX_INT_SHORT = 0x80; - public static final int RLP_PREFIX_LIST_LONG = 0xf7; - public static final int RLP_PREFIX_LIST_SHORT = 0xc0; - public static final int RLP_RCPT_SUBPHASE_ID_ADDR = 0x35; - public static final int RLP_RCPT_SUBPHASE_ID_CUMUL_GAS = 0x3; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_LIMB = 0x4d; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_SIZE = 0x53; - public static final int RLP_RCPT_SUBPHASE_ID_NO_LOG_ENTRY = 0xb; - public static final int RLP_RCPT_SUBPHASE_ID_STATUS_CODE = 0x2; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_BASE = 0x41; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_DELTA = 0x60; - public static final int RLP_RCPT_SUBPHASE_ID_TYPE = 0x7; - public static final int RLP_TXN_PHASE_ACCESS_LIST = 0xb; - public static final int RLP_TXN_PHASE_BETA = 0xc; - public static final int RLP_TXN_PHASE_CHAIN_ID = 0x2; - public static final int RLP_TXN_PHASE_DATA = 0xa; - public static final int RLP_TXN_PHASE_GAS_LIMIT = 0x7; - public static final int RLP_TXN_PHASE_GAS_PRICE = 0x4; - public static final int RLP_TXN_PHASE_MAX_FEE_PER_GAS = 0x6; - public static final int RLP_TXN_PHASE_MAX_PRIORITY_FEE_PER_GAS = 0x5; - public static final int RLP_TXN_PHASE_NONCE = 0x3; - public static final int RLP_TXN_PHASE_R = 0xe; - public static final int RLP_TXN_PHASE_RLP_PREFIX = 0x1; - public static final int RLP_TXN_PHASE_S = 0xf; - public static final int RLP_TXN_PHASE_TO = 0x8; - public static final int RLP_TXN_PHASE_VALUE = 0x9; - public static final int RLP_TXN_PHASE_Y = 0xd; - public static final int WCP_INST_GEQ = 0xe; - public static final int WCP_INST_LEQ = 0xf; - public static final int WORD_SIZE = 0x20; - public static final int WORD_SIZE_MO = 0x1f; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - static List headers(int length) { - List headers = new ArrayList<>(); - return headers; - } - - public Trace(List buffers) {} - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace validateRow() { - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java index 518091bf5..872c29937 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java @@ -49,12 +49,9 @@ public class Trace { public static final int INDEX_MAX_ECRECOVER_RESULT = 0x1; public static final int MULMOD = 0x9; public static final BigInteger P_BN_HI = new BigInteger("64323764613183177041862057485226039389"); - public static final BigInteger P_BN_LO = - new BigInteger("201385395114098847380338600778089168199"); - public static final BigInteger SECP256K1N_HI = - new BigInteger("340282366920938463463374607431768211455"); - public static final BigInteger SECP256K1N_LO = - new BigInteger("340282366920938463463374607427473243183"); + public static final BigInteger P_BN_LO = new BigInteger("201385395114098847380338600778089168199"); + public static final BigInteger SECP256K1N_HI = new BigInteger("340282366920938463463374607431768211455"); + public static final BigInteger SECP256K1N_LO = new BigInteger("340282366920938463463374607427473243183"); public static final int TOTAL_SIZE_ECADD_DATA = 0x80; public static final int TOTAL_SIZE_ECADD_RESULT = 0x40; public static final int TOTAL_SIZE_ECMUL_DATA = 0x60; @@ -123,66 +120,65 @@ public class Trace { private final MappedByteBuffer wcpRes; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("ecdata.ACC_PAIRINGS", 2, length)); - headers.add( - new ColumnHeader("ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT", 1, length)); - headers.add(new ColumnHeader("ecdata.BYTE_DELTA", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECADD", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECMUL", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECPAIRING", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECRECOVER", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_G2_MEMBERSHIP", 1, length)); - headers.add(new ColumnHeader("ecdata.CT", 1, length)); - headers.add(new ColumnHeader("ecdata.CT_MAX", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG1_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG2_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG3_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG3_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_FLAG", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_INST", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_RES_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_RES_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.G2_MEMBERSHIP_TEST_REQUIRED", 1, length)); - headers.add(new ColumnHeader("ecdata.HURDLE", 1, length)); - headers.add(new ColumnHeader("ecdata.ID", 4, length)); - headers.add(new ColumnHeader("ecdata.INDEX", 2, length)); - headers.add(new ColumnHeader("ecdata.INDEX_MAX", 2, length)); - headers.add(new ColumnHeader("ecdata.INTERNAL_CHECKS_PASSED", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECADD_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECADD_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECMUL_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECMUL_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_INFINITY", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_LARGE_POINT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_SMALL_POINT", 1, length)); - headers.add(new ColumnHeader("ecdata.LIMB", 16, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2", 1, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC", 1, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC_MAX", 1, length)); - headers.add(new ColumnHeader("ecdata.OVERALL_TRIVIAL_PAIRING", 1, length)); - headers.add(new ColumnHeader("ecdata.PHASE", 2, length)); - headers.add(new ColumnHeader("ecdata.STAMP", 4, length)); - headers.add(new ColumnHeader("ecdata.SUCCESS_BIT", 1, length)); - headers.add(new ColumnHeader("ecdata.TOTAL_PAIRINGS", 2, length)); - headers.add(new ColumnHeader("ecdata.TOTAL_SIZE", 2, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG1_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG2_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("ecdata.WCP_INST", 1, length)); - headers.add(new ColumnHeader("ecdata.WCP_RES", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("ecdata.ACC_PAIRINGS", 2, length)); + headers.add(new ColumnHeader("ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT", 1, length)); + headers.add(new ColumnHeader("ecdata.BYTE_DELTA", 1, length)); + headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECADD", 1, length)); + headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECMUL", 1, length)); + headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECPAIRING", 1, length)); + headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECRECOVER", 1, length)); + headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_G2_MEMBERSHIP", 1, length)); + headers.add(new ColumnHeader("ecdata.CT", 1, length)); + headers.add(new ColumnHeader("ecdata.CT_MAX", 1, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG1_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG1_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG2_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG2_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG3_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_ARG3_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_FLAG", 1, length)); + headers.add(new ColumnHeader("ecdata.EXT_INST", 1, length)); + headers.add(new ColumnHeader("ecdata.EXT_RES_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.EXT_RES_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.G2_MEMBERSHIP_TEST_REQUIRED", 1, length)); + headers.add(new ColumnHeader("ecdata.HURDLE", 1, length)); + headers.add(new ColumnHeader("ecdata.ID", 4, length)); + headers.add(new ColumnHeader("ecdata.INDEX", 2, length)); + headers.add(new ColumnHeader("ecdata.INDEX_MAX", 2, length)); + headers.add(new ColumnHeader("ecdata.INTERNAL_CHECKS_PASSED", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECADD_DATA", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECADD_RESULT", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECMUL_DATA", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECMUL_RESULT", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_DATA", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_RESULT", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_DATA", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_RESULT", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_INFINITY", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_LARGE_POINT", 1, length)); + headers.add(new ColumnHeader("ecdata.IS_SMALL_POINT", 1, length)); + headers.add(new ColumnHeader("ecdata.LIMB", 16, length)); + headers.add(new ColumnHeader("ecdata.NOT_ON_G2", 1, length)); + headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC", 1, length)); + headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC_MAX", 1, length)); + headers.add(new ColumnHeader("ecdata.OVERALL_TRIVIAL_PAIRING", 1, length)); + headers.add(new ColumnHeader("ecdata.PHASE", 2, length)); + headers.add(new ColumnHeader("ecdata.STAMP", 4, length)); + headers.add(new ColumnHeader("ecdata.SUCCESS_BIT", 1, length)); + headers.add(new ColumnHeader("ecdata.TOTAL_PAIRINGS", 2, length)); + headers.add(new ColumnHeader("ecdata.TOTAL_SIZE", 2, length)); + headers.add(new ColumnHeader("ecdata.WCP_ARG1_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.WCP_ARG1_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.WCP_ARG2_HI", 16, length)); + headers.add(new ColumnHeader("ecdata.WCP_ARG2_LO", 16, length)); + headers.add(new ColumnHeader("ecdata.WCP_FLAG", 1, length)); + headers.add(new ColumnHeader("ecdata.WCP_INST", 1, length)); + headers.add(new ColumnHeader("ecdata.WCP_RES", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.accPairings = buffers.get(0); this.acceptablePairOfPointsForPairingCircuit = buffers.get(1); this.byteDelta = buffers.get(2); @@ -254,19 +250,17 @@ public Trace accPairings(final long b) { filled.set(1); } - if (b >= 65536L) { - throw new IllegalArgumentException("ecdata.ACC_PAIRINGS has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.ACC_PAIRINGS has invalid value (" + b + ")"); } accPairings.put((byte) (b >> 8)); accPairings.put((byte) b); + return this; } public Trace acceptablePairOfPointsForPairingCircuit(final Boolean b) { if (filled.get(0)) { - throw new IllegalStateException( - "ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT already set"); + throw new IllegalStateException("ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT already set"); } else { filled.set(0); } @@ -355,11 +349,10 @@ public Trace ct(final long b) { filled.set(8); } - if (b >= 8L) { - throw new IllegalArgumentException("ecdata.CT has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("ecdata.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -370,11 +363,10 @@ public Trace ctMax(final long b) { filled.set(9); } - if (b >= 8L) { - throw new IllegalArgumentException("ecdata.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("ecdata.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -388,18 +380,11 @@ public Trace extArg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG3_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG3_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg3Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg3Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg3Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_ARG3_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG3_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extArg3Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extArg3Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extArg3Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extResHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extResHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extResHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.EXT_RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - extResLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { extResLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - extResLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("ecdata.ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("ecdata.ID has invalid value (" + b + ")"); } id.put((byte) (b >> 24)); id.put((byte) (b >> 16)); id.put((byte) (b >> 8)); id.put((byte) b); + return this; } @@ -659,12 +594,11 @@ public Trace index(final long b) { filled.set(23); } - if (b >= 65536L) { - throw new IllegalArgumentException("ecdata.INDEX has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.INDEX has invalid value (" + b + ")"); } index.put((byte) (b >> 8)); index.put((byte) b); + return this; } @@ -675,12 +609,11 @@ public Trace indexMax(final long b) { filled.set(24); } - if (b >= 65536L) { - throw new IllegalArgumentException("ecdata.INDEX_MAX has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.INDEX_MAX has invalid value (" + b + ")"); } indexMax.put((byte) (b >> 8)); indexMax.put((byte) b); + return this; } @@ -838,18 +771,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "ecdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("ecdata.PHASE has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.PHASE has invalid value (" + b + ")"); } phase.put((byte) (b >> 8)); phase.put((byte) b); + return this; } @@ -925,14 +850,13 @@ public Trace stamp(final long b) { filled.set(43); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("ecdata.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("ecdata.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -955,12 +879,11 @@ public Trace totalPairings(final long b) { filled.set(45); } - if (b >= 65536L) { - throw new IllegalArgumentException("ecdata.TOTAL_PAIRINGS has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.TOTAL_PAIRINGS has invalid value (" + b + ")"); } totalPairings.put((byte) (b >> 8)); totalPairings.put((byte) b); + return this; } @@ -971,12 +894,11 @@ public Trace totalSize(final long b) { filled.set(46); } - if (b >= 65536L) { - throw new IllegalArgumentException("ecdata.TOTAL_SIZE has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("ecdata.TOTAL_SIZE has invalid value (" + b + ")"); } totalSize.put((byte) (b >> 8)); totalSize.put((byte) b); + return this; } @@ -990,18 +912,11 @@ public Trace wcpArg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "ecdata.WCP_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.WCP_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.WCP_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.WCP_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ecdata.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("euc.CEIL", 8, length)); - headers.add(new ColumnHeader("euc.CT", 1, length)); - headers.add(new ColumnHeader("euc.CT_MAX", 1, length)); - headers.add(new ColumnHeader("euc.DIVIDEND", 8, length)); - headers.add(new ColumnHeader("euc.DIVISOR", 8, length)); - headers.add(new ColumnHeader("euc.DIVISOR_BYTE", 1, length)); - headers.add(new ColumnHeader("euc.DONE", 1, length)); - headers.add(new ColumnHeader("euc.IOMF", 1, length)); - headers.add(new ColumnHeader("euc.QUOTIENT", 8, length)); - headers.add(new ColumnHeader("euc.QUOTIENT_BYTE", 1, length)); - headers.add(new ColumnHeader("euc.REMAINDER", 8, length)); - headers.add(new ColumnHeader("euc.REMAINDER_BYTE", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("euc.CEIL", 8, length)); + headers.add(new ColumnHeader("euc.CT", 1, length)); + headers.add(new ColumnHeader("euc.CT_MAX", 1, length)); + headers.add(new ColumnHeader("euc.DIVIDEND", 8, length)); + headers.add(new ColumnHeader("euc.DIVISOR", 8, length)); + headers.add(new ColumnHeader("euc.DIVISOR_BYTE", 1, length)); + headers.add(new ColumnHeader("euc.DONE", 1, length)); + headers.add(new ColumnHeader("euc.IOMF", 1, length)); + headers.add(new ColumnHeader("euc.QUOTIENT", 8, length)); + headers.add(new ColumnHeader("euc.QUOTIENT_BYTE", 1, length)); + headers.add(new ColumnHeader("euc.REMAINDER", 8, length)); + headers.add(new ColumnHeader("euc.REMAINDER_BYTE", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.ceil = buffers.get(0); this.ct = buffers.get(1); this.ctMax = buffers.get(2); @@ -98,17 +99,11 @@ public Trace ceil(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException("euc.CEIL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.CEIL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - ceil.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { ceil.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - ceil.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("euc.CT has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("euc.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -135,11 +129,10 @@ public Trace ctMax(final long b) { filled.set(2); } - if (b >= 256L) { - throw new IllegalArgumentException("euc.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("euc.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -153,18 +146,11 @@ public Trace dividend(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "euc.DIVIDEND has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.DIVIDEND has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - dividend.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { dividend.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dividend.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "euc.DIVISOR has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.DIVISOR has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - divisor.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { divisor.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - divisor.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "euc.QUOTIENT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.QUOTIENT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - quotient.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { quotient.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - quotient.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "euc.REMAINDER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.REMAINDER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - remainder.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { remainder.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - remainder.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("exp.CMPTN", 1, length)); - headers.add(new ColumnHeader("exp.CT", 1, length)); - headers.add(new ColumnHeader("exp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("exp.DATA_3_xor_WCP_ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("exp.DATA_4_xor_WCP_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("exp.DATA_5", 16, length)); - headers.add(new ColumnHeader("exp.EXP_INST", 2, length)); - headers.add(new ColumnHeader("exp.IS_EXP_LOG", 1, length)); - headers.add(new ColumnHeader("exp.IS_MODEXP_LOG", 1, length)); - headers.add(new ColumnHeader("exp.MACRO", 1, length)); - headers.add(new ColumnHeader("exp.MANZB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.MANZB_xor_WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("exp.MSB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.MSB_BIT_xor_WCP_RES", 1, length)); - headers.add(new ColumnHeader("exp.MSB_xor_WCP_INST", 1, length)); - headers.add(new ColumnHeader("exp.PLT_BIT", 1, length)); - headers.add(new ColumnHeader("exp.PLT_JMP", 1, length)); - headers.add(new ColumnHeader("exp.PRPRC", 1, length)); - headers.add(new ColumnHeader("exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("exp.RAW_BYTE", 1, length)); - headers.add(new ColumnHeader("exp.STAMP", 4, length)); - headers.add(new ColumnHeader("exp.TANZB", 1, length)); - headers.add(new ColumnHeader("exp.TANZB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("exp.TRIM_BYTE", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("exp.CMPTN", 1, length)); + headers.add(new ColumnHeader("exp.CT", 1, length)); + headers.add(new ColumnHeader("exp.CT_MAX", 1, length)); + headers.add(new ColumnHeader("exp.DATA_3_xor_WCP_ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("exp.DATA_4_xor_WCP_ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("exp.DATA_5", 16, length)); + headers.add(new ColumnHeader("exp.EXP_INST", 2, length)); + headers.add(new ColumnHeader("exp.IS_EXP_LOG", 1, length)); + headers.add(new ColumnHeader("exp.IS_MODEXP_LOG", 1, length)); + headers.add(new ColumnHeader("exp.MACRO", 1, length)); + headers.add(new ColumnHeader("exp.MANZB_ACC", 1, length)); + headers.add(new ColumnHeader("exp.MANZB_xor_WCP_FLAG", 1, length)); + headers.add(new ColumnHeader("exp.MSB_ACC", 1, length)); + headers.add(new ColumnHeader("exp.MSB_BIT_xor_WCP_RES", 1, length)); + headers.add(new ColumnHeader("exp.MSB_xor_WCP_INST", 1, length)); + headers.add(new ColumnHeader("exp.PLT_BIT", 1, length)); + headers.add(new ColumnHeader("exp.PLT_JMP", 1, length)); + headers.add(new ColumnHeader("exp.PRPRC", 1, length)); + headers.add(new ColumnHeader("exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("exp.RAW_BYTE", 1, length)); + headers.add(new ColumnHeader("exp.STAMP", 4, length)); + headers.add(new ColumnHeader("exp.TANZB", 1, length)); + headers.add(new ColumnHeader("exp.TANZB_ACC", 1, length)); + headers.add(new ColumnHeader("exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("exp.TRIM_BYTE", 1, length)); + return headers; + } + + public Trace (List buffers) { this.cmptn = buffers.get(0); this.ct = buffers.get(1); this.ctMax = buffers.get(2); @@ -152,11 +153,10 @@ public Trace ct(final long b) { filled.set(1); } - if (b >= 16L) { - throw new IllegalArgumentException("exp.CT has invalid value (" + b + ")"); - } + if(b >= 16L) { throw new IllegalArgumentException("exp.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -167,11 +167,10 @@ public Trace ctMax(final long b) { filled.set(2); } - if (b >= 16L) { - throw new IllegalArgumentException("exp.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 16L) { throw new IllegalArgumentException("exp.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -230,11 +229,10 @@ public Trace pComputationManzbAcc(final long b) { filled.set(16); } - if (b >= 16L) { - throw new IllegalArgumentException("exp.computation/MANZB_ACC has invalid value (" + b + ")"); - } + if(b >= 16L) { throw new IllegalArgumentException("exp.computation/MANZB_ACC has invalid value (" + b + ")"); } manzbAcc.put((byte) b); + return this; } @@ -293,11 +291,10 @@ public Trace pComputationPltJmp(final long b) { filled.set(18); } - if (b >= 64L) { - throw new IllegalArgumentException("exp.computation/PLT_JMP has invalid value (" + b + ")"); - } + if(b >= 64L) { throw new IllegalArgumentException("exp.computation/PLT_JMP has invalid value (" + b + ")"); } pltJmp.put((byte) b); + return this; } @@ -311,18 +308,11 @@ public Trace pComputationRawAcc(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "exp.computation/RAW_ACC has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.computation/RAW_ACC has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAccXorData1XorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAccXorData1XorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j= 32L) { - throw new IllegalArgumentException("exp.computation/TANZB_ACC has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("exp.computation/TANZB_ACC has invalid value (" + b + ")"); } tanzbAcc.put((byte) b); + return this; } @@ -376,18 +365,11 @@ public Trace pComputationTrimAcc(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "exp.computation/TRIM_ACC has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.computation/TRIM_ACC has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trimAccXorData2XorWcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trimAccXorData2XorWcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.macro/DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.macro/DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAccXorData1XorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAccXorData1XorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.macro/DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.macro/DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trimAccXorData2XorWcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trimAccXorData2XorWcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.macro/DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.macro/DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data3XorWcpArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data3XorWcpArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data3XorWcpArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.macro/DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.macro/DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data4XorWcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data4XorWcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data4XorWcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.macro/DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.macro/DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data5.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("exp.macro/EXP_INST has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("exp.macro/EXP_INST has invalid value (" + b + ")"); } expInst.put((byte) (b >> 8)); expInst.put((byte) b); + return this; } @@ -560,18 +506,11 @@ public Trace pPreprocessingWcpArg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "exp.preprocessing/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAccXorData1XorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAccXorData1XorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.preprocessing/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trimAccXorData2XorWcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trimAccXorData2XorWcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.preprocessing/WCP_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data3XorWcpArg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data3XorWcpArg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data3XorWcpArg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "exp.preprocessing/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data4XorWcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data4XorWcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data4XorWcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("exp.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("exp.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -794,8 +711,7 @@ public Trace validateRow() { } if (!filled.get(20)) { - throw new IllegalStateException( - "exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI has not been filled"); + throw new IllegalStateException("exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI has not been filled"); } if (!filled.get(14)) { @@ -815,8 +731,7 @@ public Trace validateRow() { } if (!filled.get(21)) { - throw new IllegalStateException( - "exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO has not been filled"); + throw new IllegalStateException("exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO has not been filled"); } if (!filled.get(15)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java index 6dc6743ee..30ccb5517 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.ext; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -155,129 +156,129 @@ public class Trace { private final MappedByteBuffer stamp; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("ext.ACC_A_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_7", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_7", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_3", 8, length)); - headers.add(new ColumnHeader("ext.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("ext.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("ext.ARG_3_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_3_LO", 16, length)); - headers.add(new ColumnHeader("ext.BIT_1", 1, length)); - headers.add(new ColumnHeader("ext.BIT_2", 1, length)); - headers.add(new ColumnHeader("ext.BIT_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_7", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_7", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_3", 1, length)); - headers.add(new ColumnHeader("ext.CMP", 1, length)); - headers.add(new ColumnHeader("ext.CT", 1, length)); - headers.add(new ColumnHeader("ext.INST", 1, length)); - headers.add(new ColumnHeader("ext.OF_H", 1, length)); - headers.add(new ColumnHeader("ext.OF_I", 1, length)); - headers.add(new ColumnHeader("ext.OF_J", 1, length)); - headers.add(new ColumnHeader("ext.OF_RES", 1, length)); - headers.add(new ColumnHeader("ext.OLI", 1, length)); - headers.add(new ColumnHeader("ext.RES_HI", 16, length)); - headers.add(new ColumnHeader("ext.RES_LO", 16, length)); - headers.add(new ColumnHeader("ext.STAMP", 4, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("ext.ACC_A_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_A_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_A_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_A_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_B_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_B_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_B_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_B_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_C_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_C_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_C_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_C_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_DELTA_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_DELTA_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_DELTA_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_DELTA_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_4", 8, length)); + headers.add(new ColumnHeader("ext.ACC_H_5", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_4", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_5", 8, length)); + headers.add(new ColumnHeader("ext.ACC_I_6", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_4", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_5", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_6", 8, length)); + headers.add(new ColumnHeader("ext.ACC_J_7", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_3", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_4", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_5", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_6", 8, length)); + headers.add(new ColumnHeader("ext.ACC_Q_7", 8, length)); + headers.add(new ColumnHeader("ext.ACC_R_0", 8, length)); + headers.add(new ColumnHeader("ext.ACC_R_1", 8, length)); + headers.add(new ColumnHeader("ext.ACC_R_2", 8, length)); + headers.add(new ColumnHeader("ext.ACC_R_3", 8, length)); + headers.add(new ColumnHeader("ext.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("ext.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("ext.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("ext.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("ext.ARG_3_HI", 16, length)); + headers.add(new ColumnHeader("ext.ARG_3_LO", 16, length)); + headers.add(new ColumnHeader("ext.BIT_1", 1, length)); + headers.add(new ColumnHeader("ext.BIT_2", 1, length)); + headers.add(new ColumnHeader("ext.BIT_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_A_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_A_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_A_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_A_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_B_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_B_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_B_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_B_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_C_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_C_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_C_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_C_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_DELTA_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_DELTA_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_DELTA_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_DELTA_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_4", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_H_5", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_4", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_5", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_I_6", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_4", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_5", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_6", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_J_7", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_3", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_4", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_5", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_6", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_Q_7", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_R_0", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_R_1", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_R_2", 1, length)); + headers.add(new ColumnHeader("ext.BYTE_R_3", 1, length)); + headers.add(new ColumnHeader("ext.CMP", 1, length)); + headers.add(new ColumnHeader("ext.CT", 1, length)); + headers.add(new ColumnHeader("ext.INST", 1, length)); + headers.add(new ColumnHeader("ext.OF_H", 1, length)); + headers.add(new ColumnHeader("ext.OF_I", 1, length)); + headers.add(new ColumnHeader("ext.OF_J", 1, length)); + headers.add(new ColumnHeader("ext.OF_RES", 1, length)); + headers.add(new ColumnHeader("ext.OLI", 1, length)); + headers.add(new ColumnHeader("ext.RES_HI", 16, length)); + headers.add(new ColumnHeader("ext.RES_LO", 16, length)); + headers.add(new ColumnHeader("ext.STAMP", 4, length)); + return headers; + } + + public Trace (List buffers) { this.accA0 = buffers.get(0); this.accA1 = buffers.get(1); this.accA2 = buffers.get(2); @@ -416,18 +417,11 @@ public Trace accA0(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "ext.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH4.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH4.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_H_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_H_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH5.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH5.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI4.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI4.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI5.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI5.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_I_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_I_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accI6.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accI6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accI6.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ4.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ4.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ5.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ5.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ6.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ6.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_J_7 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_J_7 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accJ7.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accJ7.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accJ7.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ4.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ4.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ5.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ5.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ6.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ6.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_Q_7 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_Q_7 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ7.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ7.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ7.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "ext.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_3_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_3_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg3Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg3Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg3Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.ARG_3_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.ARG_3_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg3Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg3Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg3Lo.put(bs.get(j)); - } + for(int j=0; j= 8L) { - throw new IllegalArgumentException("ext.CT has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("ext.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -2569,18 +2184,11 @@ public Trace resHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "ext.RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "ext.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("ext.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("ext.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java index 29f547a66..f56762d10 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.gas; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -49,23 +50,23 @@ public class Trace { private final MappedByteBuffer wcpRes; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("gas.CT", 1, length)); - headers.add(new ColumnHeader("gas.CT_MAX", 1, length)); - headers.add(new ColumnHeader("gas.EXCEPTIONS_AHOY", 1, length)); - headers.add(new ColumnHeader("gas.FIRST", 1, length)); - headers.add(new ColumnHeader("gas.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("gas.GAS_COST", 8, length)); - headers.add(new ColumnHeader("gas.INPUTS_AND_OUTPUTS_ARE_MEANINGFUL", 1, length)); - headers.add(new ColumnHeader("gas.OUT_OF_GAS_EXCEPTION", 1, length)); - headers.add(new ColumnHeader("gas.WCP_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("gas.WCP_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("gas.WCP_INST", 1, length)); - headers.add(new ColumnHeader("gas.WCP_RES", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("gas.CT", 1, length)); + headers.add(new ColumnHeader("gas.CT_MAX", 1, length)); + headers.add(new ColumnHeader("gas.EXCEPTIONS_AHOY", 1, length)); + headers.add(new ColumnHeader("gas.FIRST", 1, length)); + headers.add(new ColumnHeader("gas.GAS_ACTUAL", 8, length)); + headers.add(new ColumnHeader("gas.GAS_COST", 8, length)); + headers.add(new ColumnHeader("gas.INPUTS_AND_OUTPUTS_ARE_MEANINGFUL", 1, length)); + headers.add(new ColumnHeader("gas.OUT_OF_GAS_EXCEPTION", 1, length)); + headers.add(new ColumnHeader("gas.WCP_ARG1_LO", 16, length)); + headers.add(new ColumnHeader("gas.WCP_ARG2_LO", 16, length)); + headers.add(new ColumnHeader("gas.WCP_INST", 1, length)); + headers.add(new ColumnHeader("gas.WCP_RES", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.ct = buffers.get(0); this.ctMax = buffers.get(1); this.exceptionsAhoy = buffers.get(2); @@ -95,11 +96,10 @@ public Trace ct(final long b) { filled.set(0); } - if (b >= 8L) { - throw new IllegalArgumentException("gas.CT has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("gas.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -110,11 +110,10 @@ public Trace ctMax(final long b) { filled.set(1); } - if (b >= 8L) { - throw new IllegalArgumentException("gas.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("gas.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -152,18 +151,11 @@ public Trace gasActual(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "gas.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("gas.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasActual.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasActual.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "gas.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("gas.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasCost.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasCost.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasCost.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "gas.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("gas.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "gas.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("gas.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - wcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { wcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("hub.ABSOLUTE_TRANSACTION_NUMBER", 2, length)); - headers.add( - new ColumnHeader( - "hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2", - 1, - length)); - headers.add(new ColumnHeader("hub.ALPHA", 1, length)); - headers.add( - new ColumnHeader( - "hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO", - 16, - length)); - headers.add(new ColumnHeader("hub.CALL_DATA_OFFSET_xor_MMU_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID", 4, length)); - headers.add(new ColumnHeader("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1", 2, length)); - headers.add(new ColumnHeader("hub.CALLER_CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX", 4, length)); - headers.add( - new ColumnHeader( - "hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI", - 4, - length)); - headers.add(new ColumnHeader("hub.CONTEXT_GETS_REVERTED", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_MAY_CHANGE", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_REVERT_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_SELF_REVERTS", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_WILL_REVERT", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_NSR", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_TLI", 1, length)); - headers.add(new ColumnHeader("hub.DELTA", 1, length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK", - 2, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK", - 2, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET", 4, length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI", - 4, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION", - 1, - length)); - headers.add(new ColumnHeader("hub.DOM_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.EXCEPTION_AHOY", 1, length)); - headers.add( - new ColumnHeader( - "hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG", - 1, - length)); - headers.add(new ColumnHeader("hub.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("hub.GAS_COST", 8, length)); - headers.add(new ColumnHeader("hub.GAS_EXPECTED", 8, length)); - headers.add(new ColumnHeader("hub.GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_NEXT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_PRICE", 8, length)); - headers.add( - new ColumnHeader( - "hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO", - 1, - length)); - headers.add(new ColumnHeader("hub.HEIGHT", 2, length)); - headers.add(new ColumnHeader("hub.HEIGHT_NEW", 2, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP_TRANSACTION_END", 4, length)); - headers.add(new ColumnHeader("hub.INSTRUCTION", 32, length)); - headers.add( - new ColumnHeader( - "hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH", - 1, - length)); - headers.add(new ColumnHeader("hub.LOG_INFO_STAMP", 4, length)); - headers.add( - new ColumnHeader( - "hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW", - 1, - length)); - headers.add(new ColumnHeader("hub.MMU_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_WORDS", 16, length)); - headers.add(new ColumnHeader("hub.NON_STACK_ROWS", 1, length)); - headers.add(new ColumnHeader("hub.NONCE", 8, length)); - headers.add( - new ColumnHeader( - "hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE", - 8, - length)); - headers.add( - new ColumnHeader("hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE", 8, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_1", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_2", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_3", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_4", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_5", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_6", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_7", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_8", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_9", 16, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_ACCOUNT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_CONTEXT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_MISCELLANEOUS", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_SCENARIO", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STACK", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STORAGE", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_TRANSACTION", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECPAIRING_xor_MAXCSX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECRECOVER_xor_MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_IDENTITY_xor_MXP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_MODEXP_xor_OOGX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_RIPEMD-160_xor_OPCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRIORITY_FEE_PER_GAS", 8, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_INFINITY", 8, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_EFFECTIVE", 8, length)); - headers.add(new ColumnHeader("hub.RELATIVE_BLOCK_NUMBER", 2, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_CAPACITY_xor_MXP_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_OFFSET_xor_OOB_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_EXCEPTION_xor_SOX", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3", 1, length)); - headers.add( - new ColumnHeader( - "hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4", 1, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE", 4, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED", - 1, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO", - 16, - length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_RECIPE", 1, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3", 16, length)); - headers.add( - new ColumnHeader( - "hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4", 16, length)); - headers.add( - new ColumnHeader( - "hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG", - 1, - length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG", 1, length)); - headers.add( - new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX", 1, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_2", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_3", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_4", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_1", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_2", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_3", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_4", 5, length)); - headers.add(new ColumnHeader("hub.STP_GAS_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_GAS_LO", 16, length)); - headers.add( - new ColumnHeader( - "hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER", 8, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_LO", 16, length)); - headers.add(new ColumnHeader("hub.SUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.SWAP_FLAG", 1, length)); - headers.add( - new ColumnHeader( - "hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG", - 1, - length)); - headers.add(new ColumnHeader("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.TWO_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("hub.TX_EXEC", 1, length)); - headers.add(new ColumnHeader("hub.TX_FINL", 1, length)); - headers.add(new ColumnHeader("hub.TX_INIT", 1, length)); - headers.add(new ColumnHeader("hub.TX_SKIP", 1, length)); - headers.add(new ColumnHeader("hub.TX_WARM", 1, length)); - headers.add(new ColumnHeader("hub.TXN_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WCP_FLAG", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("hub.ABSOLUTE_TRANSACTION_NUMBER", 2, length)); + headers.add(new ColumnHeader("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD", 1, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT", 1, length)); + headers.add(new ColumnHeader("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2", 1, length)); + headers.add(new ColumnHeader("hub.ALPHA", 1, length)); + headers.add(new ColumnHeader("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE", 16, length)); + headers.add(new ColumnHeader("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.CALL_DATA_OFFSET_xor_MMU_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID", 4, length)); + headers.add(new ColumnHeader("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1", 2, length)); + headers.add(new ColumnHeader("hub.CALLER_CONTEXT_NUMBER", 4, length)); + headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO", 16, length)); + headers.add(new ColumnHeader("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI", 16, length)); + headers.add(new ColumnHeader("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_GETS_REVERTED", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_MAY_CHANGE", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_REVERT_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.CONTEXT_SELF_REVERTS", 1, length)); + headers.add(new ColumnHeader("hub.CONTEXT_WILL_REVERT", 1, length)); + headers.add(new ColumnHeader("hub.COUNTER_NSR", 1, length)); + headers.add(new ColumnHeader("hub.COUNTER_TLI", 1, length)); + headers.add(new ColumnHeader("hub.DELTA", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK", 2, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK", 2, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN", 1, length)); + headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION", 1, length)); + headers.add(new ColumnHeader("hub.DOM_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.EXCEPTION_AHOY", 1, length)); + headers.add(new ColumnHeader("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF", 1, length)); + headers.add(new ColumnHeader("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES", 1, length)); + headers.add(new ColumnHeader("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR", 1, length)); + headers.add(new ColumnHeader("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG", 1, length)); + headers.add(new ColumnHeader("hub.GAS_ACTUAL", 8, length)); + headers.add(new ColumnHeader("hub.GAS_COST", 8, length)); + headers.add(new ColumnHeader("hub.GAS_EXPECTED", 8, length)); + headers.add(new ColumnHeader("hub.GAS_LIMIT", 8, length)); + headers.add(new ColumnHeader("hub.GAS_NEXT", 8, length)); + headers.add(new ColumnHeader("hub.GAS_PRICE", 8, length)); + headers.add(new ColumnHeader("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO", 1, length)); + headers.add(new ColumnHeader("hub.HEIGHT", 2, length)); + headers.add(new ColumnHeader("hub.HEIGHT_NEW", 2, length)); + headers.add(new ColumnHeader("hub.HUB_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.HUB_STAMP_TRANSACTION_END", 4, length)); + headers.add(new ColumnHeader("hub.INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH", 1, length)); + headers.add(new ColumnHeader("hub.LOG_INFO_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX", 1, length)); + headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW", 1, length)); + headers.add(new ColumnHeader("hub.MMU_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MXP_OFFSET_2_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_OFFSET_2_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_1_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_1_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_2_HI", 16, length)); + headers.add(new ColumnHeader("hub.MXP_SIZE_2_LO", 16, length)); + headers.add(new ColumnHeader("hub.MXP_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.MXP_WORDS", 16, length)); + headers.add(new ColumnHeader("hub.NON_STACK_ROWS", 1, length)); + headers.add(new ColumnHeader("hub.NONCE", 8, length)); + headers.add(new ColumnHeader("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE", 8, length)); + headers.add(new ColumnHeader("hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE", 8, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_1", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_2", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_3", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_4", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_5", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_6", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_7", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_8", 16, length)); + headers.add(new ColumnHeader("hub.OOB_DATA_9", 16, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_ACCOUNT", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_CONTEXT", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_MISCELLANEOUS", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_SCENARIO", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_STACK", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_STORAGE", 1, length)); + headers.add(new ColumnHeader("hub.PEEK_AT_TRANSACTION", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECPAIRING_xor_MAXCSX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_ECRECOVER_xor_MOD_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_IDENTITY_xor_MXP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_MODEXP_xor_OOGX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_RIPEMD-160_xor_OPCX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX", 1, length)); + headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.PRIORITY_FEE_PER_GAS", 8, length)); + headers.add(new ColumnHeader("hub.PROGRAM_COUNTER", 4, length)); + headers.add(new ColumnHeader("hub.PROGRAM_COUNTER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER_INFINITY", 8, length)); + headers.add(new ColumnHeader("hub.REFUND_COUNTER_NEW", 4, length)); + headers.add(new ColumnHeader("hub.REFUND_EFFECTIVE", 8, length)); + headers.add(new ColumnHeader("hub.RELATIVE_BLOCK_NUMBER", 2, length)); + headers.add(new ColumnHeader("hub.RETURN_AT_CAPACITY_xor_MXP_INST", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_AT_OFFSET_xor_OOB_INST", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.RETURN_EXCEPTION_xor_SOX", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3", 1, length)); + headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE", 4, length)); + headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_RECIPE", 1, length)); + headers.add(new ColumnHeader("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3", 16, length)); + headers.add(new ColumnHeader("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4", 16, length)); + headers.add(new ColumnHeader("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX", 1, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_2", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_3", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_4", 2, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_1", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_2", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_3", 5, length)); + headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_4", 5, length)); + headers.add(new ColumnHeader("hub.STP_GAS_HI", 16, length)); + headers.add(new ColumnHeader("hub.STP_GAS_LO", 16, length)); + headers.add(new ColumnHeader("hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER", 8, length)); + headers.add(new ColumnHeader("hub.STP_VALUE_HI", 16, length)); + headers.add(new ColumnHeader("hub.STP_VALUE_LO", 16, length)); + headers.add(new ColumnHeader("hub.SUB_STAMP", 4, length)); + headers.add(new ColumnHeader("hub.SWAP_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO", 16, length)); + headers.add(new ColumnHeader("hub.TWO_LINE_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("hub.TX_EXEC", 1, length)); + headers.add(new ColumnHeader("hub.TX_FINL", 1, length)); + headers.add(new ColumnHeader("hub.TX_INIT", 1, length)); + headers.add(new ColumnHeader("hub.TX_SKIP", 1, length)); + headers.add(new ColumnHeader("hub.TX_WARM", 1, length)); + headers.add(new ColumnHeader("hub.TXN_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG", 1, length)); + headers.add(new ColumnHeader("hub.WCP_FLAG", 1, length)); + return headers; + } + + public Trace (List buffers) { this.absoluteTransactionNumber = buffers.get(0); - this.addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize = - buffers.get(1); - this - .addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo = - buffers.get(2); - this.againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd = - buffers.get(3); - this - .againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment = - buffers.get(4); - this - .againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 = - buffers.get(5); + this.addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize = buffers.get(1); + this.addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo = buffers.get(2); + this.againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd = buffers.get(3); + this.againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment = buffers.get(4); + this.againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 = buffers.get(5); this.alpha = buffers.get(6); - this.balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance = - buffers.get(7); - this.balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo = - buffers.get(8); + this.balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance = buffers.get(7); + this.balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo = buffers.get(8); this.callDataOffsetXorMmuSize = buffers.get(9); this.callDataSizeXorMmuSrcId = buffers.get(10); this.callStackDepthXorStackItemHeight1 = buffers.get(11); this.callerContextNumber = buffers.get(12); this.codeFragmentIndex = buffers.get(13); - this - .codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi = - buffers.get(14); + this.codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi = buffers.get(14); this.codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue = buffers.get(15); - this.codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo = - buffers.get(16); + this.codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo = buffers.get(16); this.codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo = buffers.get(17); this.codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi = buffers.get(18); - this.codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize = - buffers.get(19); - this.codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi = - buffers.get(20); + this.codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize = buffers.get(19); + this.codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi = buffers.get(20); this.contextGetsReverted = buffers.get(21); this.contextMayChange = buffers.get(22); this.contextNumber = buffers.get(23); @@ -649,31 +417,19 @@ public Trace(List buffers) { this.deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase = buffers.get(34); this.deploymentNumberNewXorCallerAddressHiXorMmuRefOffset = buffers.get(35); this.deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi = buffers.get(36); - this.deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode = - buffers.get(37); + this.deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode = buffers.get(37); this.deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn = buffers.get(38); - this - .deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution = - buffers.get(39); + this.deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution = buffers.get(39); this.domStamp = buffers.get(40); this.exceptionAhoy = buffers.get(41); - this.existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf = - buffers.get(42); - this.existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk = - buffers.get(43); - this - .finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn = - buffers.get(44); - this - .finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges = - buffers.get(45); - this.finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig = - buffers.get(46); - this.firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero = - buffers.get(47); + this.existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf = buffers.get(42); + this.existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk = buffers.get(43); + this.finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn = buffers.get(44); + this.finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges = buffers.get(45); + this.finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig = buffers.get(46); + this.firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero = buffers.get(47); this.firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr = buffers.get(48); - this.firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig = - buffers.get(49); + this.firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig = buffers.get(49); this.gasActual = buffers.get(50); this.gasCost = buffers.get(51); this.gasExpected = buffers.get(52); @@ -681,8 +437,7 @@ public Trace(List buffers) { this.gasNext = buffers.get(54); this.gasPrice = buffers.get(55); this.hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero = buffers.get(56); - this.hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero = - buffers.get(57); + this.hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero = buffers.get(57); this.height = buffers.get(58); this.heightNew = buffers.get(59); this.hubStamp = buffers.get(60); @@ -690,10 +445,8 @@ public Trace(List buffers) { this.instruction = buffers.get(62); this.isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth = buffers.get(63); this.logInfoStamp = buffers.get(64); - this.markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx = - buffers.get(65); - this.markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew = - buffers.get(66); + this.markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx = buffers.get(65); + this.markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew = buffers.get(66); this.mmuStamp = buffers.get(67); this.mxpOffset2Hi = buffers.get(68); this.mxpOffset2Lo = buffers.get(69); @@ -756,8 +509,7 @@ public Trace(List buffers) { this.returnFromMessageCallWontTouchRamXorStackItemPop4 = buffers.get(126); this.rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize = buffers.get(127); this.rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi = buffers.get(128); - this.rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired = - buffers.get(129); + this.rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired = buffers.get(129); this.rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo = buffers.get(130); this.rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2 = buffers.get(131); this.rlpaddrRecipe = buffers.get(132); @@ -811,13 +563,11 @@ public Trace absoluteTransactionNumber(final long b) { filled.set(0); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.ABSOLUTE_TRANSACTION_NUMBER has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.ABSOLUTE_TRANSACTION_NUMBER has invalid value (" + b + ")"); } absoluteTransactionNumber.put((byte) (b >> 8)); absoluteTransactionNumber.put((byte) b); + return this; } @@ -828,14 +578,13 @@ public Trace callerContextNumber(final long b) { filled.set(1); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CALLER_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CALLER_CONTEXT_NUMBER has invalid value (" + b + ")"); } callerContextNumber.put((byte) (b >> 24)); callerContextNumber.put((byte) (b >> 16)); callerContextNumber.put((byte) (b >> 8)); callerContextNumber.put((byte) b); + return this; } @@ -846,14 +595,13 @@ public Trace codeFragmentIndex(final long b) { filled.set(2); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -888,14 +636,13 @@ public Trace contextNumber(final long b) { filled.set(5); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER has invalid value (" + b + ")"); } contextNumber.put((byte) (b >> 24)); contextNumber.put((byte) (b >> 16)); contextNumber.put((byte) (b >> 8)); contextNumber.put((byte) b); + return this; } @@ -906,14 +653,13 @@ public Trace contextNumberNew(final long b) { filled.set(6); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_NUMBER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER_NEW has invalid value (" + b + ")"); } contextNumberNew.put((byte) (b >> 24)); contextNumberNew.put((byte) (b >> 16)); contextNumberNew.put((byte) (b >> 8)); contextNumberNew.put((byte) b); + return this; } @@ -924,14 +670,13 @@ public Trace contextRevertStamp(final long b) { filled.set(7); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.CONTEXT_REVERT_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_REVERT_STAMP has invalid value (" + b + ")"); } contextRevertStamp.put((byte) (b >> 24)); contextRevertStamp.put((byte) (b >> 16)); contextRevertStamp.put((byte) (b >> 8)); contextRevertStamp.put((byte) b); + return this; } @@ -966,11 +711,10 @@ public Trace counterNsr(final long b) { filled.set(10); } - if (b >= 256L) { - throw new IllegalArgumentException("hub.COUNTER_NSR has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.COUNTER_NSR has invalid value (" + b + ")"); } counterNsr.put((byte) b); + return this; } @@ -993,14 +737,13 @@ public Trace domStamp(final long b) { filled.set(12); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.DOM_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.DOM_STAMP has invalid value (" + b + ")"); } domStamp.put((byte) (b >> 24)); domStamp.put((byte) (b >> 16)); domStamp.put((byte) (b >> 8)); domStamp.put((byte) b); + return this; } @@ -1026,18 +769,11 @@ public Trace gasActual(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasActual.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasActual.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasCost.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasCost.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasCost.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_EXPECTED has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_EXPECTED has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasExpected.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasExpected.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasExpected.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.GAS_NEXT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_NEXT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasNext.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasNext.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasNext.put(bs.get(j)); - } + for(int j=0; j= 2048L) { - throw new IllegalArgumentException("hub.HEIGHT has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.HEIGHT has invalid value (" + b + ")"); } height.put((byte) (b >> 8)); height.put((byte) b); + return this; } @@ -1143,12 +857,11 @@ public Trace heightNew(final long b) { filled.set(19); } - if (b >= 2048L) { - throw new IllegalArgumentException("hub.HEIGHT_NEW has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.HEIGHT_NEW has invalid value (" + b + ")"); } heightNew.put((byte) (b >> 8)); heightNew.put((byte) b); + return this; } @@ -1159,14 +872,13 @@ public Trace hubStamp(final long b) { filled.set(20); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.HUB_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP has invalid value (" + b + ")"); } hubStamp.put((byte) (b >> 24)); hubStamp.put((byte) (b >> 16)); hubStamp.put((byte) (b >> 8)); hubStamp.put((byte) b); + return this; } @@ -1177,15 +889,13 @@ public Trace hubStampTransactionEnd(final long b) { filled.set(21); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.HUB_STAMP_TRANSACTION_END has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP_TRANSACTION_END has invalid value (" + b + ")"); } hubStampTransactionEnd.put((byte) (b >> 24)); hubStampTransactionEnd.put((byte) (b >> 16)); hubStampTransactionEnd.put((byte) (b >> 8)); hubStampTransactionEnd.put((byte) b); + return this; } @@ -1196,14 +906,13 @@ public Trace logInfoStamp(final long b) { filled.set(22); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.LOG_INFO_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.LOG_INFO_STAMP has invalid value (" + b + ")"); } logInfoStamp.put((byte) (b >> 24)); logInfoStamp.put((byte) (b >> 16)); logInfoStamp.put((byte) (b >> 8)); logInfoStamp.put((byte) b); + return this; } @@ -1214,14 +923,13 @@ public Trace mmuStamp(final long b) { filled.set(23); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.MMU_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MMU_STAMP has invalid value (" + b + ")"); } mmuStamp.put((byte) (b >> 24)); mmuStamp.put((byte) (b >> 16)); mmuStamp.put((byte) (b >> 8)); mmuStamp.put((byte) b); + return this; } @@ -1232,14 +940,13 @@ public Trace mxpStamp(final long b) { filled.set(24); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.MXP_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MXP_STAMP has invalid value (" + b + ")"); } mxpStamp.put((byte) (b >> 24)); mxpStamp.put((byte) (b >> 16)); mxpStamp.put((byte) (b >> 8)); mxpStamp.put((byte) b); + return this; } @@ -1250,60 +957,45 @@ public Trace nonStackRows(final long b) { filled.set(25); } - if (b >= 256L) { - throw new IllegalArgumentException("hub.NON_STACK_ROWS has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.NON_STACK_ROWS has invalid value (" + b + ")"); } nonStackRows.put((byte) b); + return this; } public Trace pAccountAddressHi(final long b) { - if (filled.get(103)) { + if (filled.get(104)) { throw new IllegalStateException("hub.account/ADDRESS_HI already set"); } else { - filled.set(103); + filled.set(104); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.account/ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pAccountAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(133)) { throw new IllegalStateException("hub.account/ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(133); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/BALANCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/BALANCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/BALANCE_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/BALANCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pAccountCodeHashHi(final Bytes b) { - if (filled.get(135)) { + if (filled.get(136)) { throw new IllegalStateException("hub.account/CODE_HASH_HI already set"); } else { - filled.set(135); + filled.set(136); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_HI_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/CODE_HASH_LO_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.account/CODE_SIZE has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pAccountCodeSizeNew(final long b) { - if (filled.get(106)) { + if (filled.get(107)) { throw new IllegalStateException("hub.account/CODE_SIZE_NEW already set"); } else { - filled.set(106); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.account/CODE_SIZE_NEW has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE_NEW has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); + return this; } public Trace pAccountDeploymentNumber(final long b) { - if (filled.get(107)) { + if (filled.get(108)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER already set"); } else { - filled.set(107); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); + return this; } public Trace pAccountDeploymentNumberFinalInBlock(final long b) { - if (filled.get(101)) { + if (filled.get(102)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); } else { - filled.set(101); + filled.set(102); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); + return this; } public Trace pAccountDeploymentNumberFirstInBlock(final long b) { - if (filled.get(102)) { + if (filled.get(103)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); } else { - filled.set(102); + filled.set(103); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); + return this; } public Trace pAccountDeploymentNumberInfty(final long b) { - if (filled.get(108)) { + if (filled.get(109)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_INFTY already set"); } else { - filled.set(108); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); + return this; } public Trace pAccountDeploymentNumberNew(final long b) { - if (filled.get(109)) { + if (filled.get(110)) { throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_NEW already set"); } else { - filled.set(109); + filled.set(110); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/DEPLOYMENT_NUMBER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_NEW has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); + return this; } @@ -1671,8 +1289,7 @@ public Trace pAccountDeploymentStatus(final Boolean b) { filled.set(48); } - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .put((byte) (b ? 1 : 0)); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); return this; } @@ -1684,8 +1301,7 @@ public Trace pAccountDeploymentStatusInfty(final Boolean b) { filled.set(49); } - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put( - (byte) (b ? 1 : 0)); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); return this; } @@ -1709,8 +1325,7 @@ public Trace pAccountExists(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -1722,8 +1337,7 @@ public Trace pAccountExistsNew(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } @@ -1735,8 +1349,7 @@ public Trace pAccountFinalInBlk(final Boolean b) { filled.set(53); } - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put( - (byte) (b ? 1 : 0)); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); return this; } @@ -1748,8 +1361,7 @@ public Trace pAccountFinalInCnf(final Boolean b) { filled.set(54); } - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .put((byte) (b ? 1 : 0)); + finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.put((byte) (b ? 1 : 0)); return this; } @@ -1761,8 +1373,7 @@ public Trace pAccountFinalInTxn(final Boolean b) { filled.set(55); } - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.put( - (byte) (b ? 1 : 0)); + finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.put((byte) (b ? 1 : 0)); return this; } @@ -1774,8 +1385,7 @@ public Trace pAccountFirstInBlk(final Boolean b) { filled.set(56); } - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put( - (byte) (b ? 1 : 0)); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -1799,8 +1409,7 @@ public Trace pAccountFirstInTxn(final Boolean b) { filled.set(58); } - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put( - (byte) (b ? 1 : 0)); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); return this; } @@ -1812,8 +1421,7 @@ public Trace pAccountHasCode(final Boolean b) { filled.set(59); } - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.put( - (byte) (b ? 1 : 0)); + hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -1849,8 +1457,7 @@ public Trace pAccountMarkedForSelfdestruct(final Boolean b) { filled.set(62); } - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put((byte) (b ? 1 : 0)); return this; } @@ -1862,105 +1469,81 @@ public Trace pAccountMarkedForSelfdestructNew(final Boolean b) { filled.set(63); } - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put((byte) (b ? 1 : 0)); return this; } public Trace pAccountNonce(final Bytes b) { - if (filled.get(123)) { + if (filled.get(124)) { throw new IllegalStateException("hub.account/NONCE already set"); } else { - filled.set(123); + filled.set(124); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.account/NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.account/NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.account/NONCE_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.account/NONCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_DEP_ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_HI has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pAccountRlpaddrDepAddrLo(final Bytes b) { - if (filled.get(139)) { + if (filled.get(140)) { throw new IllegalStateException("hub.account/RLPADDR_DEP_ADDR_LO already set"); } else { - filled.set(139); + filled.set(140); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_KEC_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_KEC_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_RECIPE has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("hub.account/RLPADDR_RECIPE has invalid value (" + b + ")"); } rlpaddrRecipe.put((byte) b); + return this; } public Trace pAccountRlpaddrSaltHi(final Bytes b) { - if (filled.get(142)) { + if (filled.get(143)) { throw new IllegalStateException("hub.account/RLPADDR_SALT_HI already set"); } else { - filled.set(142); + filled.set(143); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_SALT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/RLPADDR_SALT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.account/TRM_RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/TRM_RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trmRawAddressHiXorMxpOffset1Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pContextAccountAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(133)) { throw new IllegalStateException("hub.context/ACCOUNT_ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(133); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/ACCOUNT_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeAddressHi(final long b) { - if (filled.get(105)) { + if (filled.get(106)) { throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_HI already set"); } else { - filled.set(105); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_ADDRESS_HI has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_HI has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeAddressLo(final Bytes b) { - if (filled.get(133)) { + if (filled.get(134)) { throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_LO already set"); } else { - filled.set(133); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); + return this; } public Trace pContextByteCodeDeploymentNumber(final long b) { - if (filled.get(107)) { + if (filled.get(108)) { throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER already set"); } else { - filled.set(107); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); + return this; } public Trace pContextByteCodeDeploymentStatus(final long b) { - if (filled.get(108)) { + if (filled.get(109)) { throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS already set"); } else { - filled.set(108); + filled.set(109); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/BYTE_CODE_DEPLOYMENT_STATUS has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); + return this; } public Trace pContextCallDataContextNumber(final long b) { - if (filled.get(110)) { + if (filled.get(111)) { throw new IllegalStateException("hub.context/CALL_DATA_CONTEXT_NUMBER already set"); } else { - filled.set(110); + filled.set(111); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pContextCallDataOffset(final long b) { - if (filled.get(111)) { + if (filled.get(112)) { throw new IllegalStateException("hub.context/CALL_DATA_OFFSET already set"); } else { - filled.set(111); + filled.set(112); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_OFFSET has invalid value (" + b + ")"); } callDataOffsetXorMmuSize.put((byte) (b >> 24)); callDataOffsetXorMmuSize.put((byte) (b >> 16)); callDataOffsetXorMmuSize.put((byte) (b >> 8)); callDataOffsetXorMmuSize.put((byte) b); + return this; } public Trace pContextCallDataSize(final long b) { - if (filled.get(112)) { + if (filled.get(113)) { throw new IllegalStateException("hub.context/CALL_DATA_SIZE already set"); } else { - filled.set(112); + filled.set(113); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALL_DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_SIZE has invalid value (" + b + ")"); } callDataSizeXorMmuSrcId.put((byte) (b >> 24)); callDataSizeXorMmuSrcId.put((byte) (b >> 16)); callDataSizeXorMmuSrcId.put((byte) (b >> 8)); callDataSizeXorMmuSrcId.put((byte) b); + return this; } public Trace pContextCallStackDepth(final long b) { - if (filled.get(97)) { + if (filled.get(98)) { throw new IllegalStateException("hub.context/CALL_STACK_DEPTH already set"); } else { - filled.set(97); + filled.set(98); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.context/CALL_STACK_DEPTH has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.context/CALL_STACK_DEPTH has invalid value (" + b + ")"); } callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); callStackDepthXorStackItemHeight1.put((byte) b); + return this; } public Trace pContextCallValue(final Bytes b) { - if (filled.get(135)) { + if (filled.get(136)) { throw new IllegalStateException("hub.context/CALL_VALUE already set"); } else { - filled.set(135); + filled.set(136); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/CALL_VALUE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALL_VALUE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CALLER_ADDRESS_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_HI has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); + return this; } public Trace pContextCallerAddressLo(final Bytes b) { - if (filled.get(134)) { + if (filled.get(135)) { throw new IllegalStateException("hub.context/CALLER_ADDRESS_LO already set"); } else { - filled.set(134); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.context/CALLER_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CONTEXT_NUMBER has invalid value (" + b + ")"); } contextNumberXorMmuTgtId.put((byte) (b >> 24)); contextNumberXorMmuTgtId.put((byte) (b >> 16)); contextNumberXorMmuTgtId.put((byte) (b >> 8)); contextNumberXorMmuTgtId.put((byte) b); + return this; } @@ -2530,8 +2002,7 @@ public Trace pContextIsRoot(final Boolean b) { filled.set(45); } - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put( - (byte) (b ? 1 : 0)); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); return this; } @@ -2543,104 +2014,93 @@ public Trace pContextIsStatic(final Boolean b) { filled.set(46); } - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put( - (byte) (b ? 1 : 0)); + againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put((byte) (b ? 1 : 0)); return this; } public Trace pContextReturnAtCapacity(final long b) { - if (filled.get(114)) { + if (filled.get(115)) { throw new IllegalStateException("hub.context/RETURN_AT_CAPACITY already set"); } else { - filled.set(114); + filled.set(115); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_AT_CAPACITY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_CAPACITY has invalid value (" + b + ")"); } returnAtCapacityXorMxpInst.put((byte) (b >> 24)); returnAtCapacityXorMxpInst.put((byte) (b >> 16)); returnAtCapacityXorMxpInst.put((byte) (b >> 8)); returnAtCapacityXorMxpInst.put((byte) b); + return this; } public Trace pContextReturnAtOffset(final long b) { - if (filled.get(115)) { + if (filled.get(116)) { throw new IllegalStateException("hub.context/RETURN_AT_OFFSET already set"); } else { - filled.set(115); + filled.set(116); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_AT_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_OFFSET has invalid value (" + b + ")"); } returnAtOffsetXorOobInst.put((byte) (b >> 24)); returnAtOffsetXorOobInst.put((byte) (b >> 16)); returnAtOffsetXorOobInst.put((byte) (b >> 8)); returnAtOffsetXorOobInst.put((byte) b); + return this; } public Trace pContextReturnDataContextNumber(final long b) { - if (filled.get(116)) { + if (filled.get(117)) { throw new IllegalStateException("hub.context/RETURN_DATA_CONTEXT_NUMBER already set"); } else { - filled.set(116); + filled.set(117); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); returnDataContextNumberXorStpGasStipend.put((byte) b); + return this; } public Trace pContextReturnDataOffset(final long b) { - if (filled.get(117)) { + if (filled.get(118)) { throw new IllegalStateException("hub.context/RETURN_DATA_OFFSET already set"); } else { - filled.set(117); + filled.set(118); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_OFFSET has invalid value (" + b + ")"); } returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); returnDataOffsetXorStpInstruction.put((byte) b); + return this; } public Trace pContextReturnDataSize(final long b) { - if (filled.get(118)) { + if (filled.get(119)) { throw new IllegalStateException("hub.context/RETURN_DATA_SIZE already set"); } else { - filled.set(118); + filled.set(119); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.context/RETURN_DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_SIZE has invalid value (" + b + ")"); } returnDataSize.put((byte) (b >> 24)); returnDataSize.put((byte) (b >> 16)); returnDataSize.put((byte) (b >> 8)); returnDataSize.put((byte) b); + return this; } @@ -2651,30 +2111,24 @@ public Trace pContextUpdate(final Boolean b) { filled.set(47); } - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .put((byte) (b ? 1 : 0)); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscCcrsStamp(final long b) { - if (filled.get(103)) { + if (filled.get(104)) { throw new IllegalStateException("hub.misc/CCRS_STAMP already set"); } else { - filled.set(103); + filled.set(104); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/CCRS_STAMP has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/CCRS_STAMP has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } @@ -2686,144 +2140,102 @@ public Trace pMiscCcsrFlag(final Boolean b) { filled.set(45); } - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put( - (byte) (b ? 1 : 0)); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscExpData1(final Bytes b) { - if (filled.get(132)) { + if (filled.get(133)) { throw new IllegalStateException("hub.misc/EXP_DATA_1 already set"); } else { - filled.set(132); + filled.set(133); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/EXP_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/EXP_INST has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/EXP_INST has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pMiscMmuAuxId(final long b) { - if (filled.get(105)) { + if (filled.get(106)) { throw new IllegalStateException("hub.misc/MMU_AUX_ID already set"); } else { - filled.set(105); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_AUX_ID has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_AUX_ID has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pMiscMmuExoSum(final long b) { - if (filled.get(106)) { + if (filled.get(107)) { throw new IllegalStateException("hub.misc/MMU_EXO_SUM already set"); } else { - filled.set(106); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_EXO_SUM has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_EXO_SUM has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); + return this; } @@ -2913,220 +2310,185 @@ public Trace pMiscMmuFlag(final Boolean b) { filled.set(47); } - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .put((byte) (b ? 1 : 0)); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscMmuInst(final long b) { - if (filled.get(107)) { + if (filled.get(108)) { throw new IllegalStateException("hub.misc/MMU_INST already set"); } else { - filled.set(107); + filled.set(108); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_INST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_INST has invalid value (" + b + ")"); } deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); + return this; } public Trace pMiscMmuLimb1(final Bytes b) { - if (filled.get(137)) { + if (filled.get(138)) { throw new IllegalStateException("hub.misc/MMU_LIMB_1 already set"); } else { - filled.set(137); + filled.set(138); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_PHASE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_PHASE has invalid value (" + b + ")"); } deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); + return this; } public Trace pMiscMmuRefOffset(final long b) { - if (filled.get(109)) { + if (filled.get(110)) { throw new IllegalStateException("hub.misc/MMU_REF_OFFSET already set"); } else { - filled.set(109); + filled.set(110); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_REF_OFFSET has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_OFFSET has invalid value (" + b + ")"); } deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); + return this; } public Trace pMiscMmuRefSize(final long b) { - if (filled.get(110)) { + if (filled.get(111)) { throw new IllegalStateException("hub.misc/MMU_REF_SIZE already set"); } else { - filled.set(110); + filled.set(111); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_REF_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_SIZE has invalid value (" + b + ")"); } rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); + return this; } public Trace pMiscMmuSize(final long b) { - if (filled.get(111)) { + if (filled.get(112)) { throw new IllegalStateException("hub.misc/MMU_SIZE already set"); } else { - filled.set(111); + filled.set(112); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SIZE has invalid value (" + b + ")"); } callDataOffsetXorMmuSize.put((byte) (b >> 24)); callDataOffsetXorMmuSize.put((byte) (b >> 16)); callDataOffsetXorMmuSize.put((byte) (b >> 8)); callDataOffsetXorMmuSize.put((byte) b); + return this; } public Trace pMiscMmuSrcId(final long b) { - if (filled.get(112)) { + if (filled.get(113)) { throw new IllegalStateException("hub.misc/MMU_SRC_ID already set"); } else { - filled.set(112); + filled.set(113); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_SRC_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SRC_ID has invalid value (" + b + ")"); } callDataSizeXorMmuSrcId.put((byte) (b >> 24)); callDataSizeXorMmuSrcId.put((byte) (b >> 16)); callDataSizeXorMmuSrcId.put((byte) (b >> 8)); callDataSizeXorMmuSrcId.put((byte) b); + return this; } public Trace pMiscMmuSrcOffsetHi(final Bytes b) { - if (filled.get(139)) { + if (filled.get(140)) { throw new IllegalStateException("hub.misc/MMU_SRC_OFFSET_HI already set"); } else { - filled.set(139); + filled.set(140); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MMU_TGT_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_TGT_ID has invalid value (" + b + ")"); } contextNumberXorMmuTgtId.put((byte) (b >> 24)); contextNumberXorMmuTgtId.put((byte) (b >> 16)); contextNumberXorMmuTgtId.put((byte) (b >> 8)); contextNumberXorMmuTgtId.put((byte) b); + return this; } public Trace pMiscMmuTgtOffsetLo(final Bytes b) { - if (filled.get(141)) { + if (filled.get(142)) { throw new IllegalStateException("hub.misc/MMU_TGT_OFFSET_LO already set"); } else { - filled.set(141); + filled.set(142); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MMU_TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/MXP_INST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MXP_INST has invalid value (" + b + ")"); } returnAtCapacityXorMxpInst.put((byte) (b >> 24)); returnAtCapacityXorMxpInst.put((byte) (b >> 16)); returnAtCapacityXorMxpInst.put((byte) (b >> 8)); returnAtCapacityXorMxpInst.put((byte) b); + return this; } @@ -3264,8 +2608,7 @@ public Trace pMiscMxpMtntop(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -3277,164 +2620,121 @@ public Trace pMiscMxpMxpx(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscMxpOffset1Hi(final Bytes b) { - if (filled.get(143)) { + if (filled.get(144)) { throw new IllegalStateException("hub.misc/MXP_OFFSET_1_HI already set"); } else { - filled.set(143); + filled.set(144); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - trmRawAddressHiXorMxpOffset1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpOffset2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpOffset2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpOffset2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpOffset2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpOffset2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpOffset2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpSize2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpSize2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpSize2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/MXP_WORDS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_WORDS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - mxpWords.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { mxpWords.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - mxpWords.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData6.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData6.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_7 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_7 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData7.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData7.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData7.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_8 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_8 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData8.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData8.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData8.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/OOB_DATA_9 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_9 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - oobData9.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { oobData9.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - oobData9.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/OOB_INST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/OOB_INST has invalid value (" + b + ")"); } returnAtOffsetXorOobInst.put((byte) (b >> 24)); returnAtOffsetXorOobInst.put((byte) (b >> 16)); returnAtOffsetXorOobInst.put((byte) (b >> 8)); returnAtOffsetXorOobInst.put((byte) b); + return this; } @@ -3815,8 +3027,7 @@ public Trace pMiscStpExists(final Boolean b) { filled.set(56); } - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put( - (byte) (b ? 1 : 0)); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put((byte) (b ? 1 : 0)); return this; } @@ -3834,168 +3045,131 @@ public Trace pMiscStpFlag(final Boolean b) { } public Trace pMiscStpGasHi(final Bytes b) { - if (filled.get(161)) { + if (filled.get(162)) { throw new IllegalStateException("hub.misc/STP_GAS_HI already set"); } else { - filled.set(161); + filled.set(162); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpGasHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpGasHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpGasLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpGasLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_PAID_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_PAID_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/STP_GAS_STIPEND has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_GAS_STIPEND has invalid value (" + b + ")"); } returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); returnDataContextNumberXorStpGasStipend.put((byte) b); + return this; } public Trace pMiscStpGasUpfrontGasCost(final Bytes b) { - if (filled.get(125)) { + if (filled.get(126)) { throw new IllegalStateException("hub.misc/STP_GAS_UPFRONT_GAS_COST already set"); } else { - filled.set(125); + filled.set(126); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.misc/STP_GAS_UPFRONT_GAS_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_UPFRONT_GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.misc/STP_INSTRUCTION has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_INSTRUCTION has invalid value (" + b + ")"); } returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); returnDataOffsetXorStpInstruction.put((byte) b); + return this; } @@ -4006,60 +3180,45 @@ public Trace pMiscStpOogx(final Boolean b) { filled.set(58); } - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put( - (byte) (b ? 1 : 0)); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); return this; } public Trace pMiscStpValueHi(final Bytes b) { - if (filled.get(163)) { + if (filled.get(164)) { throw new IllegalStateException("hub.misc/STP_VALUE_HI already set"); } else { - filled.set(163); + filled.set(164); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.misc/STP_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpValueHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpValueHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpValueHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.misc/STP_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - stpValueLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { stpValueLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpValueLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.scenario/PRC_CALLEE_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.scenario/PRC_CALLEE_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.scenario/PRC_CALLER_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.scenario/PRC_CALLER_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_CDO has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDO has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pScenarioPrcCds(final long b) { - if (filled.get(104)) { + if (filled.get(105)) { throw new IllegalStateException("hub.scenario/PRC_CDS already set"); } else { - filled.set(104); + filled.set(105); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_CDS has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDS has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } @@ -4578,70 +3680,54 @@ public Trace pScenarioPrcModexp(final Boolean b) { } public Trace pScenarioPrcRac(final long b) { - if (filled.get(105)) { + if (filled.get(106)) { throw new IllegalStateException("hub.scenario/PRC_RAC already set"); } else { - filled.set(105); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_RAC has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAC has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pScenarioPrcRao(final long b) { - if (filled.get(106)) { + if (filled.get(107)) { throw new IllegalStateException("hub.scenario/PRC_RAO already set"); } else { - filled.set(106); + filled.set(107); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.scenario/PRC_RAO has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAO has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); + return this; } public Trace pScenarioPrcReturnGas(final Bytes b) { - if (filled.get(125)) { + if (filled.get(126)) { throw new IllegalStateException("hub.scenario/PRC_RETURN_GAS already set"); } else { - filled.set(125); + filled.set(126); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "hub.scenario/PRC_RETURN_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.scenario/PRC_RETURN_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/HASH_INFO_KECCAK_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/HASH_INFO_KECCAK_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "hub.stack/INSTRUCTION has invalid width (" + bs.bitLength() + "bits)"); - } - // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - instruction.put((byte) 0); - } - // Write bytes - for (int j = 0; j < bs.size(); j++) { - instruction.put(bs.get(j)); - } + instruction.put(b.toByte()); return this; } @@ -5164,8 +4197,7 @@ public Trace pStackInvalidFlag(final Boolean b) { filled.set(62); } - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put((byte) (b ? 1 : 0)); return this; } @@ -5177,8 +4209,7 @@ public Trace pStackJumpDestinationVettingRequired(final Boolean b) { filled.set(64); } - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.put( - (byte) (b ? 1 : 0)); + rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.put((byte) (b ? 1 : 0)); return this; } @@ -5202,8 +4233,7 @@ public Trace pStackJumpx(final Boolean b) { filled.set(63); } - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put( - (byte) (b ? 1 : 0)); + markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put((byte) (b ? 1 : 0)); return this; } @@ -5341,55 +4371,39 @@ public Trace pStackOpcx(final Boolean b) { } public Trace pStackPushValueHi(final Bytes b) { - if (filled.get(134)) { + if (filled.get(135)) { throw new IllegalStateException("hub.stack/PUSH_VALUE_HI already set"); } else { - filled.set(134); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.stack/PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_1 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_1 has invalid value (" + b + ")"); } callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); callStackDepthXorStackItemHeight1.put((byte) b); + return this; } public Trace pStackStackItemHeight2(final long b) { - if (filled.get(98)) { + if (filled.get(99)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_2 already set"); } else { - filled.set(98); + filled.set(99); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_2 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_2 has invalid value (" + b + ")"); } stackItemHeight2.put((byte) (b >> 8)); stackItemHeight2.put((byte) b); + return this; } public Trace pStackStackItemHeight3(final long b) { - if (filled.get(99)) { + if (filled.get(100)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_3 already set"); } else { - filled.set(99); + filled.set(100); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_3 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_3 has invalid value (" + b + ")"); } stackItemHeight3.put((byte) (b >> 8)); stackItemHeight3.put((byte) b); + return this; } public Trace pStackStackItemHeight4(final long b) { - if (filled.get(100)) { + if (filled.get(101)) { throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_4 already set"); } else { - filled.set(100); + filled.set(101); } - if (b >= 2048L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_HEIGHT_4 has invalid value (" + b + ")"); - } + if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_4 has invalid value (" + b + ")"); } stackItemHeight4.put((byte) (b >> 8)); stackItemHeight4.put((byte) b); + return this; } @@ -5571,289 +4577,225 @@ public Trace pStackStackItemPop4(final Boolean b) { } public Trace pStackStackItemStamp1(final long b) { - if (filled.get(119)) { + if (filled.get(120)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_1 already set"); } else { - filled.set(119); + filled.set(120); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_1 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_1 has invalid value (" + b + ")"); } stackItemStamp1.put((byte) (b >> 32)); stackItemStamp1.put((byte) (b >> 24)); stackItemStamp1.put((byte) (b >> 16)); stackItemStamp1.put((byte) (b >> 8)); stackItemStamp1.put((byte) b); + return this; } public Trace pStackStackItemStamp2(final long b) { - if (filled.get(120)) { + if (filled.get(121)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_2 already set"); } else { - filled.set(120); + filled.set(121); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_2 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_2 has invalid value (" + b + ")"); } stackItemStamp2.put((byte) (b >> 32)); stackItemStamp2.put((byte) (b >> 24)); stackItemStamp2.put((byte) (b >> 16)); stackItemStamp2.put((byte) (b >> 8)); stackItemStamp2.put((byte) b); + return this; } public Trace pStackStackItemStamp3(final long b) { - if (filled.get(121)) { + if (filled.get(122)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_3 already set"); } else { - filled.set(121); + filled.set(122); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_3 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_3 has invalid value (" + b + ")"); } stackItemStamp3.put((byte) (b >> 32)); stackItemStamp3.put((byte) (b >> 24)); stackItemStamp3.put((byte) (b >> 16)); stackItemStamp3.put((byte) (b >> 8)); stackItemStamp3.put((byte) b); + return this; } public Trace pStackStackItemStamp4(final long b) { - if (filled.get(122)) { + if (filled.get(123)) { throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_4 already set"); } else { - filled.set(122); + filled.set(123); } - if (b >= 68719476736L) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_STAMP_4 has invalid value (" + b + ")"); - } + if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_4 has invalid value (" + b + ")"); } stackItemStamp4.put((byte) (b >> 32)); stackItemStamp4.put((byte) (b >> 24)); stackItemStamp4.put((byte) (b >> 16)); stackItemStamp4.put((byte) (b >> 8)); stackItemStamp4.put((byte) b); + return this; } public Trace pStackStackItemValueHi1(final Bytes b) { - if (filled.get(136)) { + if (filled.get(137)) { throw new IllegalStateException("hub.stack/STACK_ITEM_VALUE_HI_1 already set"); } else { - filled.set(136); + filled.set(137); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_HI_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.stack/STACK_ITEM_VALUE_LO_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.stack/STATIC_GAS has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.stack/STATIC_GAS has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } @@ -5977,51 +4914,37 @@ public Trace pStackWcpFlag(final Boolean b) { } public Trace pStorageAddressHi(final long b) { - if (filled.get(103)) { + if (filled.get(104)) { throw new IllegalStateException("hub.storage/ADDRESS_HI already set"); } else { - filled.set(103); + filled.set(104); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.storage/ADDRESS_HI has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/ADDRESS_HI has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pStorageAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(133)) { throw new IllegalStateException("hub.storage/ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(133); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.storage/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pStorageDeploymentNumberFinalInBlock(final long b) { - if (filled.get(101)) { + if (filled.get(102)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); } else { - filled.set(101); + filled.set(102); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); + return this; } public Trace pStorageDeploymentNumberFirstInBlock(final long b) { - if (filled.get(102)) { + if (filled.get(103)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); } else { - filled.set(102); + filled.set(103); } - if (b >= 65536L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); + return this; } public Trace pStorageDeploymentNumberInfty(final long b) { - if (filled.get(105)) { + if (filled.get(106)) { throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_INFTY already set"); } else { - filled.set(105); + filled.set(106); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.storage/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } @@ -6152,8 +5056,7 @@ public Trace pStorageFinalInBlk(final Boolean b) { filled.set(48); } - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .put((byte) (b ? 1 : 0)); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); return this; } @@ -6165,8 +5068,7 @@ public Trace pStorageFinalInCnf(final Boolean b) { filled.set(49); } - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put( - (byte) (b ? 1 : 0)); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); return this; } @@ -6190,8 +5092,7 @@ public Trace pStorageFirstInBlk(final Boolean b) { filled.set(51); } - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put( - (byte) (b ? 1 : 0)); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); return this; } @@ -6203,8 +5104,7 @@ public Trace pStorageFirstInCnf(final Boolean b) { filled.set(52); } - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put( - (byte) (b ? 1 : 0)); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); return this; } @@ -6216,64 +5116,45 @@ public Trace pStorageFirstInTxn(final Boolean b) { filled.set(53); } - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put( - (byte) (b ? 1 : 0)); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); return this; } public Trace pStorageStorageKeyHi(final Bytes b) { - if (filled.get(133)) { + if (filled.get(134)) { throw new IllegalStateException("hub.storage/STORAGE_KEY_HI already set"); } else { - filled.set(133); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.storage/STORAGE_KEY_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/STORAGE_KEY_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_CURR_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_CURR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_NEXT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_NEXT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_ORIG_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.storage/VALUE_ORIG_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/BASEFEE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/CALL_DATA_SIZE has invalid value (" + b + ")"); - } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/CALL_DATA_SIZE has invalid value (" + b + ")"); } + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); + return this; } public Trace pTransactionCoinbaseAddressHi(final long b) { - if (filled.get(104)) { + if (filled.get(105)) { throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_HI already set"); } else { - filled.set(104); + filled.set(105); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/COINBASE_ADDRESS_HI has invalid value (" + b + ")"); - } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .put((byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_HI has invalid value (" + b + ")"); } + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); + return this; } public Trace pTransactionCoinbaseAddressLo(final Bytes b) { - if (filled.get(132)) { + if (filled.get(133)) { throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_LO already set"); } else { - filled.set(132); + filled.set(133); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/COINBASE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/FROM_ADDRESS_HI has invalid value (" + b + ")"); - } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put( - (byte) b); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_HI has invalid value (" + b + ")"); } + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); + return this; } public Trace pTransactionFromAddressLo(final Bytes b) { - if (filled.get(133)) { + if (filled.get(134)) { throw new IllegalStateException("hub.transaction/FROM_ADDRESS_LO already set"); } else { - filled.set(133); + filled.set(134); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/FROM_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put( - bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasLimit.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasLimit.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasLimit.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasPrice.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasPrice.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasPrice.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/INIT_CODE_SIZE has invalid value (" + b + ")"); - } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put( - (byte) (b >> 8)); + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/INIT_CODE_SIZE has invalid value (" + b + ")"); } + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); + return this; } public Trace pTransactionInitialBalance(final Bytes b) { - if (filled.get(134)) { + if (filled.get(135)) { throw new IllegalStateException("hub.transaction/INITIAL_BALANCE already set"); } else { - filled.set(134); + filled.set(135); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - (byte) 0); - } + for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put( - bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonce.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonce.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - priorityFeePerGas.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { priorityFeePerGas.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - priorityFeePerGas.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/REFUND_COUNTER_INFINITY has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/REFUND_COUNTER_INFINITY has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refundCounterInfinity.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refundCounterInfinity.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundCounterInfinity.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "hub.transaction/REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.transaction/REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refundEffective.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refundEffective.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundEffective.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "hub.transaction/TO_ADDRESS_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_HI has invalid value (" + b + ")"); } deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); + return this; } public Trace pTransactionToAddressLo(final Bytes b) { - if (filled.get(135)) { + if (filled.get(136)) { throw new IllegalStateException("hub.transaction/TO_ADDRESS_LO already set"); } else { - filled.set(135); + filled.set(136); } // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "hub.transaction/TO_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "hub.transaction/VALUE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/VALUE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("hub.PROGRAM_COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER has invalid value (" + b + ")"); } programCounter.put((byte) (b >> 24)); programCounter.put((byte) (b >> 16)); programCounter.put((byte) (b >> 8)); programCounter.put((byte) b); + return this; } @@ -7202,14 +5900,13 @@ public Trace programCounterNew(final long b) { filled.set(34); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.PROGRAM_COUNTER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER_NEW has invalid value (" + b + ")"); } programCounterNew.put((byte) (b >> 24)); programCounterNew.put((byte) (b >> 16)); programCounterNew.put((byte) (b >> 8)); programCounterNew.put((byte) b); + return this; } @@ -7220,14 +5917,13 @@ public Trace refundCounter(final long b) { filled.set(35); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.REFUND_COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER has invalid value (" + b + ")"); } refundCounter.put((byte) (b >> 24)); refundCounter.put((byte) (b >> 16)); refundCounter.put((byte) (b >> 8)); refundCounter.put((byte) b); + return this; } @@ -7238,14 +5934,13 @@ public Trace refundCounterNew(final long b) { filled.set(36); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.REFUND_COUNTER_NEW has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER_NEW has invalid value (" + b + ")"); } refundCounterNew.put((byte) (b >> 24)); refundCounterNew.put((byte) (b >> 16)); refundCounterNew.put((byte) (b >> 8)); refundCounterNew.put((byte) b); + return this; } @@ -7256,12 +5951,11 @@ public Trace relativeBlockNumber(final long b) { filled.set(37); } - if (b >= 65536L) { - throw new IllegalArgumentException("hub.RELATIVE_BLOCK_NUMBER has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("hub.RELATIVE_BLOCK_NUMBER has invalid value (" + b + ")"); } relativeBlockNumber.put((byte) (b >> 8)); relativeBlockNumber.put((byte) b); + return this; } @@ -7272,14 +5966,13 @@ public Trace subStamp(final long b) { filled.set(38); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("hub.SUB_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("hub.SUB_STAMP has invalid value (" + b + ")"); } subStamp.put((byte) (b >> 24)); subStamp.put((byte) (b >> 16)); subStamp.put((byte) (b >> 8)); subStamp.put((byte) b); + return this; } @@ -7360,56 +6053,48 @@ public Trace validateRow() { throw new IllegalStateException("hub.ABSOLUTE_TRANSACTION_NUMBER has not been filled"); } - if (!filled.get(103)) { - throw new IllegalStateException( - "hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE has not been filled"); + if (!filled.get(104)) { + throw new IllegalStateException("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE has not been filled"); } - if (!filled.get(132)) { - throw new IllegalStateException( - "hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO has not been filled"); + if (!filled.get(133)) { + throw new IllegalStateException("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO has not been filled"); } if (!filled.get(45)) { - throw new IllegalStateException( - "hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD has not been filled"); } if (!filled.get(46)) { - throw new IllegalStateException( - "hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT has not been filled"); } if (!filled.get(47)) { - throw new IllegalStateException( - "hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2 has not been filled"); + throw new IllegalStateException("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2 has not been filled"); } if (!filled.get(94)) { throw new IllegalStateException("hub.ALPHA has not been filled"); } - if (!filled.get(134)) { - throw new IllegalStateException( - "hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE has not been filled"); + if (!filled.get(135)) { + throw new IllegalStateException("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE has not been filled"); } - if (!filled.get(133)) { - throw new IllegalStateException( - "hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO has not been filled"); + if (!filled.get(134)) { + throw new IllegalStateException("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO has not been filled"); } - if (!filled.get(111)) { + if (!filled.get(112)) { throw new IllegalStateException("hub.CALL_DATA_OFFSET_xor_MMU_SIZE has not been filled"); } - if (!filled.get(112)) { + if (!filled.get(113)) { throw new IllegalStateException("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID has not been filled"); } - if (!filled.get(97)) { - throw new IllegalStateException( - "hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1 has not been filled"); + if (!filled.get(98)) { + throw new IllegalStateException("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1 has not been filled"); } if (!filled.get(1)) { @@ -7420,39 +6105,32 @@ public Trace validateRow() { throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX has not been filled"); } - if (!filled.get(104)) { - throw new IllegalStateException( - "hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI has not been filled"); + if (!filled.get(105)) { + throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI has not been filled"); + } + + if (!filled.get(137)) { + throw new IllegalStateException("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE has not been filled"); } if (!filled.get(136)) { - throw new IllegalStateException( - "hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE has not been filled"); + throw new IllegalStateException("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO has not been filled"); } - if (!filled.get(135)) { - throw new IllegalStateException( - "hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO has not been filled"); + if (!filled.get(139)) { + throw new IllegalStateException("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO has not been filled"); } if (!filled.get(138)) { - throw new IllegalStateException( - "hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO has not been filled"); + throw new IllegalStateException("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI has not been filled"); } - if (!filled.get(137)) { - throw new IllegalStateException( - "hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI has not been filled"); + if (!filled.get(107)) { + throw new IllegalStateException("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE has not been filled"); } if (!filled.get(106)) { - throw new IllegalStateException( - "hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE has not been filled"); - } - - if (!filled.get(105)) { - throw new IllegalStateException( - "hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI has not been filled"); + throw new IllegalStateException("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI has not been filled"); } if (!filled.get(3)) { @@ -7471,7 +6149,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.CONTEXT_NUMBER_NEW has not been filled"); } - if (!filled.get(113)) { + if (!filled.get(114)) { throw new IllegalStateException("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID has not been filled"); } @@ -7499,44 +6177,36 @@ public Trace validateRow() { throw new IllegalStateException("hub.DELTA has not been filled"); } - if (!filled.get(101)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has not been filled"); - } - if (!filled.get(102)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has not been filled"); } - if (!filled.get(108)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE has not been filled"); + if (!filled.get(103)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has not been filled"); } if (!filled.get(109)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE has not been filled"); } - if (!filled.get(107)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI has not been filled"); + if (!filled.get(110)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET has not been filled"); + } + + if (!filled.get(108)) { + throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI has not been filled"); } if (!filled.get(49)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE has not been filled"); } if (!filled.get(50)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN has not been filled"); } if (!filled.get(48)) { - throw new IllegalStateException( - "hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION has not been filled"); + throw new IllegalStateException("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION has not been filled"); } if (!filled.get(12)) { @@ -7548,43 +6218,35 @@ public Trace validateRow() { } if (!filled.get(52)) { - throw new IllegalStateException( - "hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF has not been filled"); + throw new IllegalStateException("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF has not been filled"); } if (!filled.get(51)) { - throw new IllegalStateException( - "hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK has not been filled"); + throw new IllegalStateException("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK has not been filled"); } if (!filled.get(53)) { - throw new IllegalStateException( - "hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN has not been filled"); } if (!filled.get(54)) { - throw new IllegalStateException( - "hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES has not been filled"); } if (!filled.get(55)) { - throw new IllegalStateException( - "hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG has not been filled"); + throw new IllegalStateException("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG has not been filled"); } if (!filled.get(56)) { - throw new IllegalStateException( - "hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO has not been filled"); } if (!filled.get(57)) { - throw new IllegalStateException( - "hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR has not been filled"); } if (!filled.get(58)) { - throw new IllegalStateException( - "hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG has not been filled"); + throw new IllegalStateException("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG has not been filled"); } if (!filled.get(14)) { @@ -7599,7 +6261,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.GAS_EXPECTED has not been filled"); } - if (!filled.get(126)) { + if (!filled.get(127)) { throw new IllegalStateException("hub.GAS_LIMIT has not been filled"); } @@ -7607,18 +6269,16 @@ public Trace validateRow() { throw new IllegalStateException("hub.GAS_NEXT has not been filled"); } - if (!filled.get(127)) { + if (!filled.get(128)) { throw new IllegalStateException("hub.GAS_PRICE has not been filled"); } if (!filled.get(60)) { - throw new IllegalStateException( - "hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO has not been filled"); } if (!filled.get(59)) { - throw new IllegalStateException( - "hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO has not been filled"); + throw new IllegalStateException("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO has not been filled"); } if (!filled.get(18)) { @@ -7637,13 +6297,12 @@ public Trace validateRow() { throw new IllegalStateException("hub.HUB_STAMP_TRANSACTION_END has not been filled"); } - if (!filled.get(165)) { + if (!filled.get(96)) { throw new IllegalStateException("hub.INSTRUCTION has not been filled"); } if (!filled.get(61)) { - throw new IllegalStateException( - "hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH has not been filled"); + throw new IllegalStateException("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH has not been filled"); } if (!filled.get(22)) { @@ -7651,40 +6310,38 @@ public Trace validateRow() { } if (!filled.get(63)) { - throw new IllegalStateException( - "hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX has not been filled"); + throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX has not been filled"); } if (!filled.get(62)) { - throw new IllegalStateException( - "hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW has not been filled"); + throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW has not been filled"); } if (!filled.get(23)) { throw new IllegalStateException("hub.MMU_STAMP has not been filled"); } - if (!filled.get(145)) { + if (!filled.get(146)) { throw new IllegalStateException("hub.MXP_OFFSET_2_HI has not been filled"); } - if (!filled.get(146)) { + if (!filled.get(147)) { throw new IllegalStateException("hub.MXP_OFFSET_2_LO has not been filled"); } - if (!filled.get(147)) { + if (!filled.get(148)) { throw new IllegalStateException("hub.MXP_SIZE_1_HI has not been filled"); } - if (!filled.get(148)) { + if (!filled.get(149)) { throw new IllegalStateException("hub.MXP_SIZE_1_LO has not been filled"); } - if (!filled.get(149)) { + if (!filled.get(150)) { throw new IllegalStateException("hub.MXP_SIZE_2_HI has not been filled"); } - if (!filled.get(150)) { + if (!filled.get(151)) { throw new IllegalStateException("hub.MXP_SIZE_2_LO has not been filled"); } @@ -7692,7 +6349,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.MXP_STAMP has not been filled"); } - if (!filled.get(151)) { + if (!filled.get(152)) { throw new IllegalStateException("hub.MXP_WORDS has not been filled"); } @@ -7700,53 +6357,51 @@ public Trace validateRow() { throw new IllegalStateException("hub.NON_STACK_ROWS has not been filled"); } - if (!filled.get(128)) { + if (!filled.get(129)) { throw new IllegalStateException("hub.NONCE has not been filled"); } - if (!filled.get(124)) { - throw new IllegalStateException( - "hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE has not been filled"); + if (!filled.get(125)) { + throw new IllegalStateException("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE has not been filled"); } - if (!filled.get(123)) { - throw new IllegalStateException( - "hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE has not been filled"); + if (!filled.get(124)) { + throw new IllegalStateException("hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE has not been filled"); } - if (!filled.get(152)) { + if (!filled.get(153)) { throw new IllegalStateException("hub.OOB_DATA_1 has not been filled"); } - if (!filled.get(153)) { + if (!filled.get(154)) { throw new IllegalStateException("hub.OOB_DATA_2 has not been filled"); } - if (!filled.get(154)) { + if (!filled.get(155)) { throw new IllegalStateException("hub.OOB_DATA_3 has not been filled"); } - if (!filled.get(155)) { + if (!filled.get(156)) { throw new IllegalStateException("hub.OOB_DATA_4 has not been filled"); } - if (!filled.get(156)) { + if (!filled.get(157)) { throw new IllegalStateException("hub.OOB_DATA_5 has not been filled"); } - if (!filled.get(157)) { + if (!filled.get(158)) { throw new IllegalStateException("hub.OOB_DATA_6 has not been filled"); } - if (!filled.get(158)) { + if (!filled.get(159)) { throw new IllegalStateException("hub.OOB_DATA_7 has not been filled"); } - if (!filled.get(159)) { + if (!filled.get(160)) { throw new IllegalStateException("hub.OOB_DATA_8 has not been filled"); } - if (!filled.get(160)) { + if (!filled.get(161)) { throw new IllegalStateException("hub.OOB_DATA_9 has not been filled"); } @@ -7791,8 +6446,7 @@ public Trace validateRow() { } if (!filled.get(72)) { - throw new IllegalStateException( - "hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG has not been filled"); + throw new IllegalStateException("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG has not been filled"); } if (!filled.get(73)) { @@ -7816,16 +6470,14 @@ public Trace validateRow() { } if (!filled.get(78)) { - throw new IllegalStateException( - "hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX has not been filled"); + throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX has not been filled"); } if (!filled.get(79)) { - throw new IllegalStateException( - "hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG has not been filled"); + throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG has not been filled"); } - if (!filled.get(129)) { + if (!filled.get(130)) { throw new IllegalStateException("hub.PRIORITY_FEE_PER_GAS has not been filled"); } @@ -7841,7 +6493,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.REFUND_COUNTER has not been filled"); } - if (!filled.get(130)) { + if (!filled.get(131)) { throw new IllegalStateException("hub.REFUND_COUNTER_INFINITY has not been filled"); } @@ -7849,7 +6501,7 @@ public Trace validateRow() { throw new IllegalStateException("hub.REFUND_COUNTER_NEW has not been filled"); } - if (!filled.get(131)) { + if (!filled.get(132)) { throw new IllegalStateException("hub.REFUND_EFFECTIVE has not been filled"); } @@ -7857,25 +6509,23 @@ public Trace validateRow() { throw new IllegalStateException("hub.RELATIVE_BLOCK_NUMBER has not been filled"); } - if (!filled.get(114)) { - throw new IllegalStateException("hub.RETURN_AT_CAPACITY_xor_MXP_INST has not been filled"); - } - if (!filled.get(115)) { - throw new IllegalStateException("hub.RETURN_AT_OFFSET_xor_OOB_INST has not been filled"); + throw new IllegalStateException("hub.RETURN_AT_CAPACITY_xor_MXP_INST has not been filled"); } if (!filled.get(116)) { - throw new IllegalStateException( - "hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND has not been filled"); + throw new IllegalStateException("hub.RETURN_AT_OFFSET_xor_OOB_INST has not been filled"); } if (!filled.get(117)) { - throw new IllegalStateException( - "hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION has not been filled"); + throw new IllegalStateException("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND has not been filled"); } if (!filled.get(118)) { + throw new IllegalStateException("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION has not been filled"); + } + + if (!filled.get(119)) { throw new IllegalStateException("hub.RETURN_DATA_SIZE has not been filled"); } @@ -7884,77 +6534,63 @@ public Trace validateRow() { } if (!filled.get(81)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX has not been filled"); } if (!filled.get(82)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG has not been filled"); } if (!filled.get(83)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1 has not been filled"); } if (!filled.get(84)) { - throw new IllegalStateException( - "hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2 has not been filled"); } if (!filled.get(85)) { - throw new IllegalStateException( - "hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3 has not been filled"); } if (!filled.get(86)) { - throw new IllegalStateException( - "hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4 has not been filled"); + throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4 has not been filled"); } - if (!filled.get(110)) { - throw new IllegalStateException( - "hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE has not been filled"); + if (!filled.get(111)) { + throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE has not been filled"); } - if (!filled.get(139)) { - throw new IllegalStateException( - "hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI has not been filled"); + if (!filled.get(140)) { + throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI has not been filled"); } if (!filled.get(64)) { - throw new IllegalStateException( - "hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED has not been filled"); + throw new IllegalStateException("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED has not been filled"); } - if (!filled.get(140)) { - throw new IllegalStateException( - "hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO has not been filled"); + if (!filled.get(141)) { + throw new IllegalStateException("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO has not been filled"); } - if (!filled.get(141)) { - throw new IllegalStateException( - "hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2 has not been filled"); + if (!filled.get(142)) { + throw new IllegalStateException("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2 has not been filled"); } - if (!filled.get(96)) { + if (!filled.get(97)) { throw new IllegalStateException("hub.RLPADDR_RECIPE has not been filled"); } - if (!filled.get(142)) { - throw new IllegalStateException( - "hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3 has not been filled"); + if (!filled.get(143)) { + throw new IllegalStateException("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3 has not been filled"); } - if (!filled.get(143)) { - throw new IllegalStateException( - "hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4 has not been filled"); + if (!filled.get(144)) { + throw new IllegalStateException("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4 has not been filled"); } if (!filled.get(65)) { - throw new IllegalStateException( - "hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG has not been filled"); + throw new IllegalStateException("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG has not been filled"); } if (!filled.get(87)) { @@ -7962,66 +6598,62 @@ public Trace validateRow() { } if (!filled.get(88)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG has not been filled"); } if (!filled.get(89)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG has not been filled"); } if (!filled.get(90)) { - throw new IllegalStateException( - "hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX has not been filled"); + throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX has not been filled"); } - if (!filled.get(98)) { + if (!filled.get(99)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_2 has not been filled"); } - if (!filled.get(99)) { + if (!filled.get(100)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_3 has not been filled"); } - if (!filled.get(100)) { + if (!filled.get(101)) { throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_4 has not been filled"); } - if (!filled.get(119)) { + if (!filled.get(120)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_1 has not been filled"); } - if (!filled.get(120)) { + if (!filled.get(121)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_2 has not been filled"); } - if (!filled.get(121)) { + if (!filled.get(122)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_3 has not been filled"); } - if (!filled.get(122)) { + if (!filled.get(123)) { throw new IllegalStateException("hub.STACK_ITEM_STAMP_4 has not been filled"); } - if (!filled.get(161)) { + if (!filled.get(162)) { throw new IllegalStateException("hub.STP_GAS_HI has not been filled"); } - if (!filled.get(162)) { + if (!filled.get(163)) { throw new IllegalStateException("hub.STP_GAS_LO has not been filled"); } - if (!filled.get(125)) { - throw new IllegalStateException( - "hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER has not been filled"); + if (!filled.get(126)) { + throw new IllegalStateException("hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER has not been filled"); } - if (!filled.get(163)) { + if (!filled.get(164)) { throw new IllegalStateException("hub.STP_VALUE_HI has not been filled"); } - if (!filled.get(164)) { + if (!filled.get(165)) { throw new IllegalStateException("hub.STP_VALUE_LO has not been filled"); } @@ -8034,13 +6666,11 @@ public Trace validateRow() { } if (!filled.get(66)) { - throw new IllegalStateException( - "hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG has not been filled"); + throw new IllegalStateException("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG has not been filled"); } - if (!filled.get(144)) { - throw new IllegalStateException( - "hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO has not been filled"); + if (!filled.get(145)) { + throw new IllegalStateException("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO has not been filled"); } if (!filled.get(39)) { @@ -8072,13 +6702,11 @@ public Trace validateRow() { } if (!filled.get(68)) { - throw new IllegalStateException( - "hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG has not been filled"); + throw new IllegalStateException("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG has not been filled"); } if (!filled.get(67)) { - throw new IllegalStateException( - "hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG has not been filled"); + throw new IllegalStateException("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG has not been filled"); } if (!filled.get(93)) { @@ -8096,75 +6724,47 @@ public Trace fillAndValidateRow() { absoluteTransactionNumber.position(absoluteTransactionNumber.position() + 2); } - if (!filled.get(103)) { - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize - .position( - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize - .position() - + 4); + if (!filled.get(104)) { + addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.position(addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.position() + 4); } - if (!filled.get(132)) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .position( - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo - .position() - + 16); + if (!filled.get(133)) { + addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position(addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position() + 16); } if (!filled.get(45)) { - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd - .position( - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd - .position() - + 1); + againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position(againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position() + 1); } if (!filled.get(46)) { - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment - .position( - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment - .position() - + 1); + againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position(againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position() + 1); } if (!filled.get(47)) { - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .position( - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 - .position() - + 1); + againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position(againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position() + 1); } if (!filled.get(94)) { alpha.position(alpha.position() + 1); } - if (!filled.get(134)) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance - .position( - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance - .position() - + 16); + if (!filled.get(135)) { + balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position(balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position() + 16); } - if (!filled.get(133)) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo - .position( - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo - .position() - + 16); + if (!filled.get(134)) { + balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position(balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position() + 16); } - if (!filled.get(111)) { + if (!filled.get(112)) { callDataOffsetXorMmuSize.position(callDataOffsetXorMmuSize.position() + 4); } - if (!filled.get(112)) { + if (!filled.get(113)) { callDataSizeXorMmuSrcId.position(callDataSizeXorMmuSrcId.position() + 4); } - if (!filled.get(97)) { + if (!filled.get(98)) { callStackDepthXorStackItemHeight1.position(callStackDepthXorStackItemHeight1.position() + 2); } @@ -8176,47 +6776,32 @@ public Trace fillAndValidateRow() { codeFragmentIndex.position(codeFragmentIndex.position() + 4); } - if (!filled.get(104)) { - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .position( - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi - .position() - + 4); + if (!filled.get(105)) { + codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.position(codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.position() + 4); + } + + if (!filled.get(137)) { + codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position(codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position() + 16); } if (!filled.get(136)) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position( - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position() + 16); + codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position(codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position() + 16); } - if (!filled.get(135)) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position( - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position() - + 16); + if (!filled.get(139)) { + codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position(codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position() + 16); } if (!filled.get(138)) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position( - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position() + 16); + codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position(codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position() + 16); } - if (!filled.get(137)) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position( - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position() + 16); + if (!filled.get(107)) { + codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position(codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position() + 4); } if (!filled.get(106)) { - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position( - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position() - + 4); - } - - if (!filled.get(105)) { - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi - .position( - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi - .position() - + 4); + codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.position(codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.position() + 4); } if (!filled.get(3)) { @@ -8235,7 +6820,7 @@ public Trace fillAndValidateRow() { contextNumberNew.position(contextNumberNew.position() + 4); } - if (!filled.get(113)) { + if (!filled.get(114)) { contextNumberXorMmuTgtId.position(contextNumberXorMmuTgtId.position() + 4); } @@ -8263,50 +6848,36 @@ public Trace fillAndValidateRow() { delta.position(delta.position() + 1); } - if (!filled.get(101)) { - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position( - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position() + 2); - } - if (!filled.get(102)) { - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position( - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position() + 2); + deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position(deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position() + 2); } - if (!filled.get(108)) { - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position( - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position() + 4); + if (!filled.get(103)) { + deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position(deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position() + 2); } if (!filled.get(109)) { - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position( - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position() + 4); + deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position(deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position() + 4); } - if (!filled.get(107)) { - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position( - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position() + 4); + if (!filled.get(110)) { + deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position(deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position() + 4); + } + + if (!filled.get(108)) { + deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position(deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position() + 4); } if (!filled.get(49)) { - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode - .position( - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode - .position() - + 1); + deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position(deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position() + 1); } if (!filled.get(50)) { - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position( - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position() + 1); + deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position(deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position() + 1); } if (!filled.get(48)) { - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .position( - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution - .position() - + 1); + deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position(deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position() + 1); } if (!filled.get(12)) { @@ -8318,57 +6889,35 @@ public Trace fillAndValidateRow() { } if (!filled.get(52)) { - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position( - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position() - + 1); + existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position(existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position() + 1); } if (!filled.get(51)) { - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position( - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position() - + 1); + existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position(existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position() + 1); } if (!filled.get(53)) { - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn - .position( - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn - .position() - + 1); + finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position(finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position() + 1); } if (!filled.get(54)) { - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .position( - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges - .position() - + 1); + finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.position(finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.position() + 1); } if (!filled.get(55)) { - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position( - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig - .position() - + 1); + finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position(finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position() + 1); } if (!filled.get(56)) { - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position( - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero - .position() - + 1); + firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position(firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position() + 1); } if (!filled.get(57)) { - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position( - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position() + 1); + firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position(firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position() + 1); } if (!filled.get(58)) { - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position( - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig - .position() - + 1); + firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position(firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position() + 1); } if (!filled.get(14)) { @@ -8383,7 +6932,7 @@ public Trace fillAndValidateRow() { gasExpected.position(gasExpected.position() + 8); } - if (!filled.get(126)) { + if (!filled.get(127)) { gasLimit.position(gasLimit.position() + 8); } @@ -8391,20 +6940,16 @@ public Trace fillAndValidateRow() { gasNext.position(gasNext.position() + 8); } - if (!filled.get(127)) { + if (!filled.get(128)) { gasPrice.position(gasPrice.position() + 8); } if (!filled.get(60)) { - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position( - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position() + 1); + hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position(hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position() + 1); } if (!filled.get(59)) { - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position( - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero - .position() - + 1); + hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position(hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position() + 1); } if (!filled.get(18)) { @@ -8423,13 +6968,12 @@ public Trace fillAndValidateRow() { hubStampTransactionEnd.position(hubStampTransactionEnd.position() + 4); } - if (!filled.get(165)) { - instruction.position(instruction.position() + 32); + if (!filled.get(96)) { + instruction.position(instruction.position() + 1); } if (!filled.get(61)) { - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position( - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position() + 1); + isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position(isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position() + 1); } if (!filled.get(22)) { @@ -8437,43 +6981,38 @@ public Trace fillAndValidateRow() { } if (!filled.get(63)) { - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position( - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position() - + 1); + markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position(markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position() + 1); } if (!filled.get(62)) { - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position( - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew - .position() - + 1); + markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position(markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position() + 1); } if (!filled.get(23)) { mmuStamp.position(mmuStamp.position() + 4); } - if (!filled.get(145)) { + if (!filled.get(146)) { mxpOffset2Hi.position(mxpOffset2Hi.position() + 16); } - if (!filled.get(146)) { + if (!filled.get(147)) { mxpOffset2Lo.position(mxpOffset2Lo.position() + 16); } - if (!filled.get(147)) { + if (!filled.get(148)) { mxpSize1Hi.position(mxpSize1Hi.position() + 16); } - if (!filled.get(148)) { + if (!filled.get(149)) { mxpSize1Lo.position(mxpSize1Lo.position() + 16); } - if (!filled.get(149)) { + if (!filled.get(150)) { mxpSize2Hi.position(mxpSize2Hi.position() + 16); } - if (!filled.get(150)) { + if (!filled.get(151)) { mxpSize2Lo.position(mxpSize2Lo.position() + 16); } @@ -8481,7 +7020,7 @@ public Trace fillAndValidateRow() { mxpStamp.position(mxpStamp.position() + 4); } - if (!filled.get(151)) { + if (!filled.get(152)) { mxpWords.position(mxpWords.position() + 16); } @@ -8489,53 +7028,51 @@ public Trace fillAndValidateRow() { nonStackRows.position(nonStackRows.position() + 1); } - if (!filled.get(128)) { + if (!filled.get(129)) { nonce.position(nonce.position() + 8); } - if (!filled.get(124)) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position( - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position() + 8); + if (!filled.get(125)) { + nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position(nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position() + 8); } - if (!filled.get(123)) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position( - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position() + 8); + if (!filled.get(124)) { + nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position(nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position() + 8); } - if (!filled.get(152)) { + if (!filled.get(153)) { oobData1.position(oobData1.position() + 16); } - if (!filled.get(153)) { + if (!filled.get(154)) { oobData2.position(oobData2.position() + 16); } - if (!filled.get(154)) { + if (!filled.get(155)) { oobData3.position(oobData3.position() + 16); } - if (!filled.get(155)) { + if (!filled.get(156)) { oobData4.position(oobData4.position() + 16); } - if (!filled.get(156)) { + if (!filled.get(157)) { oobData5.position(oobData5.position() + 16); } - if (!filled.get(157)) { + if (!filled.get(158)) { oobData6.position(oobData6.position() + 16); } - if (!filled.get(158)) { + if (!filled.get(159)) { oobData7.position(oobData7.position() + 16); } - if (!filled.get(159)) { + if (!filled.get(160)) { oobData8.position(oobData8.position() + 16); } - if (!filled.get(160)) { + if (!filled.get(161)) { oobData9.position(oobData9.position() + 16); } @@ -8608,11 +7145,10 @@ public Trace fillAndValidateRow() { } if (!filled.get(79)) { - prcSuccessCallerWontRevertXorShfFlag.position( - prcSuccessCallerWontRevertXorShfFlag.position() + 1); + prcSuccessCallerWontRevertXorShfFlag.position(prcSuccessCallerWontRevertXorShfFlag.position() + 1); } - if (!filled.get(129)) { + if (!filled.get(130)) { priorityFeePerGas.position(priorityFeePerGas.position() + 8); } @@ -8628,7 +7164,7 @@ public Trace fillAndValidateRow() { refundCounter.position(refundCounter.position() + 4); } - if (!filled.get(130)) { + if (!filled.get(131)) { refundCounterInfinity.position(refundCounterInfinity.position() + 8); } @@ -8636,7 +7172,7 @@ public Trace fillAndValidateRow() { refundCounterNew.position(refundCounterNew.position() + 4); } - if (!filled.get(131)) { + if (!filled.get(132)) { refundEffective.position(refundEffective.position() + 8); } @@ -8644,24 +7180,23 @@ public Trace fillAndValidateRow() { relativeBlockNumber.position(relativeBlockNumber.position() + 2); } - if (!filled.get(114)) { + if (!filled.get(115)) { returnAtCapacityXorMxpInst.position(returnAtCapacityXorMxpInst.position() + 4); } - if (!filled.get(115)) { + if (!filled.get(116)) { returnAtOffsetXorOobInst.position(returnAtOffsetXorOobInst.position() + 4); } - if (!filled.get(116)) { - returnDataContextNumberXorStpGasStipend.position( - returnDataContextNumberXorStpGasStipend.position() + 4); + if (!filled.get(117)) { + returnDataContextNumberXorStpGasStipend.position(returnDataContextNumberXorStpGasStipend.position() + 4); } - if (!filled.get(117)) { + if (!filled.get(118)) { returnDataOffsetXorStpInstruction.position(returnDataOffsetXorStpInstruction.position() + 4); } - if (!filled.get(118)) { + if (!filled.get(119)) { returnDataSize.position(returnDataSize.position() + 4); } @@ -8670,80 +7205,63 @@ public Trace fillAndValidateRow() { } if (!filled.get(81)) { - returnFromDeploymentEmptyCodeWillRevertXorSstorex.position( - returnFromDeploymentEmptyCodeWillRevertXorSstorex.position() + 1); + returnFromDeploymentEmptyCodeWillRevertXorSstorex.position(returnFromDeploymentEmptyCodeWillRevertXorSstorex.position() + 1); } if (!filled.get(82)) { - returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position( - returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position() + 1); + returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position(returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position() + 1); } if (!filled.get(83)) { - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position( - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position() + 1); + returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position(returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position() + 1); } if (!filled.get(84)) { - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position( - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position() + 1); + returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position(returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position() + 1); } if (!filled.get(85)) { - returnFromMessageCallWillTouchRamXorStackItemPop3.position( - returnFromMessageCallWillTouchRamXorStackItemPop3.position() + 1); + returnFromMessageCallWillTouchRamXorStackItemPop3.position(returnFromMessageCallWillTouchRamXorStackItemPop3.position() + 1); } if (!filled.get(86)) { - returnFromMessageCallWontTouchRamXorStackItemPop4.position( - returnFromMessageCallWontTouchRamXorStackItemPop4.position() + 1); + returnFromMessageCallWontTouchRamXorStackItemPop4.position(returnFromMessageCallWontTouchRamXorStackItemPop4.position() + 1); } - if (!filled.get(110)) { - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position( - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position() + 4); + if (!filled.get(111)) { + rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position(rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position() + 4); } - if (!filled.get(139)) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position( - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position() + 16); + if (!filled.get(140)) { + rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position(rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position() + 16); } if (!filled.get(64)) { - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired - .position( - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired - .position() - + 1); + rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.position(rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.position() + 1); } - if (!filled.get(140)) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position( - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position() + 16); + if (!filled.get(141)) { + rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position(rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position() + 16); } - if (!filled.get(141)) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position( - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position() + 16); + if (!filled.get(142)) { + rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position(rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position() + 16); } - if (!filled.get(96)) { + if (!filled.get(97)) { rlpaddrRecipe.position(rlpaddrRecipe.position() + 1); } - if (!filled.get(142)) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position( - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position() + 16); + if (!filled.get(143)) { + rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position(rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position() + 16); } - if (!filled.get(143)) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position( - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position() + 16); + if (!filled.get(144)) { + rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position(rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position() + 16); } if (!filled.get(65)) { - romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position( - romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position() + 1); + romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position(romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position() + 1); } if (!filled.get(87)) { @@ -8751,66 +7269,62 @@ public Trace fillAndValidateRow() { } if (!filled.get(88)) { - selfdestructWillRevertXorStaticFlag.position( - selfdestructWillRevertXorStaticFlag.position() + 1); + selfdestructWillRevertXorStaticFlag.position(selfdestructWillRevertXorStaticFlag.position() + 1); } if (!filled.get(89)) { - selfdestructWontRevertAlreadyMarkedXorStoFlag.position( - selfdestructWontRevertAlreadyMarkedXorStoFlag.position() + 1); + selfdestructWontRevertAlreadyMarkedXorStoFlag.position(selfdestructWontRevertAlreadyMarkedXorStoFlag.position() + 1); } if (!filled.get(90)) { - selfdestructWontRevertNotYetMarkedXorSux.position( - selfdestructWontRevertNotYetMarkedXorSux.position() + 1); + selfdestructWontRevertNotYetMarkedXorSux.position(selfdestructWontRevertNotYetMarkedXorSux.position() + 1); } - if (!filled.get(98)) { + if (!filled.get(99)) { stackItemHeight2.position(stackItemHeight2.position() + 2); } - if (!filled.get(99)) { + if (!filled.get(100)) { stackItemHeight3.position(stackItemHeight3.position() + 2); } - if (!filled.get(100)) { + if (!filled.get(101)) { stackItemHeight4.position(stackItemHeight4.position() + 2); } - if (!filled.get(119)) { + if (!filled.get(120)) { stackItemStamp1.position(stackItemStamp1.position() + 5); } - if (!filled.get(120)) { + if (!filled.get(121)) { stackItemStamp2.position(stackItemStamp2.position() + 5); } - if (!filled.get(121)) { + if (!filled.get(122)) { stackItemStamp3.position(stackItemStamp3.position() + 5); } - if (!filled.get(122)) { + if (!filled.get(123)) { stackItemStamp4.position(stackItemStamp4.position() + 5); } - if (!filled.get(161)) { + if (!filled.get(162)) { stpGasHi.position(stpGasHi.position() + 16); } - if (!filled.get(162)) { + if (!filled.get(163)) { stpGasLo.position(stpGasLo.position() + 16); } - if (!filled.get(125)) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position( - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position() + 8); + if (!filled.get(126)) { + stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position(stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position() + 8); } - if (!filled.get(163)) { + if (!filled.get(164)) { stpValueHi.position(stpValueHi.position() + 16); } - if (!filled.get(164)) { + if (!filled.get(165)) { stpValueLo.position(stpValueLo.position() + 16); } @@ -8823,11 +7337,10 @@ public Trace fillAndValidateRow() { } if (!filled.get(66)) { - trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position( - trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position() + 1); + trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position(trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position() + 1); } - if (!filled.get(144)) { + if (!filled.get(145)) { trmRawAddressHiXorMxpOffset1Lo.position(trmRawAddressHiXorMxpOffset1Lo.position() + 16); } @@ -8860,8 +7373,7 @@ public Trace fillAndValidateRow() { } if (!filled.get(68)) { - warmthNewXorPrcEcaddXorLogInfoFlag.position( - warmthNewXorPrcEcaddXorLogInfoFlag.position() + 1); + warmthNewXorPrcEcaddXorLogInfoFlag.position(warmthNewXorPrcEcaddXorLogInfoFlag.position() + 1); } if (!filled.get(67)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/StackFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/StackFragment.java index ea9b834c6..c85543bab 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/StackFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/StackFragment.java @@ -239,7 +239,7 @@ public Trace trace(Trace trace) { // Instruction details .pStackAlpha(UnsignedByte.of(stack.getCurrentOpcodeData().stackSettings().alpha())) .pStackDelta(UnsignedByte.of(stack.getCurrentOpcodeData().stackSettings().delta())) - .pStackInstruction(Bytes.of(rawOpCode)) + .pStackInstruction(UnsignedByte.of(rawOpCode)) .pStackStaticGas(staticGas) // Opcode families .pStackAccFlag(currentInstFamily == ACCOUNT) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java index 384cca127..68ef06395 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java @@ -15,12 +15,14 @@ package net.consensys.linea.zktracer.module.logdata; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; import java.util.List; import net.consensys.linea.zktracer.ColumnHeader; +import net.consensys.linea.zktracer.types.UnsignedByte; import org.apache.tuweni.bytes.Bytes; /** @@ -44,19 +46,19 @@ public class Trace { private final MappedByteBuffer sizeTotal; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("logdata.ABS_LOG_NUM", 3, length)); - headers.add(new ColumnHeader("logdata.ABS_LOG_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("logdata.INDEX", 3, length)); - headers.add(new ColumnHeader("logdata.LIMB", 16, length)); - headers.add(new ColumnHeader("logdata.LOGS_DATA", 1, length)); - headers.add(new ColumnHeader("logdata.SIZE_ACC", 4, length)); - headers.add(new ColumnHeader("logdata.SIZE_LIMB", 1, length)); - headers.add(new ColumnHeader("logdata.SIZE_TOTAL", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("logdata.ABS_LOG_NUM", 3, length)); + headers.add(new ColumnHeader("logdata.ABS_LOG_NUM_MAX", 3, length)); + headers.add(new ColumnHeader("logdata.INDEX", 3, length)); + headers.add(new ColumnHeader("logdata.LIMB", 16, length)); + headers.add(new ColumnHeader("logdata.LOGS_DATA", 1, length)); + headers.add(new ColumnHeader("logdata.SIZE_ACC", 4, length)); + headers.add(new ColumnHeader("logdata.SIZE_LIMB", 1, length)); + headers.add(new ColumnHeader("logdata.SIZE_TOTAL", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.absLogNum = buffers.get(0); this.absLogNumMax = buffers.get(1); this.index = buffers.get(2); @@ -82,13 +84,12 @@ public Trace absLogNum(final long b) { filled.set(0); } - if (b >= 16777216L) { - throw new IllegalArgumentException("logdata.ABS_LOG_NUM has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("logdata.ABS_LOG_NUM has invalid value (" + b + ")"); } absLogNum.put((byte) (b >> 16)); absLogNum.put((byte) (b >> 8)); absLogNum.put((byte) b); + return this; } @@ -99,13 +100,12 @@ public Trace absLogNumMax(final long b) { filled.set(1); } - if (b >= 16777216L) { - throw new IllegalArgumentException("logdata.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("logdata.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } absLogNumMax.put((byte) (b >> 16)); absLogNumMax.put((byte) (b >> 8)); absLogNumMax.put((byte) b); + return this; } @@ -116,13 +116,12 @@ public Trace index(final long b) { filled.set(2); } - if (b >= 16777216L) { - throw new IllegalArgumentException("logdata.INDEX has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("logdata.INDEX has invalid value (" + b + ")"); } index.put((byte) (b >> 16)); index.put((byte) (b >> 8)); index.put((byte) b); + return this; } @@ -136,18 +135,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "logdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("logdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("logdata.SIZE_ACC has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("logdata.SIZE_ACC has invalid value (" + b + ")"); } sizeAcc.put((byte) (b >> 24)); sizeAcc.put((byte) (b >> 16)); sizeAcc.put((byte) (b >> 8)); sizeAcc.put((byte) b); + return this; } @@ -189,11 +180,10 @@ public Trace sizeLimb(final long b) { filled.set(6); } - if (b >= 32L) { - throw new IllegalArgumentException("logdata.SIZE_LIMB has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("logdata.SIZE_LIMB has invalid value (" + b + ")"); } sizeLimb.put((byte) b); + return this; } @@ -204,14 +194,13 @@ public Trace sizeTotal(final long b) { filled.set(7); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("logdata.SIZE_TOTAL has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("logdata.SIZE_TOTAL has invalid value (" + b + ")"); } sizeTotal.put((byte) (b >> 24)); sizeTotal.put((byte) (b >> 16)); sizeTotal.put((byte) (b >> 8)); sizeTotal.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java index 82064607e..bd8421645 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.loginfo; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -64,38 +65,38 @@ public class Trace { private final MappedByteBuffer txnEmitsLogs; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("loginfo.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("loginfo.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("loginfo.CT", 1, length)); - headers.add(new ColumnHeader("loginfo.CT_MAX", 1, length)); - headers.add(new ColumnHeader("loginfo.DATA_HI", 16, length)); - headers.add(new ColumnHeader("loginfo.DATA_LO", 16, length)); - headers.add(new ColumnHeader("loginfo.DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("loginfo.INST", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_0", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_1", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_2", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_3", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_4", 1, length)); - headers.add(new ColumnHeader("loginfo.PHASE", 2, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_1", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_2", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_3", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_4", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_1", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_2", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_3", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_4", 32, length)); - headers.add(new ColumnHeader("loginfo.TXN_EMITS_LOGS", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM", 3, length)); + headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM_MAX", 3, length)); + headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM", 3, length)); + headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM_MAX", 3, length)); + headers.add(new ColumnHeader("loginfo.ADDR_HI", 4, length)); + headers.add(new ColumnHeader("loginfo.ADDR_LO", 16, length)); + headers.add(new ColumnHeader("loginfo.CT", 1, length)); + headers.add(new ColumnHeader("loginfo.CT_MAX", 1, length)); + headers.add(new ColumnHeader("loginfo.DATA_HI", 16, length)); + headers.add(new ColumnHeader("loginfo.DATA_LO", 16, length)); + headers.add(new ColumnHeader("loginfo.DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("loginfo.INST", 1, length)); + headers.add(new ColumnHeader("loginfo.IS_LOG_X_0", 1, length)); + headers.add(new ColumnHeader("loginfo.IS_LOG_X_1", 1, length)); + headers.add(new ColumnHeader("loginfo.IS_LOG_X_2", 1, length)); + headers.add(new ColumnHeader("loginfo.IS_LOG_X_3", 1, length)); + headers.add(new ColumnHeader("loginfo.IS_LOG_X_4", 1, length)); + headers.add(new ColumnHeader("loginfo.PHASE", 2, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_HI_1", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_HI_2", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_HI_3", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_HI_4", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_LO_1", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_LO_2", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_LO_3", 32, length)); + headers.add(new ColumnHeader("loginfo.TOPIC_LO_4", 32, length)); + headers.add(new ColumnHeader("loginfo.TXN_EMITS_LOGS", 1, length)); + return headers; + } + + public Trace (List buffers) { this.absLogNum = buffers.get(0); this.absLogNumMax = buffers.get(1); this.absTxnNum = buffers.get(2); @@ -140,13 +141,12 @@ public Trace absLogNum(final long b) { filled.set(0); } - if (b >= 16777216L) { - throw new IllegalArgumentException("loginfo.ABS_LOG_NUM has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_LOG_NUM has invalid value (" + b + ")"); } absLogNum.put((byte) (b >> 16)); absLogNum.put((byte) (b >> 8)); absLogNum.put((byte) b); + return this; } @@ -157,13 +157,12 @@ public Trace absLogNumMax(final long b) { filled.set(1); } - if (b >= 16777216L) { - throw new IllegalArgumentException("loginfo.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } absLogNumMax.put((byte) (b >> 16)); absLogNumMax.put((byte) (b >> 8)); absLogNumMax.put((byte) b); + return this; } @@ -174,13 +173,12 @@ public Trace absTxnNum(final long b) { filled.set(2); } - if (b >= 16777216L) { - throw new IllegalArgumentException("loginfo.ABS_TXN_NUM has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_TXN_NUM has invalid value (" + b + ")"); } absTxnNum.put((byte) (b >> 16)); absTxnNum.put((byte) (b >> 8)); absTxnNum.put((byte) b); + return this; } @@ -191,13 +189,12 @@ public Trace absTxnNumMax(final long b) { filled.set(3); } - if (b >= 16777216L) { - throw new IllegalArgumentException("loginfo.ABS_TXN_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_TXN_NUM_MAX has invalid value (" + b + ")"); } absTxnNumMax.put((byte) (b >> 16)); absTxnNumMax.put((byte) (b >> 8)); absTxnNumMax.put((byte) b); + return this; } @@ -208,14 +205,13 @@ public Trace addrHi(final long b) { filled.set(4); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("loginfo.ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("loginfo.ADDR_HI has invalid value (" + b + ")"); } addrHi.put((byte) (b >> 24)); addrHi.put((byte) (b >> 16)); addrHi.put((byte) (b >> 8)); addrHi.put((byte) b); + return this; } @@ -229,18 +225,11 @@ public Trace addrLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "loginfo.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("loginfo.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addrLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addrLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "loginfo.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("loginfo.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "loginfo.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("loginfo.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("loginfo.DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("loginfo.DATA_SIZE has invalid value (" + b + ")"); } dataSize.put((byte) (b >> 24)); dataSize.put((byte) (b >> 16)); dataSize.put((byte) (b >> 8)); dataSize.put((byte) b); + return this; } @@ -418,12 +392,11 @@ public Trace phase(final long b) { filled.set(17); } - if (b >= 65536L) { - throw new IllegalArgumentException("loginfo.PHASE has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("loginfo.PHASE has invalid value (" + b + ")"); } phase.put((byte) (b >> 8)); phase.put((byte) b); + return this; } @@ -437,18 +410,11 @@ public Trace topicHi1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_HI_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicHi1.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicHi1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicHi1.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_HI_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicHi2.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicHi2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicHi2.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_HI_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicHi3.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicHi3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicHi3.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_HI_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicHi4.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicHi4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicHi4.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_LO_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicLo1.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicLo1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicLo1.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_LO_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicLo2.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicLo2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicLo2.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_LO_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicLo3.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicLo3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicLo3.put(bs.get(j)); - } + for(int j=0; j 256) { - throw new IllegalArgumentException( - "loginfo.TOPIC_LO_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - topicLo4.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { topicLo4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - topicLo4.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mmio.ACC_1", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_2", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_3", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_4", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_A", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_B", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_C", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_LIMB", 16, length)); - headers.add(new ColumnHeader("mmio.BIT_1", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_2", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_3", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_4", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_5", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_A", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_B", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_C", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_LIMB", 1, length)); - headers.add(new ColumnHeader("mmio.CN_A", 8, length)); - headers.add(new ColumnHeader("mmio.CN_B", 8, length)); - headers.add(new ColumnHeader("mmio.CN_C", 8, length)); - headers.add(new ColumnHeader("mmio.CONTEXT_SOURCE", 8, length)); - headers.add(new ColumnHeader("mmio.CONTEXT_TARGET", 8, length)); - headers.add(new ColumnHeader("mmio.COUNTER", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_ID", 4, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_BLAKEMODEXP", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_ECDATA", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_KEC", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_LOG", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_RIPSHA", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_ROM", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_TXCD", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_SUM", 4, length)); - headers.add(new ColumnHeader("mmio.FAST", 1, length)); - headers.add(new ColumnHeader("mmio.INDEX_A", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_B", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_C", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_X", 8, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_ONE_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TWO_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_VANISHES", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_EXCISION", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_ONE_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TWO_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_PARTIAL", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_VANISHES", 1, length)); - headers.add(new ColumnHeader("mmio.KEC_ID", 4, length)); - headers.add(new ColumnHeader("mmio.LIMB", 16, length)); - headers.add(new ColumnHeader("mmio.MMIO_INSTRUCTION", 2, length)); - headers.add(new ColumnHeader("mmio.MMIO_STAMP", 4, length)); - headers.add(new ColumnHeader("mmio.PHASE", 4, length)); - headers.add(new ColumnHeader("mmio.POW_256_1", 16, length)); - headers.add(new ColumnHeader("mmio.POW_256_2", 16, length)); - headers.add(new ColumnHeader("mmio.SIZE", 8, length)); - headers.add(new ColumnHeader("mmio.SLOW", 1, length)); - headers.add(new ColumnHeader("mmio.SOURCE_BYTE_OFFSET", 1, length)); - headers.add(new ColumnHeader("mmio.SOURCE_LIMB_OFFSET", 8, length)); - headers.add(new ColumnHeader("mmio.SUCCESS_BIT", 1, length)); - headers.add(new ColumnHeader("mmio.TARGET_BYTE_OFFSET", 1, length)); - headers.add(new ColumnHeader("mmio.TARGET_LIMB_OFFSET", 8, length)); - headers.add(new ColumnHeader("mmio.TOTAL_SIZE", 8, length)); - headers.add(new ColumnHeader("mmio.VAL_A", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_A_NEW", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_B", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_B_NEW", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_C", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_C_NEW", 16, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("mmio.ACC_1", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_2", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_3", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_4", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_A", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_B", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_C", 16, length)); + headers.add(new ColumnHeader("mmio.ACC_LIMB", 16, length)); + headers.add(new ColumnHeader("mmio.BIT_1", 1, length)); + headers.add(new ColumnHeader("mmio.BIT_2", 1, length)); + headers.add(new ColumnHeader("mmio.BIT_3", 1, length)); + headers.add(new ColumnHeader("mmio.BIT_4", 1, length)); + headers.add(new ColumnHeader("mmio.BIT_5", 1, length)); + headers.add(new ColumnHeader("mmio.BYTE_A", 1, length)); + headers.add(new ColumnHeader("mmio.BYTE_B", 1, length)); + headers.add(new ColumnHeader("mmio.BYTE_C", 1, length)); + headers.add(new ColumnHeader("mmio.BYTE_LIMB", 1, length)); + headers.add(new ColumnHeader("mmio.CN_A", 8, length)); + headers.add(new ColumnHeader("mmio.CN_B", 8, length)); + headers.add(new ColumnHeader("mmio.CN_C", 8, length)); + headers.add(new ColumnHeader("mmio.CONTEXT_SOURCE", 8, length)); + headers.add(new ColumnHeader("mmio.CONTEXT_TARGET", 8, length)); + headers.add(new ColumnHeader("mmio.COUNTER", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_ID", 4, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_BLAKEMODEXP", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_ECDATA", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_KEC", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_LOG", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_RIPSHA", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_ROM", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_IS_TXCD", 1, length)); + headers.add(new ColumnHeader("mmio.EXO_SUM", 4, length)); + headers.add(new ColumnHeader("mmio.FAST", 1, length)); + headers.add(new ColumnHeader("mmio.INDEX_A", 8, length)); + headers.add(new ColumnHeader("mmio.INDEX_B", 8, length)); + headers.add(new ColumnHeader("mmio.INDEX_C", 8, length)); + headers.add(new ColumnHeader("mmio.INDEX_X", 8, length)); + headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_ONE_TARGET", 1, length)); + headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TRANSPLANT", 1, length)); + headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TWO_TARGET", 1, length)); + headers.add(new ColumnHeader("mmio.IS_LIMB_VANISHES", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_EXCISION", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_ONE_SOURCE", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TRANSPLANT", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TWO_SOURCE", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_PARTIAL", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TRANSPLANT", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_SOURCE", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_TARGET", 1, length)); + headers.add(new ColumnHeader("mmio.IS_RAM_VANISHES", 1, length)); + headers.add(new ColumnHeader("mmio.KEC_ID", 4, length)); + headers.add(new ColumnHeader("mmio.LIMB", 16, length)); + headers.add(new ColumnHeader("mmio.MMIO_INSTRUCTION", 2, length)); + headers.add(new ColumnHeader("mmio.MMIO_STAMP", 4, length)); + headers.add(new ColumnHeader("mmio.PHASE", 4, length)); + headers.add(new ColumnHeader("mmio.POW_256_1", 16, length)); + headers.add(new ColumnHeader("mmio.POW_256_2", 16, length)); + headers.add(new ColumnHeader("mmio.SIZE", 8, length)); + headers.add(new ColumnHeader("mmio.SLOW", 1, length)); + headers.add(new ColumnHeader("mmio.SOURCE_BYTE_OFFSET", 1, length)); + headers.add(new ColumnHeader("mmio.SOURCE_LIMB_OFFSET", 8, length)); + headers.add(new ColumnHeader("mmio.SUCCESS_BIT", 1, length)); + headers.add(new ColumnHeader("mmio.TARGET_BYTE_OFFSET", 1, length)); + headers.add(new ColumnHeader("mmio.TARGET_LIMB_OFFSET", 8, length)); + headers.add(new ColumnHeader("mmio.TOTAL_SIZE", 8, length)); + headers.add(new ColumnHeader("mmio.VAL_A", 16, length)); + headers.add(new ColumnHeader("mmio.VAL_A_NEW", 16, length)); + headers.add(new ColumnHeader("mmio.VAL_B", 16, length)); + headers.add(new ColumnHeader("mmio.VAL_B_NEW", 16, length)); + headers.add(new ColumnHeader("mmio.VAL_C", 16, length)); + headers.add(new ColumnHeader("mmio.VAL_C_NEW", 16, length)); + return headers; + } + + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.acc3 = buffers.get(2); @@ -275,18 +276,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mmio.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accA.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_B has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_B has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accB.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_C has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_C has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accC.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accC.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.ACC_LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accLimb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accLimb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accLimb.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.CN_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.CN_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cnA.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cnA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cnA.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.CN_B has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.CN_B has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cnB.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cnB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cnB.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.CN_C has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.CN_C has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cnC.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cnC.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cnC.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.CONTEXT_SOURCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.CONTEXT_SOURCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - contextSource.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { contextSource.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - contextSource.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.CONTEXT_TARGET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.CONTEXT_TARGET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - contextTarget.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { contextTarget.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - contextTarget.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("mmio.COUNTER has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("mmio.COUNTER has invalid value (" + b + ")"); } counter.put((byte) b); + return this; } @@ -733,14 +642,13 @@ public Trace exoId(final long b) { filled.set(23); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmio.EXO_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.EXO_ID has invalid value (" + b + ")"); } exoId.put((byte) (b >> 24)); exoId.put((byte) (b >> 16)); exoId.put((byte) (b >> 8)); exoId.put((byte) b); + return this; } @@ -835,14 +743,13 @@ public Trace exoSum(final long b) { filled.set(31); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmio.EXO_SUM has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.EXO_SUM has invalid value (" + b + ")"); } exoSum.put((byte) (b >> 24)); exoSum.put((byte) (b >> 16)); exoSum.put((byte) (b >> 8)); exoSum.put((byte) b); + return this; } @@ -868,18 +775,11 @@ public Trace indexA(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmio.INDEX_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.INDEX_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - indexA.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { indexA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - indexA.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.INDEX_B has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.INDEX_B has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - indexB.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { indexB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - indexB.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.INDEX_C has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.INDEX_C has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - indexC.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { indexC.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - indexC.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.INDEX_X has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.INDEX_X has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - indexX.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { indexX.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - indexX.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmio.KEC_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.KEC_ID has invalid value (" + b + ")"); } kecId.put((byte) (b >> 24)); kecId.put((byte) (b >> 16)); kecId.put((byte) (b >> 8)); kecId.put((byte) b); + return this; } @@ -1146,18 +1024,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mmio.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("mmio.MMIO_INSTRUCTION has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("mmio.MMIO_INSTRUCTION has invalid value (" + b + ")"); } mmioInstruction.put((byte) (b >> 8)); mmioInstruction.put((byte) b); + return this; } @@ -1185,14 +1055,13 @@ public Trace mmioStamp(final long b) { filled.set(53); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmio.MMIO_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.MMIO_STAMP has invalid value (" + b + ")"); } mmioStamp.put((byte) (b >> 24)); mmioStamp.put((byte) (b >> 16)); mmioStamp.put((byte) (b >> 8)); mmioStamp.put((byte) b); + return this; } @@ -1203,14 +1072,13 @@ public Trace phase(final long b) { filled.set(54); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmio.PHASE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.PHASE has invalid value (" + b + ")"); } phase.put((byte) (b >> 24)); phase.put((byte) (b >> 16)); phase.put((byte) (b >> 8)); phase.put((byte) b); + return this; } @@ -1224,18 +1092,11 @@ public Trace pow2561(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mmio.POW_256_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.POW_256_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - pow2561.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { pow2561.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - pow2561.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.POW_256_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.POW_256_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - pow2562.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { pow2562.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - pow2562.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.SIZE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.SIZE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - size.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { size.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - size.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("mmio.SOURCE_BYTE_OFFSET has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("mmio.SOURCE_BYTE_OFFSET has invalid value (" + b + ")"); } sourceByteOffset.put((byte) b); + return this; } @@ -1329,18 +1175,11 @@ public Trace sourceLimbOffset(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmio.SOURCE_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.SOURCE_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - sourceLimbOffset.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { sourceLimbOffset.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - sourceLimbOffset.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("mmio.TARGET_BYTE_OFFSET has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("mmio.TARGET_BYTE_OFFSET has invalid value (" + b + ")"); } targetByteOffset.put((byte) b); + return this; } @@ -1382,18 +1220,11 @@ public Trace targetLimbOffset(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmio.TARGET_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.TARGET_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - targetLimbOffset.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { targetLimbOffset.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - targetLimbOffset.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmio.TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - totalSize.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { totalSize.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - totalSize.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valA.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valA.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_A_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_A_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valANew.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valANew.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valANew.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_B has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_B has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valB.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valB.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_B_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_B_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valBNew.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valBNew.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valBNew.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_C has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_C has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valC.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valC.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valC.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmio.VAL_C_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.VAL_C_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valCNew.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valCNew.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valCNew.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mmu.AUX_ID_xor_CN_S_xor_EUC_A", 8, length)); - headers.add(new ColumnHeader("mmu.BIN_1", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_2", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_3", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_4", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_5", 1, length)); - headers.add(new ColumnHeader("mmu.EXO_SUM_xor_EXO_ID", 4, length)); - headers.add(new ColumnHeader("mmu.INST_xor_INST_xor_CT", 2, length)); - headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA", 1, length)); - headers.add(new ColumnHeader("mmu.IS_BLAKE", 1, length)); - headers.add(new ColumnHeader("mmu.IS_EXO_TO_RAM_TRANSPLANTS", 1, length)); - headers.add(new ColumnHeader("mmu.IS_INVALID_CODE_PREFIX", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MLOAD", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MODEXP_DATA", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MODEXP_ZERO", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MSTORE", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MSTORE8", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RAM_TO_EXO_WITH_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RAM_TO_RAM_SANS_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RIGHT_PADDED_WORD_EXTRACTION", 1, length)); - headers.add(new ColumnHeader("mmu.KEC_ID", 4, length)); - headers.add(new ColumnHeader("mmu.LIMB_1_xor_LIMB_xor_WCP_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mmu.LIMB_2_xor_WCP_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mmu.LZRO", 1, length)); - headers.add(new ColumnHeader("mmu.MACRO", 1, length)); - headers.add(new ColumnHeader("mmu.MICRO", 1, length)); - headers.add(new ColumnHeader("mmu.MMIO_STAMP", 4, length)); - headers.add(new ColumnHeader("mmu.NT_FIRST", 1, length)); - headers.add(new ColumnHeader("mmu.NT_LAST", 1, length)); - headers.add(new ColumnHeader("mmu.NT_MDDL", 1, length)); - headers.add(new ColumnHeader("mmu.NT_ONLY", 1, length)); - headers.add(new ColumnHeader("mmu.OUT_1", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_2", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_3", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_4", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_5", 8, length)); - headers.add(new ColumnHeader("mmu.PHASE", 4, length)); - headers.add(new ColumnHeader("mmu.PHASE_xor_EXO_SUM", 4, length)); - headers.add(new ColumnHeader("mmu.PRPRC", 1, length)); - headers.add(new ColumnHeader("mmu.REF_OFFSET_xor_CN_T_xor_EUC_B", 8, length)); - headers.add(new ColumnHeader("mmu.REF_SIZE_xor_SLO_xor_EUC_CEIL", 8, length)); - headers.add(new ColumnHeader("mmu.RZ_FIRST", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_LAST", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_MDDL", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_ONLY", 1, length)); - headers.add(new ColumnHeader("mmu.SBO_xor_WCP_INST", 1, length)); - headers.add(new ColumnHeader("mmu.SIZE", 1, length)); - headers.add(new ColumnHeader("mmu.SIZE_xor_TLO_xor_EUC_QUOT", 8, length)); - headers.add(new ColumnHeader("mmu.SRC_ID_xor_TOTAL_SIZE_xor_EUC_REM", 8, length)); - headers.add(new ColumnHeader("mmu.SRC_OFFSET_HI_xor_WCP_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mmu.SRC_OFFSET_LO", 16, length)); - headers.add(new ColumnHeader("mmu.STAMP", 4, length)); - headers.add(new ColumnHeader("mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("mmu.TBO", 1, length)); - headers.add(new ColumnHeader("mmu.TGT_ID", 8, length)); - headers.add(new ColumnHeader("mmu.TGT_OFFSET_LO", 8, length)); - headers.add(new ColumnHeader("mmu.TOT", 4, length)); - headers.add(new ColumnHeader("mmu.TOTLZ", 4, length)); - headers.add(new ColumnHeader("mmu.TOTNT", 4, length)); - headers.add(new ColumnHeader("mmu.TOTRZ", 4, length)); - headers.add(new ColumnHeader("mmu.WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("mmu.WCP_RES", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("mmu.AUX_ID_xor_CN_S_xor_EUC_A", 8, length)); + headers.add(new ColumnHeader("mmu.BIN_1", 1, length)); + headers.add(new ColumnHeader("mmu.BIN_2", 1, length)); + headers.add(new ColumnHeader("mmu.BIN_3", 1, length)); + headers.add(new ColumnHeader("mmu.BIN_4", 1, length)); + headers.add(new ColumnHeader("mmu.BIN_5", 1, length)); + headers.add(new ColumnHeader("mmu.EXO_SUM_xor_EXO_ID", 4, length)); + headers.add(new ColumnHeader("mmu.INST_xor_INST_xor_CT", 2, length)); + headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING", 1, length)); + headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA", 1, length)); + headers.add(new ColumnHeader("mmu.IS_BLAKE", 1, length)); + headers.add(new ColumnHeader("mmu.IS_EXO_TO_RAM_TRANSPLANTS", 1, length)); + headers.add(new ColumnHeader("mmu.IS_INVALID_CODE_PREFIX", 1, length)); + headers.add(new ColumnHeader("mmu.IS_MLOAD", 1, length)); + headers.add(new ColumnHeader("mmu.IS_MODEXP_DATA", 1, length)); + headers.add(new ColumnHeader("mmu.IS_MODEXP_ZERO", 1, length)); + headers.add(new ColumnHeader("mmu.IS_MSTORE", 1, length)); + headers.add(new ColumnHeader("mmu.IS_MSTORE8", 1, length)); + headers.add(new ColumnHeader("mmu.IS_RAM_TO_EXO_WITH_PADDING", 1, length)); + headers.add(new ColumnHeader("mmu.IS_RAM_TO_RAM_SANS_PADDING", 1, length)); + headers.add(new ColumnHeader("mmu.IS_RIGHT_PADDED_WORD_EXTRACTION", 1, length)); + headers.add(new ColumnHeader("mmu.KEC_ID", 4, length)); + headers.add(new ColumnHeader("mmu.LIMB_1_xor_LIMB_xor_WCP_ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("mmu.LIMB_2_xor_WCP_ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("mmu.LZRO", 1, length)); + headers.add(new ColumnHeader("mmu.MACRO", 1, length)); + headers.add(new ColumnHeader("mmu.MICRO", 1, length)); + headers.add(new ColumnHeader("mmu.MMIO_STAMP", 4, length)); + headers.add(new ColumnHeader("mmu.NT_FIRST", 1, length)); + headers.add(new ColumnHeader("mmu.NT_LAST", 1, length)); + headers.add(new ColumnHeader("mmu.NT_MDDL", 1, length)); + headers.add(new ColumnHeader("mmu.NT_ONLY", 1, length)); + headers.add(new ColumnHeader("mmu.OUT_1", 8, length)); + headers.add(new ColumnHeader("mmu.OUT_2", 8, length)); + headers.add(new ColumnHeader("mmu.OUT_3", 8, length)); + headers.add(new ColumnHeader("mmu.OUT_4", 8, length)); + headers.add(new ColumnHeader("mmu.OUT_5", 8, length)); + headers.add(new ColumnHeader("mmu.PHASE", 4, length)); + headers.add(new ColumnHeader("mmu.PHASE_xor_EXO_SUM", 4, length)); + headers.add(new ColumnHeader("mmu.PRPRC", 1, length)); + headers.add(new ColumnHeader("mmu.REF_OFFSET_xor_CN_T_xor_EUC_B", 8, length)); + headers.add(new ColumnHeader("mmu.REF_SIZE_xor_SLO_xor_EUC_CEIL", 8, length)); + headers.add(new ColumnHeader("mmu.RZ_FIRST", 1, length)); + headers.add(new ColumnHeader("mmu.RZ_LAST", 1, length)); + headers.add(new ColumnHeader("mmu.RZ_MDDL", 1, length)); + headers.add(new ColumnHeader("mmu.RZ_ONLY", 1, length)); + headers.add(new ColumnHeader("mmu.SBO_xor_WCP_INST", 1, length)); + headers.add(new ColumnHeader("mmu.SIZE", 1, length)); + headers.add(new ColumnHeader("mmu.SIZE_xor_TLO_xor_EUC_QUOT", 8, length)); + headers.add(new ColumnHeader("mmu.SRC_ID_xor_TOTAL_SIZE_xor_EUC_REM", 8, length)); + headers.add(new ColumnHeader("mmu.SRC_OFFSET_HI_xor_WCP_ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("mmu.SRC_OFFSET_LO", 16, length)); + headers.add(new ColumnHeader("mmu.STAMP", 4, length)); + headers.add(new ColumnHeader("mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG", 1, length)); + headers.add(new ColumnHeader("mmu.TBO", 1, length)); + headers.add(new ColumnHeader("mmu.TGT_ID", 8, length)); + headers.add(new ColumnHeader("mmu.TGT_OFFSET_LO", 8, length)); + headers.add(new ColumnHeader("mmu.TOT", 4, length)); + headers.add(new ColumnHeader("mmu.TOTLZ", 4, length)); + headers.add(new ColumnHeader("mmu.TOTNT", 4, length)); + headers.add(new ColumnHeader("mmu.TOTRZ", 4, length)); + headers.add(new ColumnHeader("mmu.WCP_FLAG", 1, length)); + headers.add(new ColumnHeader("mmu.WCP_RES", 1, length)); + return headers; + } + + public Trace (List buffers) { this.auxIdXorCnSXorEucA = buffers.get(0); this.bin1 = buffers.get(1); this.bin2 = buffers.get(2); @@ -538,14 +539,13 @@ public Trace mmioStamp(final long b) { filled.set(21); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.MMIO_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.MMIO_STAMP has invalid value (" + b + ")"); } mmioStamp.put((byte) (b >> 24)); mmioStamp.put((byte) (b >> 16)); mmioStamp.put((byte) (b >> 8)); mmioStamp.put((byte) b); + return this; } @@ -607,18 +607,11 @@ public Trace out1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmu.OUT_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - out1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { out1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - out1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.OUT_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - out2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { out2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - out2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.OUT_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - out3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { out3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - out3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.OUT_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - out4.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { out4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - out4.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.OUT_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - out5.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { out5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - out5.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/AUX_ID has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/AUX_ID has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - auxIdXorCnSXorEucA.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - auxIdXorCnSXorEucA.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmu.macro/EXO_SUM has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.macro/EXO_SUM has invalid value (" + b + ")"); } exoSumXorExoId.put((byte) (b >> 24)); exoSumXorExoId.put((byte) (b >> 16)); exoSumXorExoId.put((byte) (b >> 8)); exoSumXorExoId.put((byte) b); + return this; } @@ -778,12 +735,11 @@ public Trace pMacroInst(final long b) { filled.set(47); } - if (b >= 65536L) { - throw new IllegalArgumentException("mmu.macro/INST has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("mmu.macro/INST has invalid value (" + b + ")"); } instXorInstXorCt.put((byte) (b >> 8)); instXorInstXorCt.put((byte) b); + return this; } @@ -797,18 +753,11 @@ public Trace pMacroLimb1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mmu.macro/LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.macro/LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb1XorLimbXorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb1XorLimbXorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.macro/LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.macro/LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb2XorWcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb2XorWcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb2XorWcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmu.macro/PHASE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.macro/PHASE has invalid value (" + b + ")"); } phaseXorExoSum.put((byte) (b >> 24)); phaseXorExoSum.put((byte) (b >> 16)); phaseXorExoSum.put((byte) (b >> 8)); phaseXorExoSum.put((byte) b); + return this; } @@ -867,18 +808,11 @@ public Trace pMacroRefOffset(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmu.macro/REF_OFFSET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/REF_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refOffsetXorCnTXorEucB.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refOffsetXorCnTXorEucB.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/REF_SIZE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/REF_SIZE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refSizeXorSloXorEucCeil.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refSizeXorSloXorEucCeil.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/SIZE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/SIZE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - sizeXorTloXorEucQuot.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - sizeXorTloXorEucQuot.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/SRC_ID has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/SRC_ID has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - srcIdXorTotalSizeXorEucRem.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcIdXorTotalSizeXorEucRem.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.macro/SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.macro/SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - srcOffsetHiXorWcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { srcOffsetHiXorWcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcOffsetHiXorWcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.macro/SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.macro/SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - srcOffsetLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { srcOffsetLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcOffsetLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/TGT_ID has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/TGT_ID has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - tgtId.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { tgtId.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - tgtId.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.macro/TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - tgtOffsetLo.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { tgtOffsetLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - tgtOffsetLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.micro/CN_S has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/CN_S has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - auxIdXorCnSXorEucA.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - auxIdXorCnSXorEucA.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.micro/CN_T has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/CN_T has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refOffsetXorCnTXorEucB.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refOffsetXorCnTXorEucB.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmu.micro/EXO_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/EXO_ID has invalid value (" + b + ")"); } exoSumXorExoId.put((byte) (b >> 24)); exoSumXorExoId.put((byte) (b >> 16)); exoSumXorExoId.put((byte) (b >> 8)); exoSumXorExoId.put((byte) b); + return this; } @@ -1154,14 +1024,13 @@ public Trace pMicroExoSum(final long b) { filled.set(49); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.micro/EXO_SUM has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/EXO_SUM has invalid value (" + b + ")"); } phaseXorExoSum.put((byte) (b >> 24)); phaseXorExoSum.put((byte) (b >> 16)); phaseXorExoSum.put((byte) (b >> 8)); phaseXorExoSum.put((byte) b); + return this; } @@ -1172,12 +1041,11 @@ public Trace pMicroInst(final long b) { filled.set(47); } - if (b >= 65536L) { - throw new IllegalArgumentException("mmu.micro/INST has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("mmu.micro/INST has invalid value (" + b + ")"); } instXorInstXorCt.put((byte) (b >> 8)); instXorInstXorCt.put((byte) b); + return this; } @@ -1188,14 +1056,13 @@ public Trace pMicroKecId(final long b) { filled.set(50); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.micro/KEC_ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/KEC_ID has invalid value (" + b + ")"); } kecId.put((byte) (b >> 24)); kecId.put((byte) (b >> 16)); kecId.put((byte) (b >> 8)); kecId.put((byte) b); + return this; } @@ -1209,18 +1076,11 @@ public Trace pMicroLimb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mmu.micro/LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.micro/LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb1XorLimbXorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb1XorLimbXorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmu.micro/PHASE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/PHASE has invalid value (" + b + ")"); } phase.put((byte) (b >> 24)); phase.put((byte) (b >> 16)); phase.put((byte) (b >> 8)); phase.put((byte) b); + return this; } @@ -1277,18 +1136,11 @@ public Trace pMicroSlo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmu.micro/SLO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/SLO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refSizeXorSloXorEucCeil.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refSizeXorSloXorEucCeil.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.micro/TLO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/TLO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - sizeXorTloXorEucQuot.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - sizeXorTloXorEucQuot.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.micro/TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - srcIdXorTotalSizeXorEucRem.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcIdXorTotalSizeXorEucRem.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("mmu.prprc/CT has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("mmu.prprc/CT has invalid value (" + b + ")"); } instXorInstXorCt.put((byte) (b >> 8)); instXorInstXorCt.put((byte) b); + return this; } @@ -1395,18 +1232,11 @@ public Trace pPrprcEucA(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mmu.prprc/EUC_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - auxIdXorCnSXorEucA.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - auxIdXorCnSXorEucA.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.prprc/EUC_B has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_B has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refOffsetXorCnTXorEucB.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refOffsetXorCnTXorEucB.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.prprc/EUC_CEIL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_CEIL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - refSizeXorSloXorEucCeil.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refSizeXorSloXorEucCeil.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.prprc/EUC_QUOT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_QUOT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - sizeXorTloXorEucQuot.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - sizeXorTloXorEucQuot.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mmu.prprc/EUC_REM has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_REM has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - srcIdXorTotalSizeXorEucRem.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcIdXorTotalSizeXorEucRem.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.prprc/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb1XorLimbXorWcpArg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb1XorLimbXorWcpArg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.prprc/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb2XorWcpArg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb2XorWcpArg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb2XorWcpArg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mmu.prprc/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - srcOffsetHiXorWcpArg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { srcOffsetHiXorWcpArg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - srcOffsetHiXorWcpArg2Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mmu.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -1726,14 +1506,13 @@ public Trace tot(final long b) { filled.set(37); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.TOT has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOT has invalid value (" + b + ")"); } tot.put((byte) (b >> 24)); tot.put((byte) (b >> 16)); tot.put((byte) (b >> 8)); tot.put((byte) b); + return this; } @@ -1744,14 +1523,13 @@ public Trace totlz(final long b) { filled.set(38); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.TOTLZ has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTLZ has invalid value (" + b + ")"); } totlz.put((byte) (b >> 24)); totlz.put((byte) (b >> 16)); totlz.put((byte) (b >> 8)); totlz.put((byte) b); + return this; } @@ -1762,14 +1540,13 @@ public Trace totnt(final long b) { filled.set(39); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.TOTNT has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTNT has invalid value (" + b + ")"); } totnt.put((byte) (b >> 24)); totnt.put((byte) (b >> 16)); totnt.put((byte) (b >> 8)); totnt.put((byte) b); + return this; } @@ -1780,14 +1557,13 @@ public Trace totrz(final long b) { filled.set(40); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("mmu.TOTRZ has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTRZ has invalid value (" + b + ")"); } totrz.put((byte) (b >> 24)); totrz.put((byte) (b >> 16)); totrz.put((byte) (b >> 8)); totrz.put((byte) b); + return this; } @@ -1825,13 +1601,11 @@ public Trace validateRow() { } if (!filled.get(5)) { - throw new IllegalStateException( - "mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING has not been filled"); + throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING has not been filled"); } if (!filled.get(6)) { - throw new IllegalStateException( - "mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA has not been filled"); + throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA has not been filled"); } if (!filled.get(7)) { @@ -2007,8 +1781,7 @@ public Trace validateRow() { } if (!filled.get(41)) { - throw new IllegalStateException( - "mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG has not been filled"); + throw new IllegalStateException("mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG has not been filled"); } if (!filled.get(46)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java index 3174bb915..22717e0f0 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.mod; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -103,77 +104,77 @@ public class Trace { private final MappedByteBuffer stamp; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mod.ACC_1_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_1_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_2_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_2_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_3", 8, length)); - headers.add(new ColumnHeader("mod.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mod.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mod.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("mod.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mod.BYTE_1_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_1_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_2_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_2_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_3", 1, length)); - headers.add(new ColumnHeader("mod.CMP_1", 1, length)); - headers.add(new ColumnHeader("mod.CMP_2", 1, length)); - headers.add(new ColumnHeader("mod.CT", 1, length)); - headers.add(new ColumnHeader("mod.INST", 1, length)); - headers.add(new ColumnHeader("mod.IS_DIV", 1, length)); - headers.add(new ColumnHeader("mod.IS_MOD", 1, length)); - headers.add(new ColumnHeader("mod.IS_SDIV", 1, length)); - headers.add(new ColumnHeader("mod.IS_SMOD", 1, length)); - headers.add(new ColumnHeader("mod.MLI", 1, length)); - headers.add(new ColumnHeader("mod.MSB_1", 1, length)); - headers.add(new ColumnHeader("mod.MSB_2", 1, length)); - headers.add(new ColumnHeader("mod.OLI", 1, length)); - headers.add(new ColumnHeader("mod.RES_HI", 16, length)); - headers.add(new ColumnHeader("mod.RES_LO", 16, length)); - headers.add(new ColumnHeader("mod.SIGNED", 1, length)); - headers.add(new ColumnHeader("mod.STAMP", 4, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("mod.ACC_1_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_1_3", 8, length)); + headers.add(new ColumnHeader("mod.ACC_2_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_2_3", 8, length)); + headers.add(new ColumnHeader("mod.ACC_B_0", 8, length)); + headers.add(new ColumnHeader("mod.ACC_B_1", 8, length)); + headers.add(new ColumnHeader("mod.ACC_B_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_B_3", 8, length)); + headers.add(new ColumnHeader("mod.ACC_DELTA_0", 8, length)); + headers.add(new ColumnHeader("mod.ACC_DELTA_1", 8, length)); + headers.add(new ColumnHeader("mod.ACC_DELTA_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_DELTA_3", 8, length)); + headers.add(new ColumnHeader("mod.ACC_H_0", 8, length)); + headers.add(new ColumnHeader("mod.ACC_H_1", 8, length)); + headers.add(new ColumnHeader("mod.ACC_H_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_Q_0", 8, length)); + headers.add(new ColumnHeader("mod.ACC_Q_1", 8, length)); + headers.add(new ColumnHeader("mod.ACC_Q_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_Q_3", 8, length)); + headers.add(new ColumnHeader("mod.ACC_R_0", 8, length)); + headers.add(new ColumnHeader("mod.ACC_R_1", 8, length)); + headers.add(new ColumnHeader("mod.ACC_R_2", 8, length)); + headers.add(new ColumnHeader("mod.ACC_R_3", 8, length)); + headers.add(new ColumnHeader("mod.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("mod.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("mod.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("mod.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("mod.BYTE_1_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_1_3", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_2_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_2_3", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_B_0", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_B_1", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_B_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_B_3", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_DELTA_0", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_DELTA_1", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_DELTA_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_DELTA_3", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_H_0", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_H_1", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_H_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_Q_0", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_Q_1", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_Q_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_Q_3", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_R_0", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_R_1", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_R_2", 1, length)); + headers.add(new ColumnHeader("mod.BYTE_R_3", 1, length)); + headers.add(new ColumnHeader("mod.CMP_1", 1, length)); + headers.add(new ColumnHeader("mod.CMP_2", 1, length)); + headers.add(new ColumnHeader("mod.CT", 1, length)); + headers.add(new ColumnHeader("mod.INST", 1, length)); + headers.add(new ColumnHeader("mod.IS_DIV", 1, length)); + headers.add(new ColumnHeader("mod.IS_MOD", 1, length)); + headers.add(new ColumnHeader("mod.IS_SDIV", 1, length)); + headers.add(new ColumnHeader("mod.IS_SMOD", 1, length)); + headers.add(new ColumnHeader("mod.MLI", 1, length)); + headers.add(new ColumnHeader("mod.MSB_1", 1, length)); + headers.add(new ColumnHeader("mod.MSB_2", 1, length)); + headers.add(new ColumnHeader("mod.OLI", 1, length)); + headers.add(new ColumnHeader("mod.RES_HI", 16, length)); + headers.add(new ColumnHeader("mod.RES_LO", 16, length)); + headers.add(new ColumnHeader("mod.SIGNED", 1, length)); + headers.add(new ColumnHeader("mod.STAMP", 4, length)); + return headers; + } + + public Trace (List buffers) { this.acc12 = buffers.get(0); this.acc13 = buffers.get(1); this.acc22 = buffers.get(2); @@ -260,18 +261,11 @@ public Trace acc12(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mod.ACC_1_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_1_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - acc12.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { acc12.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc12.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_1_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_1_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - acc13.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { acc13.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc13.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_2_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_2_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - acc22.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { acc22.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc22.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_2_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_2_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - acc23.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { acc23.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc23.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accDelta3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accDelta3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accDelta3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accQ3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accQ3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mod.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accR3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accR3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accR3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mod.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mod.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mod.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mod.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j= 16L) { - throw new IllegalArgumentException("mod.CT has invalid value (" + b + ")"); - } + if(b >= 16L) { throw new IllegalArgumentException("mod.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -1385,18 +1196,11 @@ public Trace resHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mod.RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mod.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mod.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mod.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java index 92ca01afa..9acc1d8b9 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.mul; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -88,62 +89,62 @@ public class Trace { private final MappedByteBuffer tinyExponent; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mul.ACC_A_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_3", 8, length)); - headers.add(new ColumnHeader("mul.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mul.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mul.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("mul.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mul.BIT_NUM", 1, length)); - headers.add(new ColumnHeader("mul.BITS", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_3", 1, length)); - headers.add(new ColumnHeader("mul.COUNTER", 1, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT", 1, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT_ACCUMULATOR", 16, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT_SOURCE", 1, length)); - headers.add(new ColumnHeader("mul.INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("mul.MUL_STAMP", 4, length)); - headers.add(new ColumnHeader("mul.OLI", 1, length)); - headers.add(new ColumnHeader("mul.RES_HI", 16, length)); - headers.add(new ColumnHeader("mul.RES_LO", 16, length)); - headers.add(new ColumnHeader("mul.RESULT_VANISHES", 1, length)); - headers.add(new ColumnHeader("mul.SQUARE_AND_MULTIPLY", 1, length)); - headers.add(new ColumnHeader("mul.TINY_BASE", 1, length)); - headers.add(new ColumnHeader("mul.TINY_EXPONENT", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("mul.ACC_A_0", 8, length)); + headers.add(new ColumnHeader("mul.ACC_A_1", 8, length)); + headers.add(new ColumnHeader("mul.ACC_A_2", 8, length)); + headers.add(new ColumnHeader("mul.ACC_A_3", 8, length)); + headers.add(new ColumnHeader("mul.ACC_B_0", 8, length)); + headers.add(new ColumnHeader("mul.ACC_B_1", 8, length)); + headers.add(new ColumnHeader("mul.ACC_B_2", 8, length)); + headers.add(new ColumnHeader("mul.ACC_B_3", 8, length)); + headers.add(new ColumnHeader("mul.ACC_C_0", 8, length)); + headers.add(new ColumnHeader("mul.ACC_C_1", 8, length)); + headers.add(new ColumnHeader("mul.ACC_C_2", 8, length)); + headers.add(new ColumnHeader("mul.ACC_C_3", 8, length)); + headers.add(new ColumnHeader("mul.ACC_H_0", 8, length)); + headers.add(new ColumnHeader("mul.ACC_H_1", 8, length)); + headers.add(new ColumnHeader("mul.ACC_H_2", 8, length)); + headers.add(new ColumnHeader("mul.ACC_H_3", 8, length)); + headers.add(new ColumnHeader("mul.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("mul.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("mul.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("mul.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("mul.BIT_NUM", 1, length)); + headers.add(new ColumnHeader("mul.BITS", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_A_0", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_A_1", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_A_2", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_A_3", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_B_0", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_B_1", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_B_2", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_B_3", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_C_0", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_C_1", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_C_2", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_C_3", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_H_0", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_H_1", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_H_2", 1, length)); + headers.add(new ColumnHeader("mul.BYTE_H_3", 1, length)); + headers.add(new ColumnHeader("mul.COUNTER", 1, length)); + headers.add(new ColumnHeader("mul.EXPONENT_BIT", 1, length)); + headers.add(new ColumnHeader("mul.EXPONENT_BIT_ACCUMULATOR", 16, length)); + headers.add(new ColumnHeader("mul.EXPONENT_BIT_SOURCE", 1, length)); + headers.add(new ColumnHeader("mul.INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("mul.MUL_STAMP", 4, length)); + headers.add(new ColumnHeader("mul.OLI", 1, length)); + headers.add(new ColumnHeader("mul.RES_HI", 16, length)); + headers.add(new ColumnHeader("mul.RES_LO", 16, length)); + headers.add(new ColumnHeader("mul.RESULT_VANISHES", 1, length)); + headers.add(new ColumnHeader("mul.SQUARE_AND_MULTIPLY", 1, length)); + headers.add(new ColumnHeader("mul.TINY_BASE", 1, length)); + headers.add(new ColumnHeader("mul.TINY_EXPONENT", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.accA0 = buffers.get(0); this.accA1 = buffers.get(1); this.accA2 = buffers.get(2); @@ -215,18 +216,11 @@ public Trace accA0(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mul.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accA3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accA3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accB3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accB3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accC3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accC3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accC3.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH0.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH0.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH1.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH1.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH2.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH2.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mul.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - accH3.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { accH3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accH3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mul.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mul.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mul.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mul.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j= 128L) { - throw new IllegalArgumentException("mul.BIT_NUM has invalid value (" + b + ")"); - } + if(b >= 128L) { throw new IllegalArgumentException("mul.BIT_NUM has invalid value (" + b + ")"); } bitNum.put((byte) b); + return this; } @@ -978,18 +838,11 @@ public Trace exponentBitAccumulator(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mul.EXPONENT_BIT_ACCUMULATOR has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.EXPONENT_BIT_ACCUMULATOR has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - exponentBitAccumulator.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { exponentBitAccumulator.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - exponentBitAccumulator.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mul.MUL_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mul.MUL_STAMP has invalid value (" + b + ")"); } mulStamp.put((byte) (b >> 24)); mulStamp.put((byte) (b >> 16)); mulStamp.put((byte) (b >> 8)); mulStamp.put((byte) b); + return this; } @@ -1058,18 +910,11 @@ public Trace resHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "mul.RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mul.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mxp.ACC_1", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_2", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_3", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_4", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_A", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_Q", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_W", 17, length)); - headers.add(new ColumnHeader("mxp.BYTE_1", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_2", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_3", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_4", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_A", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_Q", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_QQ", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_R", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_W", 1, length)); - headers.add(new ColumnHeader("mxp.C_MEM", 8, length)); - headers.add(new ColumnHeader("mxp.C_MEM_NEW", 8, length)); - headers.add(new ColumnHeader("mxp.CN", 8, length)); - headers.add(new ColumnHeader("mxp.COMP", 1, length)); - headers.add(new ColumnHeader("mxp.CT", 1, length)); - headers.add(new ColumnHeader("mxp.DEPLOYS", 1, length)); - headers.add(new ColumnHeader("mxp.EXPANDS", 1, length)); - headers.add(new ColumnHeader("mxp.GAS_MXP", 8, length)); - headers.add(new ColumnHeader("mxp.GBYTE", 8, length)); - headers.add(new ColumnHeader("mxp.GWORD", 8, length)); - headers.add(new ColumnHeader("mxp.INST", 1, length)); - headers.add(new ColumnHeader("mxp.LIN_COST", 8, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET", 16, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET_1", 16, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET_2", 16, length)); - headers.add(new ColumnHeader("mxp.MTNTOP", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_1", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_2", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_3", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_4", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_5", 1, length)); - headers.add(new ColumnHeader("mxp.MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.NOOP", 1, length)); - headers.add(new ColumnHeader("mxp.OFFSET_1_HI", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_1_LO", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_2_HI", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_2_LO", 16, length)); - headers.add(new ColumnHeader("mxp.QUAD_COST", 8, length)); - headers.add(new ColumnHeader("mxp.ROOB", 1, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_HI", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_LO", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_NONZERO_NO_MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_HI", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_LO", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_NONZERO_NO_MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.STAMP", 4, length)); - headers.add(new ColumnHeader("mxp.WORDS", 8, length)); - headers.add(new ColumnHeader("mxp.WORDS_NEW", 8, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("mxp.ACC_1", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_2", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_3", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_4", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_A", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_Q", 17, length)); + headers.add(new ColumnHeader("mxp.ACC_W", 17, length)); + headers.add(new ColumnHeader("mxp.BYTE_1", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_2", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_3", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_4", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_A", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_Q", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_QQ", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_R", 1, length)); + headers.add(new ColumnHeader("mxp.BYTE_W", 1, length)); + headers.add(new ColumnHeader("mxp.C_MEM", 8, length)); + headers.add(new ColumnHeader("mxp.C_MEM_NEW", 8, length)); + headers.add(new ColumnHeader("mxp.CN", 8, length)); + headers.add(new ColumnHeader("mxp.COMP", 1, length)); + headers.add(new ColumnHeader("mxp.CT", 1, length)); + headers.add(new ColumnHeader("mxp.DEPLOYS", 1, length)); + headers.add(new ColumnHeader("mxp.EXPANDS", 1, length)); + headers.add(new ColumnHeader("mxp.GAS_MXP", 8, length)); + headers.add(new ColumnHeader("mxp.GBYTE", 8, length)); + headers.add(new ColumnHeader("mxp.GWORD", 8, length)); + headers.add(new ColumnHeader("mxp.INST", 1, length)); + headers.add(new ColumnHeader("mxp.LIN_COST", 8, length)); + headers.add(new ColumnHeader("mxp.MAX_OFFSET", 16, length)); + headers.add(new ColumnHeader("mxp.MAX_OFFSET_1", 16, length)); + headers.add(new ColumnHeader("mxp.MAX_OFFSET_2", 16, length)); + headers.add(new ColumnHeader("mxp.MTNTOP", 1, length)); + headers.add(new ColumnHeader("mxp.MXP_TYPE_1", 1, length)); + headers.add(new ColumnHeader("mxp.MXP_TYPE_2", 1, length)); + headers.add(new ColumnHeader("mxp.MXP_TYPE_3", 1, length)); + headers.add(new ColumnHeader("mxp.MXP_TYPE_4", 1, length)); + headers.add(new ColumnHeader("mxp.MXP_TYPE_5", 1, length)); + headers.add(new ColumnHeader("mxp.MXPX", 1, length)); + headers.add(new ColumnHeader("mxp.NOOP", 1, length)); + headers.add(new ColumnHeader("mxp.OFFSET_1_HI", 16, length)); + headers.add(new ColumnHeader("mxp.OFFSET_1_LO", 16, length)); + headers.add(new ColumnHeader("mxp.OFFSET_2_HI", 16, length)); + headers.add(new ColumnHeader("mxp.OFFSET_2_LO", 16, length)); + headers.add(new ColumnHeader("mxp.QUAD_COST", 8, length)); + headers.add(new ColumnHeader("mxp.ROOB", 1, length)); + headers.add(new ColumnHeader("mxp.SIZE_1_HI", 16, length)); + headers.add(new ColumnHeader("mxp.SIZE_1_LO", 16, length)); + headers.add(new ColumnHeader("mxp.SIZE_1_NONZERO_NO_MXPX", 1, length)); + headers.add(new ColumnHeader("mxp.SIZE_2_HI", 16, length)); + headers.add(new ColumnHeader("mxp.SIZE_2_LO", 16, length)); + headers.add(new ColumnHeader("mxp.SIZE_2_NONZERO_NO_MXPX", 1, length)); + headers.add(new ColumnHeader("mxp.STAMP", 4, length)); + headers.add(new ColumnHeader("mxp.WORDS", 8, length)); + headers.add(new ColumnHeader("mxp.WORDS_NEW", 8, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.acc3 = buffers.get(2); @@ -228,18 +229,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 136) { - throw new IllegalArgumentException( - "mxp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_A has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_A has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - accA.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { accA.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accA.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_Q has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_Q has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - accQ.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { accQ.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accQ.put(bs.get(j)); - } + for(int j=0; j 136) { - throw new IllegalArgumentException( - "mxp.ACC_W has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_W has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 17; i++) { - accW.put((byte) 0); - } + for(int i=bs.size(); i<17; i++) { accW.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accW.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.C_MEM has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.C_MEM has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cMem.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cMem.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cMem.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.C_MEM_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.C_MEM_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cMemNew.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cMemNew.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cMemNew.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException("mxp.CN has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.CN has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - cn.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { cn.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - cn.put(bs.get(j)); - } + for(int j=0; j= 32L) { - throw new IllegalArgumentException("mxp.CT has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("mxp.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -646,18 +577,11 @@ public Trace gasMxp(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mxp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasMxp.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasMxp.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasMxp.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.GBYTE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.GBYTE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gbyte.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gbyte.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gbyte.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.GWORD has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.GWORD has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gword.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gword.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gword.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.LIN_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.LIN_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - linCost.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { linCost.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - linCost.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.MAX_OFFSET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - maxOffset.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { maxOffset.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - maxOffset.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.MAX_OFFSET_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - maxOffset1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { maxOffset1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - maxOffset1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.MAX_OFFSET_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - maxOffset2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { maxOffset2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - maxOffset2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - offset1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { offset1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - offset1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - offset1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { offset1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - offset1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - offset2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { offset2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - offset2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - offset2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { offset2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - offset2Lo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.QUAD_COST has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.QUAD_COST has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - quadCost.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { quadCost.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - quadCost.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - size1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { size1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - size1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - size1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { size1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - size1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - size2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { size2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - size2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "mxp.SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("mxp.SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - size2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { size2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - size2Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("mxp.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("mxp.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -1224,18 +1042,11 @@ public Trace words(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "mxp.WORDS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.WORDS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - words.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { words.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - words.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "mxp.WORDS_NEW has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.WORDS_NEW has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - wordsNew.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { wordsNew.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - wordsNew.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("oob.ADD_FLAG", 1, length)); - headers.add(new ColumnHeader("oob.CT", 1, length)); - headers.add(new ColumnHeader("oob.CT_MAX", 1, length)); - headers.add(new ColumnHeader("oob.DATA_1", 16, length)); - headers.add(new ColumnHeader("oob.DATA_2", 16, length)); - headers.add(new ColumnHeader("oob.DATA_3", 16, length)); - headers.add(new ColumnHeader("oob.DATA_4", 16, length)); - headers.add(new ColumnHeader("oob.DATA_5", 16, length)); - headers.add(new ColumnHeader("oob.DATA_6", 16, length)); - headers.add(new ColumnHeader("oob.DATA_7", 16, length)); - headers.add(new ColumnHeader("oob.DATA_8", 16, length)); - headers.add(new ColumnHeader("oob.DATA_9", 16, length)); - headers.add(new ColumnHeader("oob.IS_BLAKE2F_CDS", 1, length)); - headers.add(new ColumnHeader("oob.IS_BLAKE2F_PARAMS", 1, length)); - headers.add(new ColumnHeader("oob.IS_CALL", 1, length)); - headers.add(new ColumnHeader("oob.IS_CDL", 1, length)); - headers.add(new ColumnHeader("oob.IS_CREATE", 1, length)); - headers.add(new ColumnHeader("oob.IS_DEPLOYMENT", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECADD", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECMUL", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECPAIRING", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECRECOVER", 1, length)); - headers.add(new ColumnHeader("oob.IS_IDENTITY", 1, length)); - headers.add(new ColumnHeader("oob.IS_JUMP", 1, length)); - headers.add(new ColumnHeader("oob.IS_JUMPI", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_CDS", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_EXTRACT", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_LEAD", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_PRICING", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_XBS", 1, length)); - headers.add(new ColumnHeader("oob.IS_RDC", 1, length)); - headers.add(new ColumnHeader("oob.IS_RIPEMD", 1, length)); - headers.add(new ColumnHeader("oob.IS_SHA2", 1, length)); - headers.add(new ColumnHeader("oob.IS_SSTORE", 1, length)); - headers.add(new ColumnHeader("oob.IS_XCALL", 1, length)); - headers.add(new ColumnHeader("oob.MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("oob.OOB_INST", 2, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_1", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_2", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_3", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_4", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_INST", 1, length)); - headers.add(new ColumnHeader("oob.OUTGOING_RES_LO", 16, length)); - headers.add(new ColumnHeader("oob.STAMP", 4, length)); - headers.add(new ColumnHeader("oob.WCP_FLAG", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("oob.ADD_FLAG", 1, length)); + headers.add(new ColumnHeader("oob.CT", 1, length)); + headers.add(new ColumnHeader("oob.CT_MAX", 1, length)); + headers.add(new ColumnHeader("oob.DATA_1", 16, length)); + headers.add(new ColumnHeader("oob.DATA_2", 16, length)); + headers.add(new ColumnHeader("oob.DATA_3", 16, length)); + headers.add(new ColumnHeader("oob.DATA_4", 16, length)); + headers.add(new ColumnHeader("oob.DATA_5", 16, length)); + headers.add(new ColumnHeader("oob.DATA_6", 16, length)); + headers.add(new ColumnHeader("oob.DATA_7", 16, length)); + headers.add(new ColumnHeader("oob.DATA_8", 16, length)); + headers.add(new ColumnHeader("oob.DATA_9", 16, length)); + headers.add(new ColumnHeader("oob.IS_BLAKE2F_CDS", 1, length)); + headers.add(new ColumnHeader("oob.IS_BLAKE2F_PARAMS", 1, length)); + headers.add(new ColumnHeader("oob.IS_CALL", 1, length)); + headers.add(new ColumnHeader("oob.IS_CDL", 1, length)); + headers.add(new ColumnHeader("oob.IS_CREATE", 1, length)); + headers.add(new ColumnHeader("oob.IS_DEPLOYMENT", 1, length)); + headers.add(new ColumnHeader("oob.IS_ECADD", 1, length)); + headers.add(new ColumnHeader("oob.IS_ECMUL", 1, length)); + headers.add(new ColumnHeader("oob.IS_ECPAIRING", 1, length)); + headers.add(new ColumnHeader("oob.IS_ECRECOVER", 1, length)); + headers.add(new ColumnHeader("oob.IS_IDENTITY", 1, length)); + headers.add(new ColumnHeader("oob.IS_JUMP", 1, length)); + headers.add(new ColumnHeader("oob.IS_JUMPI", 1, length)); + headers.add(new ColumnHeader("oob.IS_MODEXP_CDS", 1, length)); + headers.add(new ColumnHeader("oob.IS_MODEXP_EXTRACT", 1, length)); + headers.add(new ColumnHeader("oob.IS_MODEXP_LEAD", 1, length)); + headers.add(new ColumnHeader("oob.IS_MODEXP_PRICING", 1, length)); + headers.add(new ColumnHeader("oob.IS_MODEXP_XBS", 1, length)); + headers.add(new ColumnHeader("oob.IS_RDC", 1, length)); + headers.add(new ColumnHeader("oob.IS_RIPEMD", 1, length)); + headers.add(new ColumnHeader("oob.IS_SHA2", 1, length)); + headers.add(new ColumnHeader("oob.IS_SSTORE", 1, length)); + headers.add(new ColumnHeader("oob.IS_XCALL", 1, length)); + headers.add(new ColumnHeader("oob.MOD_FLAG", 1, length)); + headers.add(new ColumnHeader("oob.OOB_INST", 2, length)); + headers.add(new ColumnHeader("oob.OUTGOING_DATA_1", 16, length)); + headers.add(new ColumnHeader("oob.OUTGOING_DATA_2", 16, length)); + headers.add(new ColumnHeader("oob.OUTGOING_DATA_3", 16, length)); + headers.add(new ColumnHeader("oob.OUTGOING_DATA_4", 16, length)); + headers.add(new ColumnHeader("oob.OUTGOING_INST", 1, length)); + headers.add(new ColumnHeader("oob.OUTGOING_RES_LO", 16, length)); + headers.add(new ColumnHeader("oob.STAMP", 4, length)); + headers.add(new ColumnHeader("oob.WCP_FLAG", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.addFlag = buffers.get(0); this.ct = buffers.get(1); this.ctMax = buffers.get(2); @@ -230,11 +231,10 @@ public Trace ct(final long b) { filled.set(1); } - if (b >= 8L) { - throw new IllegalArgumentException("oob.CT has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("oob.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -245,11 +245,10 @@ public Trace ctMax(final long b) { filled.set(2); } - if (b >= 8L) { - throw new IllegalArgumentException("oob.CT_MAX has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("oob.CT_MAX has invalid value (" + b + ")"); } ctMax.put((byte) b); + return this; } @@ -263,18 +262,11 @@ public Trace data1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "oob.DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data6.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data6.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_7 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_7 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data7.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data7.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data7.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_8 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_8 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data8.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data8.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data8.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.DATA_9 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_9 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - data9.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { data9.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - data9.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("oob.OOB_INST has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("oob.OOB_INST has invalid value (" + b + ")"); } oobInst.put((byte) (b >> 8)); oobInst.put((byte) b); + return this; } @@ -801,18 +736,11 @@ public Trace outgoingData1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "oob.OUTGOING_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingData1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingData1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingData1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.OUTGOING_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingData2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingData2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingData2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.OUTGOING_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingData3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingData3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingData3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.OUTGOING_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingData4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingData4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingData4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "oob.OUTGOING_RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingResLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingResLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingResLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("oob.STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("oob.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 24)); stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java index 5ae88fcde..b776e5f99 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.rlpaddr; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -66,38 +67,38 @@ public class Trace { private final MappedByteBuffer tinyNonZeroNonce; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlpaddr.ACC", 8, length)); - headers.add(new ColumnHeader("rlpaddr.ACC_BYTESIZE", 1, length)); - headers.add(new ColumnHeader("rlpaddr.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlpaddr.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.BIT1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlpaddr.BYTE1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.COUNTER", 1, length)); - headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.INDEX", 1, length)); - headers.add(new ColumnHeader("rlpaddr.KEC_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.KEC_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.LC", 1, length)); - headers.add(new ColumnHeader("rlpaddr.LIMB", 16, length)); - headers.add(new ColumnHeader("rlpaddr.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlpaddr.NONCE", 8, length)); - headers.add(new ColumnHeader("rlpaddr.POWER", 16, length)); - headers.add(new ColumnHeader("rlpaddr.RAW_ADDR_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE", 1, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE_1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE_2", 1, length)); - headers.add(new ColumnHeader("rlpaddr.SALT_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.SALT_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.SELECTOR_KECCAK_RES", 1, length)); - headers.add(new ColumnHeader("rlpaddr.STAMP", 3, length)); - headers.add(new ColumnHeader("rlpaddr.TINY_NON_ZERO_NONCE", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("rlpaddr.ACC", 8, length)); + headers.add(new ColumnHeader("rlpaddr.ACC_BYTESIZE", 1, length)); + headers.add(new ColumnHeader("rlpaddr.ADDR_HI", 4, length)); + headers.add(new ColumnHeader("rlpaddr.ADDR_LO", 16, length)); + headers.add(new ColumnHeader("rlpaddr.BIT1", 1, length)); + headers.add(new ColumnHeader("rlpaddr.BIT_ACC", 1, length)); + headers.add(new ColumnHeader("rlpaddr.BYTE1", 1, length)); + headers.add(new ColumnHeader("rlpaddr.COUNTER", 1, length)); + headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_HI", 4, length)); + headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_LO", 16, length)); + headers.add(new ColumnHeader("rlpaddr.INDEX", 1, length)); + headers.add(new ColumnHeader("rlpaddr.KEC_HI", 16, length)); + headers.add(new ColumnHeader("rlpaddr.KEC_LO", 16, length)); + headers.add(new ColumnHeader("rlpaddr.LC", 1, length)); + headers.add(new ColumnHeader("rlpaddr.LIMB", 16, length)); + headers.add(new ColumnHeader("rlpaddr.nBYTES", 1, length)); + headers.add(new ColumnHeader("rlpaddr.NONCE", 8, length)); + headers.add(new ColumnHeader("rlpaddr.POWER", 16, length)); + headers.add(new ColumnHeader("rlpaddr.RAW_ADDR_HI", 16, length)); + headers.add(new ColumnHeader("rlpaddr.RECIPE", 1, length)); + headers.add(new ColumnHeader("rlpaddr.RECIPE_1", 1, length)); + headers.add(new ColumnHeader("rlpaddr.RECIPE_2", 1, length)); + headers.add(new ColumnHeader("rlpaddr.SALT_HI", 16, length)); + headers.add(new ColumnHeader("rlpaddr.SALT_LO", 16, length)); + headers.add(new ColumnHeader("rlpaddr.SELECTOR_KECCAK_RES", 1, length)); + headers.add(new ColumnHeader("rlpaddr.STAMP", 3, length)); + headers.add(new ColumnHeader("rlpaddr.TINY_NON_ZERO_NONCE", 1, length)); + return headers; + } + + public Trace (List buffers) { this.acc = buffers.get(0); this.accBytesize = buffers.get(1); this.addrHi = buffers.get(2); @@ -145,18 +146,11 @@ public Trace acc(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "rlpaddr.ACC has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("rlpaddr.ACC has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - acc.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { acc.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rlpaddr.ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlpaddr.ADDR_HI has invalid value (" + b + ")"); } addrHi.put((byte) (b >> 24)); addrHi.put((byte) (b >> 16)); addrHi.put((byte) (b >> 8)); addrHi.put((byte) b); + return this; } @@ -201,18 +194,11 @@ public Trace addrLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlpaddr.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addrLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addrLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rlpaddr.DEP_ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlpaddr.DEP_ADDR_HI has invalid value (" + b + ")"); } depAddrHi.put((byte) (b >> 24)); depAddrHi.put((byte) (b >> 16)); depAddrHi.put((byte) (b >> 8)); depAddrHi.put((byte) b); + return this; } @@ -293,18 +278,11 @@ public Trace depAddrLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlpaddr.DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - depAddrLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { depAddrLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - depAddrLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.KEC_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.KEC_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - kecHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { kecHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - kecHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.KEC_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.KEC_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - kecLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { kecLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - kecLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "rlpaddr.NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("rlpaddr.NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonce.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonce.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.POWER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.POWER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - power.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - power.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.RAW_ADDR_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.RAW_ADDR_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAddrHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAddrHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAddrHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.SALT_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.SALT_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - saltHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { saltHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - saltHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlpaddr.SALT_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.SALT_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - saltLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { saltLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - saltLo.put(bs.get(j)); - } + for(int j=0; j= 16777216L) { - throw new IllegalArgumentException("rlpaddr.STAMP has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlpaddr.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java index 79e30421e..721126814 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.rlptxn; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -97,71 +98,71 @@ public class Trace { private final MappedByteBuffer type; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM", 2, length)); - headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM_INFINY", 2, length)); - headers.add(new ColumnHeader("rlptxn.ACC_1", 16, length)); - headers.add(new ColumnHeader("rlptxn.ACC_2", 16, length)); - headers.add(new ColumnHeader("rlptxn.ACC_BYTESIZE", 1, length)); - headers.add(new ColumnHeader("rlptxn.ACCESS_TUPLE_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlptxn.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlptxn.BIT", 1, length)); - headers.add(new ColumnHeader("rlptxn.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlptxn.BYTE_1", 1, length)); - headers.add(new ColumnHeader("rlptxn.BYTE_2", 1, length)); - headers.add(new ColumnHeader("rlptxn.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("rlptxn.COUNTER", 1, length)); - headers.add(new ColumnHeader("rlptxn.DATA_GAS_COST", 4, length)); - headers.add(new ColumnHeader("rlptxn.DATA_HI", 16, length)); - headers.add(new ColumnHeader("rlptxn.DATA_LO", 16, length)); - headers.add(new ColumnHeader("rlptxn.DEPTH_1", 1, length)); - headers.add(new ColumnHeader("rlptxn.DEPTH_2", 1, length)); - headers.add(new ColumnHeader("rlptxn.DONE", 1, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_DATA", 4, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_LT", 4, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_LX", 4, length)); - headers.add(new ColumnHeader("rlptxn.INPUT_1", 16, length)); - headers.add(new ColumnHeader("rlptxn.INPUT_2", 16, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_ACCESS_LIST", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_BETA", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_CHAIN_ID", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_DATA", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_LIMIT", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_PRICE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_FEE_PER_GAS", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_NONCE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_R", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_RLP_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_S", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_TO", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_VALUE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_Y", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxn.LC_CORRECTION", 1, length)); - headers.add(new ColumnHeader("rlptxn.LIMB", 16, length)); - headers.add(new ColumnHeader("rlptxn.LIMB_CONSTRUCTED", 1, length)); - headers.add(new ColumnHeader("rlptxn.LT", 1, length)); - headers.add(new ColumnHeader("rlptxn.LX", 1, length)); - headers.add(new ColumnHeader("rlptxn.nADDR", 2, length)); - headers.add(new ColumnHeader("rlptxn.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlptxn.nKEYS", 2, length)); - headers.add(new ColumnHeader("rlptxn.nKEYS_PER_ADDR", 2, length)); - headers.add(new ColumnHeader("rlptxn.nSTEP", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE_END", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxn.POWER", 16, length)); - headers.add(new ColumnHeader("rlptxn.REQUIRES_EVM_EXECUTION", 1, length)); - headers.add(new ColumnHeader("rlptxn.RLP_LT_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.RLP_LX_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.TO_HASH_BY_PROVER", 1, length)); - headers.add(new ColumnHeader("rlptxn.TYPE", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM", 2, length)); + headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM_INFINY", 2, length)); + headers.add(new ColumnHeader("rlptxn.ACC_1", 16, length)); + headers.add(new ColumnHeader("rlptxn.ACC_2", 16, length)); + headers.add(new ColumnHeader("rlptxn.ACC_BYTESIZE", 1, length)); + headers.add(new ColumnHeader("rlptxn.ACCESS_TUPLE_BYTESIZE", 3, length)); + headers.add(new ColumnHeader("rlptxn.ADDR_HI", 4, length)); + headers.add(new ColumnHeader("rlptxn.ADDR_LO", 16, length)); + headers.add(new ColumnHeader("rlptxn.BIT", 1, length)); + headers.add(new ColumnHeader("rlptxn.BIT_ACC", 1, length)); + headers.add(new ColumnHeader("rlptxn.BYTE_1", 1, length)); + headers.add(new ColumnHeader("rlptxn.BYTE_2", 1, length)); + headers.add(new ColumnHeader("rlptxn.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("rlptxn.COUNTER", 1, length)); + headers.add(new ColumnHeader("rlptxn.DATA_GAS_COST", 4, length)); + headers.add(new ColumnHeader("rlptxn.DATA_HI", 16, length)); + headers.add(new ColumnHeader("rlptxn.DATA_LO", 16, length)); + headers.add(new ColumnHeader("rlptxn.DEPTH_1", 1, length)); + headers.add(new ColumnHeader("rlptxn.DEPTH_2", 1, length)); + headers.add(new ColumnHeader("rlptxn.DONE", 1, length)); + headers.add(new ColumnHeader("rlptxn.INDEX_DATA", 4, length)); + headers.add(new ColumnHeader("rlptxn.INDEX_LT", 4, length)); + headers.add(new ColumnHeader("rlptxn.INDEX_LX", 4, length)); + headers.add(new ColumnHeader("rlptxn.INPUT_1", 16, length)); + headers.add(new ColumnHeader("rlptxn.INPUT_2", 16, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_ACCESS_LIST", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_BETA", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_CHAIN_ID", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_DATA", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_LIMIT", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_PRICE", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_FEE_PER_GAS", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_NONCE", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_R", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_RLP_PREFIX", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_S", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_TO", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_VALUE", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PHASE_Y", 1, length)); + headers.add(new ColumnHeader("rlptxn.IS_PREFIX", 1, length)); + headers.add(new ColumnHeader("rlptxn.LC_CORRECTION", 1, length)); + headers.add(new ColumnHeader("rlptxn.LIMB", 16, length)); + headers.add(new ColumnHeader("rlptxn.LIMB_CONSTRUCTED", 1, length)); + headers.add(new ColumnHeader("rlptxn.LT", 1, length)); + headers.add(new ColumnHeader("rlptxn.LX", 1, length)); + headers.add(new ColumnHeader("rlptxn.nADDR", 2, length)); + headers.add(new ColumnHeader("rlptxn.nBYTES", 1, length)); + headers.add(new ColumnHeader("rlptxn.nKEYS", 2, length)); + headers.add(new ColumnHeader("rlptxn.nKEYS_PER_ADDR", 2, length)); + headers.add(new ColumnHeader("rlptxn.nSTEP", 1, length)); + headers.add(new ColumnHeader("rlptxn.PHASE", 1, length)); + headers.add(new ColumnHeader("rlptxn.PHASE_END", 1, length)); + headers.add(new ColumnHeader("rlptxn.PHASE_SIZE", 4, length)); + headers.add(new ColumnHeader("rlptxn.POWER", 16, length)); + headers.add(new ColumnHeader("rlptxn.REQUIRES_EVM_EXECUTION", 1, length)); + headers.add(new ColumnHeader("rlptxn.RLP_LT_BYTESIZE", 3, length)); + headers.add(new ColumnHeader("rlptxn.RLP_LX_BYTESIZE", 3, length)); + headers.add(new ColumnHeader("rlptxn.TO_HASH_BY_PROVER", 1, length)); + headers.add(new ColumnHeader("rlptxn.TYPE", 1, length)); + return headers; + } + + public Trace (List buffers) { this.absTxNum = buffers.get(0); this.absTxNumInfiny = buffers.get(1); this.acc1 = buffers.get(2); @@ -239,12 +240,11 @@ public Trace absTxNum(final long b) { filled.set(0); } - if (b >= 65536L) { - throw new IllegalArgumentException("rlptxn.ABS_TX_NUM has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.ABS_TX_NUM has invalid value (" + b + ")"); } absTxNum.put((byte) (b >> 8)); absTxNum.put((byte) b); + return this; } @@ -255,12 +255,11 @@ public Trace absTxNumInfiny(final long b) { filled.set(1); } - if (b >= 65536L) { - throw new IllegalArgumentException("rlptxn.ABS_TX_NUM_INFINY has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.ABS_TX_NUM_INFINY has invalid value (" + b + ")"); } absTxNumInfiny.put((byte) (b >> 8)); absTxNumInfiny.put((byte) b); + return this; } @@ -274,18 +273,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxn.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxn.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j= 32L) { - throw new IllegalArgumentException("rlptxn.ACC_BYTESIZE has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxn.ACC_BYTESIZE has invalid value (" + b + ")"); } accBytesize.put((byte) b); + return this; } @@ -338,14 +322,12 @@ public Trace accessTupleBytesize(final long b) { filled.set(2); } - if (b >= 16777216L) { - throw new IllegalArgumentException( - "rlptxn.ACCESS_TUPLE_BYTESIZE has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlptxn.ACCESS_TUPLE_BYTESIZE has invalid value (" + b + ")"); } accessTupleBytesize.put((byte) (b >> 16)); accessTupleBytesize.put((byte) (b >> 8)); accessTupleBytesize.put((byte) b); + return this; } @@ -356,14 +338,13 @@ public Trace addrHi(final long b) { filled.set(6); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxn.ADDR_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.ADDR_HI has invalid value (" + b + ")"); } addrHi.put((byte) (b >> 24)); addrHi.put((byte) (b >> 16)); addrHi.put((byte) (b >> 8)); addrHi.put((byte) b); + return this; } @@ -377,18 +358,11 @@ public Trace addrLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxn.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addrLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addrLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "rlptxn.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -467,11 +439,10 @@ public Trace counter(final long b) { filled.set(13); } - if (b >= 32L) { - throw new IllegalArgumentException("rlptxn.COUNTER has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxn.COUNTER has invalid value (" + b + ")"); } counter.put((byte) b); + return this; } @@ -482,14 +453,13 @@ public Trace dataGasCost(final long b) { filled.set(14); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxn.DATA_GAS_COST has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.DATA_GAS_COST has invalid value (" + b + ")"); } dataGasCost.put((byte) (b >> 24)); dataGasCost.put((byte) (b >> 16)); dataGasCost.put((byte) (b >> 8)); dataGasCost.put((byte) b); + return this; } @@ -503,18 +473,11 @@ public Trace dataHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxn.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxn.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - dataLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - dataLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rlptxn.INDEX_DATA has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_DATA has invalid value (" + b + ")"); } indexData.put((byte) (b >> 24)); indexData.put((byte) (b >> 16)); indexData.put((byte) (b >> 8)); indexData.put((byte) b); + return this; } @@ -606,14 +561,13 @@ public Trace indexLt(final long b) { filled.set(21); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxn.INDEX_LT has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_LT has invalid value (" + b + ")"); } indexLt.put((byte) (b >> 24)); indexLt.put((byte) (b >> 16)); indexLt.put((byte) (b >> 8)); indexLt.put((byte) b); + return this; } @@ -624,14 +578,13 @@ public Trace indexLx(final long b) { filled.set(22); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxn.INDEX_LX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_LX has invalid value (" + b + ")"); } indexLx.put((byte) (b >> 24)); indexLx.put((byte) (b >> 16)); indexLx.put((byte) (b >> 8)); indexLx.put((byte) b); + return this; } @@ -645,18 +598,11 @@ public Trace input1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxn.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxn.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxn.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("rlptxn.nADDR has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.nADDR has invalid value (" + b + ")"); } nAddr.put((byte) (b >> 8)); nAddr.put((byte) b); + return this; } @@ -976,11 +907,10 @@ public Trace nBytes(final long b) { filled.set(56); } - if (b >= 32L) { - throw new IllegalArgumentException("rlptxn.nBYTES has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxn.nBYTES has invalid value (" + b + ")"); } nBytes.put((byte) b); + return this; } @@ -991,12 +921,11 @@ public Trace nKeys(final long b) { filled.set(57); } - if (b >= 65536L) { - throw new IllegalArgumentException("rlptxn.nKEYS has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.nKEYS has invalid value (" + b + ")"); } nKeys.put((byte) (b >> 8)); nKeys.put((byte) b); + return this; } @@ -1007,12 +936,11 @@ public Trace nKeysPerAddr(final long b) { filled.set(58); } - if (b >= 65536L) { - throw new IllegalArgumentException("rlptxn.nKEYS_PER_ADDR has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.nKEYS_PER_ADDR has invalid value (" + b + ")"); } nKeysPerAddr.put((byte) (b >> 8)); nKeysPerAddr.put((byte) b); + return this; } @@ -1023,11 +951,10 @@ public Trace nStep(final long b) { filled.set(59); } - if (b >= 32L) { - throw new IllegalArgumentException("rlptxn.nSTEP has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxn.nSTEP has invalid value (" + b + ")"); } nStep.put((byte) b); + return this; } @@ -1038,11 +965,10 @@ public Trace phase(final long b) { filled.set(46); } - if (b >= 32L) { - throw new IllegalArgumentException("rlptxn.PHASE has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxn.PHASE has invalid value (" + b + ")"); } phase.put((byte) b); + return this; } @@ -1065,14 +991,13 @@ public Trace phaseSize(final long b) { filled.set(48); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxn.PHASE_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.PHASE_SIZE has invalid value (" + b + ")"); } phaseSize.put((byte) (b >> 24)); phaseSize.put((byte) (b >> 16)); phaseSize.put((byte) (b >> 8)); phaseSize.put((byte) b); + return this; } @@ -1086,18 +1011,11 @@ public Trace power(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxn.POWER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.POWER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - power.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - power.put(bs.get(j)); - } + for(int j=0; j= 16777216L) { - throw new IllegalArgumentException("rlptxn.RLP_LT_BYTESIZE has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlptxn.RLP_LT_BYTESIZE has invalid value (" + b + ")"); } rlpLtBytesize.put((byte) (b >> 16)); rlpLtBytesize.put((byte) (b >> 8)); rlpLtBytesize.put((byte) b); + return this; } @@ -1138,13 +1055,12 @@ public Trace rlpLxBytesize(final long b) { filled.set(52); } - if (b >= 16777216L) { - throw new IllegalArgumentException("rlptxn.RLP_LX_BYTESIZE has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlptxn.RLP_LX_BYTESIZE has invalid value (" + b + ")"); } rlpLxBytesize.put((byte) (b >> 16)); rlpLxBytesize.put((byte) (b >> 8)); rlpLxBytesize.put((byte) b); + return this; } @@ -1167,11 +1083,10 @@ public Trace type(final long b) { filled.set(54); } - if (b >= 8L) { - throw new IllegalArgumentException("rlptxn.TYPE has invalid value (" + b + ")"); - } + if(b >= 8L) { throw new IllegalArgumentException("rlptxn.TYPE has invalid value (" + b + ")"); } type.put((byte) b); + return this; } @@ -1305,8 +1220,7 @@ public Trace validateRow() { } if (!filled.get(32)) { - throw new IllegalStateException( - "rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS has not been filled"); + throw new IllegalStateException("rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS has not been filled"); } if (!filled.get(33)) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java index 563c853ae..500b75734 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.rlptxrcpt; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -86,55 +87,55 @@ public class Trace { private final MappedByteBuffer txrcptSize; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM_MAX", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM_MAX", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_1", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_2", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_3", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_4", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_SIZE", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BIT", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_2", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_3", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_4", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.COUNTER", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.DEPTH_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.DONE", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.INDEX", 3, length)); - headers.add(new ColumnHeader("rlptxrcpt.INDEX_LOCAL", 3, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_1", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_2", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_3", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_4", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_DATA", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_TOPIC", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LC_CORRECTION", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LIMB", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.LIMB_CONSTRUCTED", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LOCAL_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.LOG_ENTRY_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.nSTEP", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_2", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_3", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_4", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_5", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_END", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_ID", 2, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.POWER", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.TXRCPT_SIZE", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM_MAX", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM_MAX", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.ACC_1", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.ACC_2", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.ACC_3", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.ACC_4", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.ACC_SIZE", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BIT", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BIT_ACC", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BYTE_1", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BYTE_2", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BYTE_3", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.BYTE_4", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.COUNTER", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.DEPTH_1", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.DONE", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.INDEX", 3, length)); + headers.add(new ColumnHeader("rlptxrcpt.INDEX_LOCAL", 3, length)); + headers.add(new ColumnHeader("rlptxrcpt.INPUT_1", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.INPUT_2", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.INPUT_3", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.INPUT_4", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.IS_DATA", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.IS_PREFIX", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.IS_TOPIC", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.LC_CORRECTION", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.LIMB", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.LIMB_CONSTRUCTED", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.LOCAL_SIZE", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.LOG_ENTRY_SIZE", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.nBYTES", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.nSTEP", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_1", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_2", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_3", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_4", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_5", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_END", 1, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_ID", 2, length)); + headers.add(new ColumnHeader("rlptxrcpt.PHASE_SIZE", 4, length)); + headers.add(new ColumnHeader("rlptxrcpt.POWER", 16, length)); + headers.add(new ColumnHeader("rlptxrcpt.TXRCPT_SIZE", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.absLogNum = buffers.get(0); this.absLogNumMax = buffers.get(1); this.absTxNum = buffers.get(2); @@ -196,14 +197,13 @@ public Trace absLogNum(final long b) { filled.set(0); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM has invalid value (" + b + ")"); } absLogNum.put((byte) (b >> 24)); absLogNum.put((byte) (b >> 16)); absLogNum.put((byte) (b >> 8)); absLogNum.put((byte) b); + return this; } @@ -214,14 +214,13 @@ public Trace absLogNumMax(final long b) { filled.set(1); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } absLogNumMax.put((byte) (b >> 24)); absLogNumMax.put((byte) (b >> 16)); absLogNumMax.put((byte) (b >> 8)); absLogNumMax.put((byte) b); + return this; } @@ -232,14 +231,13 @@ public Trace absTxNum(final long b) { filled.set(2); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM has invalid value (" + b + ")"); } absTxNum.put((byte) (b >> 24)); absTxNum.put((byte) (b >> 16)); absTxNum.put((byte) (b >> 8)); absTxNum.put((byte) b); + return this; } @@ -250,14 +248,13 @@ public Trace absTxNumMax(final long b) { filled.set(3); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM_MAX has invalid value (" + b + ")"); } absTxNumMax.put((byte) (b >> 24)); absTxNumMax.put((byte) (b >> 16)); absTxNumMax.put((byte) (b >> 8)); absTxNumMax.put((byte) b); + return this; } @@ -271,18 +268,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxrcpt.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j= 32L) { - throw new IllegalArgumentException("rlptxrcpt.ACC_SIZE has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxrcpt.ACC_SIZE has invalid value (" + b + ")"); } accSize.put((byte) b); + return this; } @@ -459,14 +427,13 @@ public Trace counter(final long b) { filled.set(15); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.COUNTER has invalid value (" + b + ")"); } counter.put((byte) (b >> 24)); counter.put((byte) (b >> 16)); counter.put((byte) (b >> 8)); counter.put((byte) b); + return this; } @@ -501,13 +468,12 @@ public Trace index(final long b) { filled.set(18); } - if (b >= 16777216L) { - throw new IllegalArgumentException("rlptxrcpt.INDEX has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlptxrcpt.INDEX has invalid value (" + b + ")"); } index.put((byte) (b >> 16)); index.put((byte) (b >> 8)); index.put((byte) b); + return this; } @@ -518,13 +484,12 @@ public Trace indexLocal(final long b) { filled.set(19); } - if (b >= 16777216L) { - throw new IllegalArgumentException("rlptxrcpt.INDEX_LOCAL has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("rlptxrcpt.INDEX_LOCAL has invalid value (" + b + ")"); } indexLocal.put((byte) (b >> 16)); indexLocal.put((byte) (b >> 8)); indexLocal.put((byte) b); + return this; } @@ -538,18 +503,11 @@ public Trace input1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxrcpt.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.INPUT_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.INPUT_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - input4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { input4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - input4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rlptxrcpt.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.LOCAL_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.LOCAL_SIZE has invalid value (" + b + ")"); } localSize.put((byte) (b >> 24)); localSize.put((byte) (b >> 16)); localSize.put((byte) (b >> 8)); localSize.put((byte) b); + return this; } @@ -743,14 +672,13 @@ public Trace logEntrySize(final long b) { filled.set(31); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.LOG_ENTRY_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.LOG_ENTRY_SIZE has invalid value (" + b + ")"); } logEntrySize.put((byte) (b >> 24)); logEntrySize.put((byte) (b >> 16)); logEntrySize.put((byte) (b >> 8)); logEntrySize.put((byte) b); + return this; } @@ -761,11 +689,10 @@ public Trace nBytes(final long b) { filled.set(42); } - if (b >= 32L) { - throw new IllegalArgumentException("rlptxrcpt.nBYTES has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("rlptxrcpt.nBYTES has invalid value (" + b + ")"); } nBytes.put((byte) b); + return this; } @@ -776,14 +703,13 @@ public Trace nStep(final long b) { filled.set(43); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.nSTEP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.nSTEP has invalid value (" + b + ")"); } nStep.put((byte) (b >> 24)); nStep.put((byte) (b >> 16)); nStep.put((byte) (b >> 8)); nStep.put((byte) b); + return this; } @@ -866,12 +792,11 @@ public Trace phaseId(final long b) { filled.set(38); } - if (b >= 65536L) { - throw new IllegalArgumentException("rlptxrcpt.PHASE_ID has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("rlptxrcpt.PHASE_ID has invalid value (" + b + ")"); } phaseId.put((byte) (b >> 8)); phaseId.put((byte) b); + return this; } @@ -882,14 +807,13 @@ public Trace phaseSize(final long b) { filled.set(39); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.PHASE_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.PHASE_SIZE has invalid value (" + b + ")"); } phaseSize.put((byte) (b >> 24)); phaseSize.put((byte) (b >> 16)); phaseSize.put((byte) (b >> 8)); phaseSize.put((byte) b); + return this; } @@ -903,18 +827,11 @@ public Trace power(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rlptxrcpt.POWER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.POWER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - power.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - power.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rlptxrcpt.TXRCPT_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.TXRCPT_SIZE has invalid value (" + b + ")"); } txrcptSize.put((byte) (b >> 24)); txrcptSize.put((byte) (b >> 16)); txrcptSize.put((byte) (b >> 8)); txrcptSize.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java index 3b4d665f2..6598ebb6d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.rom; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -60,34 +61,34 @@ public class Trace { private final MappedByteBuffer pushValueLo; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rom.ACC", 16, length)); - headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX_INFTY", 4, length)); - headers.add(new ColumnHeader("rom.CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("rom.CODESIZE_REACHED", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER_MAX", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER_PUSH", 1, length)); - headers.add(new ColumnHeader("rom.INDEX", 4, length)); - headers.add(new ColumnHeader("rom.IS_JUMPDEST", 1, length)); - headers.add(new ColumnHeader("rom.IS_PUSH", 1, length)); - headers.add(new ColumnHeader("rom.IS_PUSH_DATA", 1, length)); - headers.add(new ColumnHeader("rom.LIMB", 16, length)); - headers.add(new ColumnHeader("rom.nBYTES", 1, length)); - headers.add(new ColumnHeader("rom.nBYTES_ACC", 1, length)); - headers.add(new ColumnHeader("rom.OPCODE", 1, length)); - headers.add(new ColumnHeader("rom.PADDED_BYTECODE_BYTE", 1, length)); - headers.add(new ColumnHeader("rom.PROGRAM_COUNTER", 4, length)); - headers.add(new ColumnHeader("rom.PUSH_FUNNEL_BIT", 1, length)); - headers.add(new ColumnHeader("rom.PUSH_PARAMETER", 1, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_ACC", 16, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_HI", 16, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_LO", 16, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("rom.ACC", 16, length)); + headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX_INFTY", 4, length)); + headers.add(new ColumnHeader("rom.CODE_SIZE", 4, length)); + headers.add(new ColumnHeader("rom.CODESIZE_REACHED", 1, length)); + headers.add(new ColumnHeader("rom.COUNTER", 1, length)); + headers.add(new ColumnHeader("rom.COUNTER_MAX", 1, length)); + headers.add(new ColumnHeader("rom.COUNTER_PUSH", 1, length)); + headers.add(new ColumnHeader("rom.INDEX", 4, length)); + headers.add(new ColumnHeader("rom.IS_JUMPDEST", 1, length)); + headers.add(new ColumnHeader("rom.IS_PUSH", 1, length)); + headers.add(new ColumnHeader("rom.IS_PUSH_DATA", 1, length)); + headers.add(new ColumnHeader("rom.LIMB", 16, length)); + headers.add(new ColumnHeader("rom.nBYTES", 1, length)); + headers.add(new ColumnHeader("rom.nBYTES_ACC", 1, length)); + headers.add(new ColumnHeader("rom.OPCODE", 1, length)); + headers.add(new ColumnHeader("rom.PADDED_BYTECODE_BYTE", 1, length)); + headers.add(new ColumnHeader("rom.PROGRAM_COUNTER", 4, length)); + headers.add(new ColumnHeader("rom.PUSH_FUNNEL_BIT", 1, length)); + headers.add(new ColumnHeader("rom.PUSH_PARAMETER", 1, length)); + headers.add(new ColumnHeader("rom.PUSH_VALUE_ACC", 16, length)); + headers.add(new ColumnHeader("rom.PUSH_VALUE_HI", 16, length)); + headers.add(new ColumnHeader("rom.PUSH_VALUE_LO", 16, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.acc = buffers.get(0); this.codeFragmentIndex = buffers.get(1); this.codeFragmentIndexInfty = buffers.get(2); @@ -131,17 +132,11 @@ public Trace acc(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException("rom.ACC has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.ACC has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rom.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rom.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -171,15 +165,13 @@ public Trace codeFragmentIndexInfty(final long b) { filled.set(3); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "rom.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rom.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); } codeFragmentIndexInfty.put((byte) (b >> 24)); codeFragmentIndexInfty.put((byte) (b >> 16)); codeFragmentIndexInfty.put((byte) (b >> 8)); codeFragmentIndexInfty.put((byte) b); + return this; } @@ -190,14 +182,13 @@ public Trace codeSize(final long b) { filled.set(4); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rom.CODE_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rom.CODE_SIZE has invalid value (" + b + ")"); } codeSize.put((byte) (b >> 24)); codeSize.put((byte) (b >> 16)); codeSize.put((byte) (b >> 8)); codeSize.put((byte) b); + return this; } @@ -256,14 +247,13 @@ public Trace index(final long b) { filled.set(8); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("rom.INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rom.INDEX has invalid value (" + b + ")"); } index.put((byte) (b >> 24)); index.put((byte) (b >> 16)); index.put((byte) (b >> 8)); index.put((byte) b); + return this; } @@ -313,17 +303,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException("rom.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("rom.PROGRAM_COUNTER has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("rom.PROGRAM_COUNTER has invalid value (" + b + ")"); } programCounter.put((byte) (b >> 24)); programCounter.put((byte) (b >> 16)); programCounter.put((byte) (b >> 8)); programCounter.put((byte) b); + return this; } @@ -428,18 +411,11 @@ public Trace pushValueAcc(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "rom.PUSH_VALUE_ACC has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_ACC has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - pushValueAcc.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { pushValueAcc.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - pushValueAcc.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rom.PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - pushValueHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { pushValueHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - pushValueHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "rom.PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - pushValueLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { pushValueLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - pushValueLo.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("romlex.ADDRESS_HI", 4, length)); - headers.add(new ColumnHeader("romlex.ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX_INFTY", 4, length)); - headers.add(new ColumnHeader("romlex.CODE_HASH_HI", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_HASH_LO", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("romlex.COMMIT_TO_STATE", 1, length)); - headers.add(new ColumnHeader("romlex.DEPLOYMENT_NUMBER", 2, length)); - headers.add(new ColumnHeader("romlex.DEPLOYMENT_STATUS", 1, length)); - headers.add(new ColumnHeader("romlex.READ_FROM_STATE", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("romlex.ADDRESS_HI", 4, length)); + headers.add(new ColumnHeader("romlex.ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX_INFTY", 4, length)); + headers.add(new ColumnHeader("romlex.CODE_HASH_HI", 16, length)); + headers.add(new ColumnHeader("romlex.CODE_HASH_LO", 16, length)); + headers.add(new ColumnHeader("romlex.CODE_SIZE", 4, length)); + headers.add(new ColumnHeader("romlex.COMMIT_TO_STATE", 1, length)); + headers.add(new ColumnHeader("romlex.DEPLOYMENT_NUMBER", 2, length)); + headers.add(new ColumnHeader("romlex.DEPLOYMENT_STATUS", 1, length)); + headers.add(new ColumnHeader("romlex.READ_FROM_STATE", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.addressHi = buffers.get(0); this.addressLo = buffers.get(1); this.codeFragmentIndex = buffers.get(2); @@ -91,14 +93,13 @@ public Trace addressHi(final long b) { filled.set(0); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("romlex.ADDRESS_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.ADDRESS_HI has invalid value (" + b + ")"); } addressHi.put((byte) (b >> 24)); addressHi.put((byte) (b >> 16)); addressHi.put((byte) (b >> 8)); addressHi.put((byte) b); + return this; } @@ -112,18 +113,11 @@ public Trace addressLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "romlex.ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("romlex.ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - addressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { addressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - addressLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException( - "romlex.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -154,15 +146,13 @@ public Trace codeFragmentIndexInfty(final long b) { filled.set(3); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "romlex.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); } codeFragmentIndexInfty.put((byte) (b >> 24)); codeFragmentIndexInfty.put((byte) (b >> 16)); codeFragmentIndexInfty.put((byte) (b >> 8)); codeFragmentIndexInfty.put((byte) b); + return this; } @@ -176,18 +166,11 @@ public Trace codeHashHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "romlex.CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("romlex.CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "romlex.CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("romlex.CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - codeHashLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { codeHashLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - codeHashLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("romlex.CODE_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_SIZE has invalid value (" + b + ")"); } codeSize.put((byte) (b >> 24)); codeSize.put((byte) (b >> 16)); codeSize.put((byte) (b >> 8)); codeSize.put((byte) b); + return this; } @@ -255,12 +230,11 @@ public Trace deploymentNumber(final long b) { filled.set(8); } - if (b >= 65536L) { - throw new IllegalArgumentException("romlex.DEPLOYMENT_NUMBER has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("romlex.DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } deploymentNumber.put((byte) (b >> 8)); deploymentNumber.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java index b19a00685..c936843b3 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.shakiradata; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -56,29 +57,29 @@ public class Trace { private final MappedByteBuffer totalSize; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shakiradata.ID", 4, length)); - headers.add(new ColumnHeader("shakiradata.INDEX", 4, length)); - headers.add(new ColumnHeader("shakiradata.INDEX_MAX", 4, length)); - headers.add(new ColumnHeader("shakiradata.IS_KECCAK_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_KECCAK_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_SHA2_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_SHA2_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.LIMB", 16, length)); - headers.add(new ColumnHeader("shakiradata.nBYTES", 1, length)); - headers.add(new ColumnHeader("shakiradata.nBYTES_ACC", 4, length)); - headers.add(new ColumnHeader("shakiradata.PHASE", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_KECCAK_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_RIPEMD_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_SHA2_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SHAKIRA_STAMP", 4, length)); - headers.add(new ColumnHeader("shakiradata.TOTAL_SIZE", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("shakiradata.ID", 4, length)); + headers.add(new ColumnHeader("shakiradata.INDEX", 4, length)); + headers.add(new ColumnHeader("shakiradata.INDEX_MAX", 4, length)); + headers.add(new ColumnHeader("shakiradata.IS_KECCAK_DATA", 1, length)); + headers.add(new ColumnHeader("shakiradata.IS_KECCAK_RESULT", 1, length)); + headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_DATA", 1, length)); + headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_RESULT", 1, length)); + headers.add(new ColumnHeader("shakiradata.IS_SHA2_DATA", 1, length)); + headers.add(new ColumnHeader("shakiradata.IS_SHA2_RESULT", 1, length)); + headers.add(new ColumnHeader("shakiradata.LIMB", 16, length)); + headers.add(new ColumnHeader("shakiradata.nBYTES", 1, length)); + headers.add(new ColumnHeader("shakiradata.nBYTES_ACC", 4, length)); + headers.add(new ColumnHeader("shakiradata.PHASE", 1, length)); + headers.add(new ColumnHeader("shakiradata.SELECTOR_KECCAK_RES_HI", 1, length)); + headers.add(new ColumnHeader("shakiradata.SELECTOR_RIPEMD_RES_HI", 1, length)); + headers.add(new ColumnHeader("shakiradata.SELECTOR_SHA2_RES_HI", 1, length)); + headers.add(new ColumnHeader("shakiradata.SHAKIRA_STAMP", 4, length)); + headers.add(new ColumnHeader("shakiradata.TOTAL_SIZE", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.id = buffers.get(0); this.index = buffers.get(1); this.indexMax = buffers.get(2); @@ -114,14 +115,13 @@ public Trace id(final long b) { filled.set(0); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.ID has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.ID has invalid value (" + b + ")"); } id.put((byte) (b >> 24)); id.put((byte) (b >> 16)); id.put((byte) (b >> 8)); id.put((byte) b); + return this; } @@ -132,14 +132,13 @@ public Trace index(final long b) { filled.set(1); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.INDEX has invalid value (" + b + ")"); } index.put((byte) (b >> 24)); index.put((byte) (b >> 16)); index.put((byte) (b >> 8)); index.put((byte) b); + return this; } @@ -150,14 +149,13 @@ public Trace indexMax(final long b) { filled.set(2); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.INDEX_MAX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.INDEX_MAX has invalid value (" + b + ")"); } indexMax.put((byte) (b >> 24)); indexMax.put((byte) (b >> 16)); indexMax.put((byte) (b >> 8)); indexMax.put((byte) b); + return this; } @@ -243,18 +241,11 @@ public Trace limb(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "shakiradata.LIMB has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shakiradata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - limb.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - limb.put(bs.get(j)); - } + for(int j=0; j= 32L) { - throw new IllegalArgumentException("shakiradata.nBYTES has invalid value (" + b + ")"); - } + if(b >= 32L) { throw new IllegalArgumentException("shakiradata.nBYTES has invalid value (" + b + ")"); } nBytes.put((byte) b); + return this; } @@ -281,14 +271,13 @@ public Trace nBytesAcc(final long b) { filled.set(17); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.nBYTES_ACC has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.nBYTES_ACC has invalid value (" + b + ")"); } nBytesAcc.put((byte) (b >> 24)); nBytesAcc.put((byte) (b >> 16)); nBytesAcc.put((byte) (b >> 8)); nBytesAcc.put((byte) b); + return this; } @@ -347,14 +336,13 @@ public Trace shakiraStamp(final long b) { filled.set(14); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.SHAKIRA_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.SHAKIRA_STAMP has invalid value (" + b + ")"); } shakiraStamp.put((byte) (b >> 24)); shakiraStamp.put((byte) (b >> 16)); shakiraStamp.put((byte) (b >> 8)); shakiraStamp.put((byte) b); + return this; } @@ -365,14 +353,13 @@ public Trace totalSize(final long b) { filled.set(15); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("shakiradata.TOTAL_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.TOTAL_SIZE has invalid value (" + b + ")"); } totalSize.put((byte) (b >> 24)); totalSize.put((byte) (b >> 16)); totalSize.put((byte) (b >> 8)); totalSize.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java index eb9a5cdfb..edc03b9ea 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.shf; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -88,62 +89,62 @@ public class Trace { private final MappedByteBuffer shiftStamp; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shf.ACC_1", 16, length)); - headers.add(new ColumnHeader("shf.ACC_2", 16, length)); - headers.add(new ColumnHeader("shf.ACC_3", 16, length)); - headers.add(new ColumnHeader("shf.ACC_4", 16, length)); - headers.add(new ColumnHeader("shf.ACC_5", 16, length)); - headers.add(new ColumnHeader("shf.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("shf.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("shf.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("shf.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("shf.BIT_1", 1, length)); - headers.add(new ColumnHeader("shf.BIT_2", 1, length)); - headers.add(new ColumnHeader("shf.BIT_3", 1, length)); - headers.add(new ColumnHeader("shf.BIT_4", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_3", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_4", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_5", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_6", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_7", 1, length)); - headers.add(new ColumnHeader("shf.BITS", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_1", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_2", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_3", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_4", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_5", 1, length)); - headers.add(new ColumnHeader("shf.COUNTER", 1, length)); - headers.add(new ColumnHeader("shf.INST", 1, length)); - headers.add(new ColumnHeader("shf.IOMF", 1, length)); - headers.add(new ColumnHeader("shf.KNOWN", 1, length)); - headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_HIGH", 1, length)); - headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_LOW", 1, length)); - headers.add(new ColumnHeader("shf.LOW_3", 16, length)); - headers.add(new ColumnHeader("shf.MICRO_SHIFT_PARAMETER", 1, length)); - headers.add(new ColumnHeader("shf.NEG", 1, length)); - headers.add(new ColumnHeader("shf.ONE_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("shf.ONES", 1, length)); - headers.add(new ColumnHeader("shf.RES_HI", 16, length)); - headers.add(new ColumnHeader("shf.RES_LO", 16, length)); - headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_HIGH", 1, length)); - headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_LOW", 1, length)); - headers.add(new ColumnHeader("shf.SHB_3_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_3_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_4_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_4_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_5_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_5_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_6_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_6_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_7_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_7_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHIFT_DIRECTION", 1, length)); - headers.add(new ColumnHeader("shf.SHIFT_STAMP", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("shf.ACC_1", 16, length)); + headers.add(new ColumnHeader("shf.ACC_2", 16, length)); + headers.add(new ColumnHeader("shf.ACC_3", 16, length)); + headers.add(new ColumnHeader("shf.ACC_4", 16, length)); + headers.add(new ColumnHeader("shf.ACC_5", 16, length)); + headers.add(new ColumnHeader("shf.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("shf.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("shf.ARG_2_HI", 16, length)); + headers.add(new ColumnHeader("shf.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("shf.BIT_1", 1, length)); + headers.add(new ColumnHeader("shf.BIT_2", 1, length)); + headers.add(new ColumnHeader("shf.BIT_3", 1, length)); + headers.add(new ColumnHeader("shf.BIT_4", 1, length)); + headers.add(new ColumnHeader("shf.BIT_B_3", 1, length)); + headers.add(new ColumnHeader("shf.BIT_B_4", 1, length)); + headers.add(new ColumnHeader("shf.BIT_B_5", 1, length)); + headers.add(new ColumnHeader("shf.BIT_B_6", 1, length)); + headers.add(new ColumnHeader("shf.BIT_B_7", 1, length)); + headers.add(new ColumnHeader("shf.BITS", 1, length)); + headers.add(new ColumnHeader("shf.BYTE_1", 1, length)); + headers.add(new ColumnHeader("shf.BYTE_2", 1, length)); + headers.add(new ColumnHeader("shf.BYTE_3", 1, length)); + headers.add(new ColumnHeader("shf.BYTE_4", 1, length)); + headers.add(new ColumnHeader("shf.BYTE_5", 1, length)); + headers.add(new ColumnHeader("shf.COUNTER", 1, length)); + headers.add(new ColumnHeader("shf.INST", 1, length)); + headers.add(new ColumnHeader("shf.IOMF", 1, length)); + headers.add(new ColumnHeader("shf.KNOWN", 1, length)); + headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_HIGH", 1, length)); + headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_LOW", 1, length)); + headers.add(new ColumnHeader("shf.LOW_3", 16, length)); + headers.add(new ColumnHeader("shf.MICRO_SHIFT_PARAMETER", 1, length)); + headers.add(new ColumnHeader("shf.NEG", 1, length)); + headers.add(new ColumnHeader("shf.ONE_LINE_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("shf.ONES", 1, length)); + headers.add(new ColumnHeader("shf.RES_HI", 16, length)); + headers.add(new ColumnHeader("shf.RES_LO", 16, length)); + headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_HIGH", 1, length)); + headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_LOW", 1, length)); + headers.add(new ColumnHeader("shf.SHB_3_HI", 1, length)); + headers.add(new ColumnHeader("shf.SHB_3_LO", 1, length)); + headers.add(new ColumnHeader("shf.SHB_4_HI", 1, length)); + headers.add(new ColumnHeader("shf.SHB_4_LO", 1, length)); + headers.add(new ColumnHeader("shf.SHB_5_HI", 1, length)); + headers.add(new ColumnHeader("shf.SHB_5_LO", 1, length)); + headers.add(new ColumnHeader("shf.SHB_6_HI", 1, length)); + headers.add(new ColumnHeader("shf.SHB_6_LO", 1, length)); + headers.add(new ColumnHeader("shf.SHB_7_HI", 1, length)); + headers.add(new ColumnHeader("shf.SHB_7_LO", 1, length)); + headers.add(new ColumnHeader("shf.SHIFT_DIRECTION", 1, length)); + headers.add(new ColumnHeader("shf.SHIFT_STAMP", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.acc3 = buffers.get(2); @@ -215,18 +216,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "shf.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("shf.COUNTER has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("shf.COUNTER has invalid value (" + b + ")"); } counter.put((byte) b); + return this; } @@ -704,18 +641,11 @@ public Trace low3(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "shf.LOW_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.LOW_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - low3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { low3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - low3.put(bs.get(j)); - } + for(int j=0; j= 256L) { - throw new IllegalArgumentException("shf.MICRO_SHIFT_PARAMETER has invalid value (" + b + ")"); - } + if(b >= 256L) { throw new IllegalArgumentException("shf.MICRO_SHIFT_PARAMETER has invalid value (" + b + ")"); } microShiftParameter.put((byte) b); + return this; } @@ -781,18 +710,11 @@ public Trace resHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "shf.RES_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "shf.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("shf.SHIFT_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("shf.SHIFT_STAMP has invalid value (" + b + ")"); } shiftStamp.put((byte) (b >> 24)); shiftStamp.put((byte) (b >> 16)); shiftStamp.put((byte) (b >> 8)); shiftStamp.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java index 9bb0f44a2..7cb674d7f 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.stp; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -66,40 +67,40 @@ public class Trace { private final MappedByteBuffer wcpFlag; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("stp.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("stp.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("stp.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("stp.CT", 1, length)); - headers.add(new ColumnHeader("stp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("stp.EXISTS", 1, length)); - headers.add(new ColumnHeader("stp.EXOGENOUS_MODULE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("stp.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("stp.GAS_HI", 16, length)); - headers.add(new ColumnHeader("stp.GAS_LO", 16, length)); - headers.add(new ColumnHeader("stp.GAS_MXP", 8, length)); - headers.add(new ColumnHeader("stp.GAS_OUT_OF_POCKET", 8, length)); - headers.add(new ColumnHeader("stp.GAS_STIPEND", 8, length)); - headers.add(new ColumnHeader("stp.GAS_UPFRONT", 8, length)); - headers.add(new ColumnHeader("stp.INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("stp.IS_CALL", 1, length)); - headers.add(new ColumnHeader("stp.IS_CALLCODE", 1, length)); - headers.add(new ColumnHeader("stp.IS_CREATE", 1, length)); - headers.add(new ColumnHeader("stp.IS_CREATE2", 1, length)); - headers.add(new ColumnHeader("stp.IS_DELEGATECALL", 1, length)); - headers.add(new ColumnHeader("stp.IS_STATICCALL", 1, length)); - headers.add(new ColumnHeader("stp.MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("stp.OUT_OF_GAS_EXCEPTION", 1, length)); - headers.add(new ColumnHeader("stp.RES_LO", 16, length)); - headers.add(new ColumnHeader("stp.STAMP", 3, length)); - headers.add(new ColumnHeader("stp.VAL_HI", 16, length)); - headers.add(new ColumnHeader("stp.VAL_LO", 16, length)); - headers.add(new ColumnHeader("stp.WARM", 1, length)); - headers.add(new ColumnHeader("stp.WCP_FLAG", 1, length)); - return headers; - } - - public Trace(List buffers) { + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("stp.ARG_1_HI", 16, length)); + headers.add(new ColumnHeader("stp.ARG_1_LO", 16, length)); + headers.add(new ColumnHeader("stp.ARG_2_LO", 16, length)); + headers.add(new ColumnHeader("stp.CT", 1, length)); + headers.add(new ColumnHeader("stp.CT_MAX", 1, length)); + headers.add(new ColumnHeader("stp.EXISTS", 1, length)); + headers.add(new ColumnHeader("stp.EXOGENOUS_MODULE_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("stp.GAS_ACTUAL", 8, length)); + headers.add(new ColumnHeader("stp.GAS_HI", 16, length)); + headers.add(new ColumnHeader("stp.GAS_LO", 16, length)); + headers.add(new ColumnHeader("stp.GAS_MXP", 8, length)); + headers.add(new ColumnHeader("stp.GAS_OUT_OF_POCKET", 8, length)); + headers.add(new ColumnHeader("stp.GAS_STIPEND", 8, length)); + headers.add(new ColumnHeader("stp.GAS_UPFRONT", 8, length)); + headers.add(new ColumnHeader("stp.INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("stp.IS_CALL", 1, length)); + headers.add(new ColumnHeader("stp.IS_CALLCODE", 1, length)); + headers.add(new ColumnHeader("stp.IS_CREATE", 1, length)); + headers.add(new ColumnHeader("stp.IS_CREATE2", 1, length)); + headers.add(new ColumnHeader("stp.IS_DELEGATECALL", 1, length)); + headers.add(new ColumnHeader("stp.IS_STATICCALL", 1, length)); + headers.add(new ColumnHeader("stp.MOD_FLAG", 1, length)); + headers.add(new ColumnHeader("stp.OUT_OF_GAS_EXCEPTION", 1, length)); + headers.add(new ColumnHeader("stp.RES_LO", 16, length)); + headers.add(new ColumnHeader("stp.STAMP", 3, length)); + headers.add(new ColumnHeader("stp.VAL_HI", 16, length)); + headers.add(new ColumnHeader("stp.VAL_LO", 16, length)); + headers.add(new ColumnHeader("stp.WARM", 1, length)); + headers.add(new ColumnHeader("stp.WCP_FLAG", 1, length)); + return headers; + } + + public Trace (List buffers) { this.arg1Hi = buffers.get(0); this.arg1Lo = buffers.get(1); this.arg2Lo = buffers.get(2); @@ -149,18 +150,11 @@ public Trace arg1Hi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "stp.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - arg2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - arg2Lo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "stp.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("stp.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasActual.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasActual.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.GAS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.GAS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - gasHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { gasHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.GAS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.GAS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - gasLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { gasLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasLo.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "stp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("stp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasMxp.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasMxp.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasMxp.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "stp.GAS_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("stp.GAS_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasOutOfPocket.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasOutOfPocket.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasOutOfPocket.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "stp.GAS_STIPEND has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("stp.GAS_STIPEND has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasStipend.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasStipend.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasStipend.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "stp.GAS_UPFRONT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("stp.GAS_UPFRONT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasUpfront.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasUpfront.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasUpfront.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.RES_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - resLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - resLo.put(bs.get(j)); - } + for(int j=0; j= 16777216L) { - throw new IllegalArgumentException("stp.STAMP has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("stp.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -608,18 +531,11 @@ public Trace valHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "stp.VAL_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.VAL_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "stp.VAL_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.VAL_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - valLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { valLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - valLo.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("binreftable.INPUT_BYTE_1", 1, length)); - headers.add(new ColumnHeader("binreftable.INPUT_BYTE_2", 1, length)); - headers.add(new ColumnHeader("binreftable.INST", 1, length)); - headers.add(new ColumnHeader("binreftable.RESULT_BYTE", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("binreftable.INPUT_BYTE_1", 1, length)); + headers.add(new ColumnHeader("binreftable.INPUT_BYTE_2", 1, length)); + headers.add(new ColumnHeader("binreftable.INST", 1, length)); + headers.add(new ColumnHeader("binreftable.RESULT_BYTE", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.inputByte1 = buffers.get(0); this.inputByte2 = buffers.get(1); this.inst = buffers.get(2); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java index 3f50362c3..2bb6d5214 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.tables.instructionDecoder; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -82,56 +83,56 @@ public class Trace { private final MappedByteBuffer twoLineInstruction; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("instdecoder.ALPHA", 1, length)); - headers.add(new ColumnHeader("instdecoder.BILLING_PER_BYTE", 1, length)); - headers.add(new ColumnHeader("instdecoder.BILLING_PER_WORD", 1, length)); - headers.add(new ColumnHeader("instdecoder.DELTA", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_ACCOUNT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_ADD", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_BATCH", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_BIN", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CALL", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CONTEXT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_COPY", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CREATE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_DUP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_EXT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_HALT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_INVALID", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_JUMP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_KEC", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_LOG", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MACHINE_STATE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MOD", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MUL", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_PUSH_POP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_SHF", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_STACK_RAM", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_STORAGE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_SWAP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_TRANSACTION", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_WCP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_1", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_2", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_3", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_4", 1, length)); - headers.add(new ColumnHeader("instdecoder.IS_JUMPDEST", 1, length)); - headers.add(new ColumnHeader("instdecoder.IS_PUSH", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_FLAG", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_1", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_2", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_3", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_4", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_5", 1, length)); - headers.add(new ColumnHeader("instdecoder.OPCODE", 32, length)); - headers.add(new ColumnHeader("instdecoder.STATIC_FLAG", 1, length)); - headers.add(new ColumnHeader("instdecoder.STATIC_GAS", 4, length)); - headers.add(new ColumnHeader("instdecoder.TWO_LINE_INSTRUCTION", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("instdecoder.ALPHA", 1, length)); + headers.add(new ColumnHeader("instdecoder.BILLING_PER_BYTE", 1, length)); + headers.add(new ColumnHeader("instdecoder.BILLING_PER_WORD", 1, length)); + headers.add(new ColumnHeader("instdecoder.DELTA", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_ACCOUNT", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_ADD", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_BATCH", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_BIN", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_CALL", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_CONTEXT", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_COPY", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_CREATE", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_DUP", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_EXT", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_HALT", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_INVALID", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_JUMP", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_KEC", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_LOG", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_MACHINE_STATE", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_MOD", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_MUL", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_PUSH_POP", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_SHF", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_STACK_RAM", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_STORAGE", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_SWAP", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_TRANSACTION", 1, length)); + headers.add(new ColumnHeader("instdecoder.FAMILY_WCP", 1, length)); + headers.add(new ColumnHeader("instdecoder.FLAG_1", 1, length)); + headers.add(new ColumnHeader("instdecoder.FLAG_2", 1, length)); + headers.add(new ColumnHeader("instdecoder.FLAG_3", 1, length)); + headers.add(new ColumnHeader("instdecoder.FLAG_4", 1, length)); + headers.add(new ColumnHeader("instdecoder.IS_JUMPDEST", 1, length)); + headers.add(new ColumnHeader("instdecoder.IS_PUSH", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_FLAG", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_TYPE_1", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_TYPE_2", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_TYPE_3", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_TYPE_4", 1, length)); + headers.add(new ColumnHeader("instdecoder.MXP_TYPE_5", 1, length)); + headers.add(new ColumnHeader("instdecoder.OPCODE", 32, length)); + headers.add(new ColumnHeader("instdecoder.STATIC_FLAG", 1, length)); + headers.add(new ColumnHeader("instdecoder.STATIC_GAS", 4, length)); + headers.add(new ColumnHeader("instdecoder.TWO_LINE_INSTRUCTION", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.alpha = buffers.get(0); this.billingPerByte = buffers.get(1); this.billingPerWord = buffers.get(2); @@ -689,18 +690,11 @@ public Trace opcode(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 256) { - throw new IllegalArgumentException( - "instdecoder.OPCODE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 256) { throw new IllegalArgumentException("instdecoder.OPCODE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 32; i++) { - opcode.put((byte) 0); - } + for(int i=bs.size(); i<32; i++) { opcode.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - opcode.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("instdecoder.STATIC_GAS has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("instdecoder.STATIC_GAS has invalid value (" + b + ")"); } staticGas.put((byte) (b >> 24)); staticGas.put((byte) (b >> 16)); staticGas.put((byte) (b >> 8)); staticGas.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java index 83e7a3b1d..e4bca602e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.tables.shf; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -22,6 +23,7 @@ import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.types.UnsignedByte; +import org.apache.tuweni.bytes.Bytes; /** * WARNING: This code is generated automatically. @@ -42,17 +44,17 @@ public class Trace { private final MappedByteBuffer rap; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shfreftable.BYTE1", 1, length)); - headers.add(new ColumnHeader("shfreftable.IOMF", 1, length)); - headers.add(new ColumnHeader("shfreftable.LAS", 1, length)); - headers.add(new ColumnHeader("shfreftable.MSHP", 1, length)); - headers.add(new ColumnHeader("shfreftable.ONES", 1, length)); - headers.add(new ColumnHeader("shfreftable.RAP", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("shfreftable.BYTE1", 1, length)); + headers.add(new ColumnHeader("shfreftable.IOMF", 1, length)); + headers.add(new ColumnHeader("shfreftable.LAS", 1, length)); + headers.add(new ColumnHeader("shfreftable.MSHP", 1, length)); + headers.add(new ColumnHeader("shfreftable.ONES", 1, length)); + headers.add(new ColumnHeader("shfreftable.RAP", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.byte1 = buffers.get(0); this.iomf = buffers.get(1); this.las = buffers.get(2); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java index f361638f9..1604c27ec 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.trm; +import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.BitSet; @@ -50,24 +51,24 @@ public class Trace { private final MappedByteBuffer trmAddressHi; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("trm.ACC_HI", 16, length)); - headers.add(new ColumnHeader("trm.ACC_LO", 16, length)); - headers.add(new ColumnHeader("trm.ACC_T", 4, length)); - headers.add(new ColumnHeader("trm.BYTE_HI", 1, length)); - headers.add(new ColumnHeader("trm.BYTE_LO", 1, length)); - headers.add(new ColumnHeader("trm.CT", 1, length)); - headers.add(new ColumnHeader("trm.IS_PRECOMPILE", 1, length)); - headers.add(new ColumnHeader("trm.ONE", 1, length)); - headers.add(new ColumnHeader("trm.PLATEAU_BIT", 1, length)); - headers.add(new ColumnHeader("trm.RAW_ADDRESS_HI", 16, length)); - headers.add(new ColumnHeader("trm.RAW_ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("trm.STAMP", 3, length)); - headers.add(new ColumnHeader("trm.TRM_ADDRESS_HI", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("trm.ACC_HI", 16, length)); + headers.add(new ColumnHeader("trm.ACC_LO", 16, length)); + headers.add(new ColumnHeader("trm.ACC_T", 4, length)); + headers.add(new ColumnHeader("trm.BYTE_HI", 1, length)); + headers.add(new ColumnHeader("trm.BYTE_LO", 1, length)); + headers.add(new ColumnHeader("trm.CT", 1, length)); + headers.add(new ColumnHeader("trm.IS_PRECOMPILE", 1, length)); + headers.add(new ColumnHeader("trm.ONE", 1, length)); + headers.add(new ColumnHeader("trm.PLATEAU_BIT", 1, length)); + headers.add(new ColumnHeader("trm.RAW_ADDRESS_HI", 16, length)); + headers.add(new ColumnHeader("trm.RAW_ADDRESS_LO", 16, length)); + headers.add(new ColumnHeader("trm.STAMP", 3, length)); + headers.add(new ColumnHeader("trm.TRM_ADDRESS_HI", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.accHi = buffers.get(0); this.accLo = buffers.get(1); this.accT = buffers.get(2); @@ -101,18 +102,11 @@ public Trace accHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "trm.ACC_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.ACC_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "trm.ACC_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.ACC_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - accLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { accLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - accLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("trm.ACC_T has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("trm.ACC_T has invalid value (" + b + ")"); } accT.put((byte) (b >> 24)); accT.put((byte) (b >> 16)); accT.put((byte) (b >> 8)); accT.put((byte) b); + return this; } @@ -192,11 +178,10 @@ public Trace ct(final long b) { filled.set(5); } - if (b >= 16L) { - throw new IllegalArgumentException("trm.CT has invalid value (" + b + ")"); - } + if(b >= 16L) { throw new IllegalArgumentException("trm.CT has invalid value (" + b + ")"); } ct.put((byte) b); + return this; } @@ -246,18 +231,11 @@ public Trace rawAddressHi(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "trm.RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAddressHi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAddressHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAddressHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "trm.RAW_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.RAW_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - rawAddressLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { rawAddressLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - rawAddressLo.put(bs.get(j)); - } + for(int j=0; j= 16777216L) { - throw new IllegalArgumentException("trm.STAMP has invalid value (" + b + ")"); - } + if(b >= 16777216L) { throw new IllegalArgumentException("trm.STAMP has invalid value (" + b + ")"); } stamp.put((byte) (b >> 16)); stamp.put((byte) (b >> 8)); stamp.put((byte) b); + return this; } @@ -312,14 +282,13 @@ public Trace trmAddressHi(final long b) { filled.set(12); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("trm.TRM_ADDRESS_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("trm.TRM_ADDRESS_HI has invalid value (" + b + ")"); } trmAddressHi.put((byte) (b >> 24)); trmAddressHi.put((byte) (b >> 16)); trmAddressHi.put((byte) (b >> 8)); trmAddressHi.put((byte) b); + return this; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java index 8aca01a9f..2fe3d1806 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java @@ -45,17 +45,14 @@ public class Trace { public static final int CT_MAX_TYPE_2 = 0x8; public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; public static final int EIP_3541_MARKER = 0xef; - public static final BigInteger EMPTY_KECCAK_HI = - new BigInteger("262949717399590921288928019264691438528"); - public static final BigInteger EMPTY_KECCAK_LO = - new BigInteger("304396909071904405792975023732328604784"); + public static final BigInteger EMPTY_KECCAK_HI = new BigInteger("262949717399590921288928019264691438528"); + public static final BigInteger EMPTY_KECCAK_LO = new BigInteger("304396909071904405792975023732328604784"); public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; - public static final BigInteger EMPTY_RIPEMD_LO = - new BigInteger("263072838190121256777638892741499129137"); - public static final BigInteger EMPTY_SHA2_HI = - new BigInteger("302652579918965577886386472538583578916"); - public static final BigInteger EMPTY_SHA2_LO = - new BigInteger("52744687940778649747319168982913824853"); + public static final BigInteger EMPTY_RIPEMD_LO = new BigInteger("263072838190121256777638892741499129137"); + public static final BigInteger EMPTY_SHA2_HI = new BigInteger("302652579918965577886386472538583578916"); + public static final BigInteger EMPTY_SHA2_LO = new BigInteger("52744687940778649747319168982913824853"); + public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; + public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; public static final int EVM_INST_ADD = 0x1; public static final int EVM_INST_ADDMOD = 0x8; public static final int EVM_INST_ADDRESS = 0x30; @@ -249,10 +246,13 @@ public class Trace { public static final int GAS_CONST_G_VERY_LOW = 0x3; public static final int GAS_CONST_G_WARM_ACCESS = 0x64; public static final int GAS_CONST_G_ZERO = 0x0; + public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; public static final int LINEA_BASE_FEE = 0x7; public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; public static final int LINEA_CHAIN_ID = 0xe708; public static final int LINEA_DIFFICULTY = 0x2; + public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; + public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; @@ -442,58 +442,58 @@ public class Trace { private final MappedByteBuffer wcpFlag; static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("txndata.ABS_TX_NUM", 2, length)); - headers.add(new ColumnHeader("txndata.ABS_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("txndata.ARG_ONE_LO", 16, length)); - headers.add(new ColumnHeader("txndata.ARG_TWO_LO", 16, length)); - headers.add(new ColumnHeader("txndata.BASEFEE", 16, length)); - headers.add(new ColumnHeader("txndata.BLOCK_GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("txndata.CALL_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("txndata.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("txndata.COINBASE_HI", 4, length)); - headers.add(new ColumnHeader("txndata.COINBASE_LO", 16, length)); - headers.add(new ColumnHeader("txndata.COPY_TXCD", 1, length)); - headers.add(new ColumnHeader("txndata.CT", 1, length)); - headers.add(new ColumnHeader("txndata.EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("txndata.FROM_HI", 4, length)); - headers.add(new ColumnHeader("txndata.FROM_LO", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_CUMULATIVE", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_INITIALLY_AVAILABLE", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_LEFTOVER", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("txndata.GAS_PRICE", 8, length)); - headers.add(new ColumnHeader("txndata.INIT_CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("txndata.INITIAL_BALANCE", 16, length)); - headers.add(new ColumnHeader("txndata.INST", 1, length)); - headers.add(new ColumnHeader("txndata.IS_DEP", 1, length)); - headers.add(new ColumnHeader("txndata.IS_LAST_TX_OF_BLOCK", 1, length)); - headers.add(new ColumnHeader("txndata.NONCE", 8, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_HI", 8, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_LO", 16, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_RLP_TXNRCPT", 16, length)); - headers.add(new ColumnHeader("txndata.PHASE_RLP_TXN", 1, length)); - headers.add(new ColumnHeader("txndata.PHASE_RLP_TXNRCPT", 1, length)); - headers.add(new ColumnHeader("txndata.PRIORITY_FEE_PER_GAS", 16, length)); - headers.add(new ColumnHeader("txndata.REFUND_COUNTER", 16, length)); - headers.add(new ColumnHeader("txndata.REFUND_EFFECTIVE", 16, length)); - headers.add(new ColumnHeader("txndata.REL_BLOCK", 2, length)); - headers.add(new ColumnHeader("txndata.REL_TX_NUM", 2, length)); - headers.add(new ColumnHeader("txndata.REL_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("txndata.REQUIRES_EVM_EXECUTION", 1, length)); - headers.add(new ColumnHeader("txndata.RES", 8, length)); - headers.add(new ColumnHeader("txndata.STATUS_CODE", 1, length)); - headers.add(new ColumnHeader("txndata.TO_HI", 4, length)); - headers.add(new ColumnHeader("txndata.TO_LO", 16, length)); - headers.add(new ColumnHeader("txndata.TYPE0", 1, length)); - headers.add(new ColumnHeader("txndata.TYPE1", 1, length)); - headers.add(new ColumnHeader("txndata.TYPE2", 1, length)); - headers.add(new ColumnHeader("txndata.VALUE", 16, length)); - headers.add(new ColumnHeader("txndata.WCP_FLAG", 1, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("txndata.ABS_TX_NUM", 2, length)); + headers.add(new ColumnHeader("txndata.ABS_TX_NUM_MAX", 2, length)); + headers.add(new ColumnHeader("txndata.ARG_ONE_LO", 16, length)); + headers.add(new ColumnHeader("txndata.ARG_TWO_LO", 16, length)); + headers.add(new ColumnHeader("txndata.BASEFEE", 16, length)); + headers.add(new ColumnHeader("txndata.BLOCK_GAS_LIMIT", 8, length)); + headers.add(new ColumnHeader("txndata.CALL_DATA_SIZE", 4, length)); + headers.add(new ColumnHeader("txndata.CODE_FRAGMENT_INDEX", 4, length)); + headers.add(new ColumnHeader("txndata.COINBASE_HI", 4, length)); + headers.add(new ColumnHeader("txndata.COINBASE_LO", 16, length)); + headers.add(new ColumnHeader("txndata.COPY_TXCD", 1, length)); + headers.add(new ColumnHeader("txndata.CT", 1, length)); + headers.add(new ColumnHeader("txndata.EUC_FLAG", 1, length)); + headers.add(new ColumnHeader("txndata.FROM_HI", 4, length)); + headers.add(new ColumnHeader("txndata.FROM_LO", 16, length)); + headers.add(new ColumnHeader("txndata.GAS_CUMULATIVE", 16, length)); + headers.add(new ColumnHeader("txndata.GAS_INITIALLY_AVAILABLE", 16, length)); + headers.add(new ColumnHeader("txndata.GAS_LEFTOVER", 16, length)); + headers.add(new ColumnHeader("txndata.GAS_LIMIT", 8, length)); + headers.add(new ColumnHeader("txndata.GAS_PRICE", 8, length)); + headers.add(new ColumnHeader("txndata.INIT_CODE_SIZE", 4, length)); + headers.add(new ColumnHeader("txndata.INITIAL_BALANCE", 16, length)); + headers.add(new ColumnHeader("txndata.INST", 1, length)); + headers.add(new ColumnHeader("txndata.IS_DEP", 1, length)); + headers.add(new ColumnHeader("txndata.IS_LAST_TX_OF_BLOCK", 1, length)); + headers.add(new ColumnHeader("txndata.NONCE", 8, length)); + headers.add(new ColumnHeader("txndata.OUTGOING_HI", 8, length)); + headers.add(new ColumnHeader("txndata.OUTGOING_LO", 16, length)); + headers.add(new ColumnHeader("txndata.OUTGOING_RLP_TXNRCPT", 16, length)); + headers.add(new ColumnHeader("txndata.PHASE_RLP_TXN", 1, length)); + headers.add(new ColumnHeader("txndata.PHASE_RLP_TXNRCPT", 1, length)); + headers.add(new ColumnHeader("txndata.PRIORITY_FEE_PER_GAS", 16, length)); + headers.add(new ColumnHeader("txndata.REFUND_COUNTER", 16, length)); + headers.add(new ColumnHeader("txndata.REFUND_EFFECTIVE", 16, length)); + headers.add(new ColumnHeader("txndata.REL_BLOCK", 2, length)); + headers.add(new ColumnHeader("txndata.REL_TX_NUM", 2, length)); + headers.add(new ColumnHeader("txndata.REL_TX_NUM_MAX", 2, length)); + headers.add(new ColumnHeader("txndata.REQUIRES_EVM_EXECUTION", 1, length)); + headers.add(new ColumnHeader("txndata.RES", 8, length)); + headers.add(new ColumnHeader("txndata.STATUS_CODE", 1, length)); + headers.add(new ColumnHeader("txndata.TO_HI", 4, length)); + headers.add(new ColumnHeader("txndata.TO_LO", 16, length)); + headers.add(new ColumnHeader("txndata.TYPE0", 1, length)); + headers.add(new ColumnHeader("txndata.TYPE1", 1, length)); + headers.add(new ColumnHeader("txndata.TYPE2", 1, length)); + headers.add(new ColumnHeader("txndata.VALUE", 16, length)); + headers.add(new ColumnHeader("txndata.WCP_FLAG", 1, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.absTxNum = buffers.get(0); this.absTxNumMax = buffers.get(1); this.argOneLo = buffers.get(2); @@ -558,12 +558,11 @@ public Trace absTxNum(final long b) { filled.set(0); } - if (b >= 65536L) { - throw new IllegalArgumentException("txndata.ABS_TX_NUM has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("txndata.ABS_TX_NUM has invalid value (" + b + ")"); } absTxNum.put((byte) (b >> 8)); absTxNum.put((byte) b); + return this; } @@ -574,12 +573,11 @@ public Trace absTxNumMax(final long b) { filled.set(1); } - if (b >= 65536L) { - throw new IllegalArgumentException("txndata.ABS_TX_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("txndata.ABS_TX_NUM_MAX has invalid value (" + b + ")"); } absTxNumMax.put((byte) (b >> 8)); absTxNumMax.put((byte) b); + return this; } @@ -593,18 +591,11 @@ public Trace argOneLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "txndata.ARG_ONE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.ARG_ONE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argOneLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argOneLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argOneLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.ARG_TWO_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.ARG_TWO_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argTwoLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argTwoLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argTwoLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - basefee.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { basefee.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - basefee.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "txndata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - blockGasLimit.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { blockGasLimit.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - blockGasLimit.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("txndata.CALL_DATA_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.CALL_DATA_SIZE has invalid value (" + b + ")"); } callDataSize.put((byte) (b >> 24)); callDataSize.put((byte) (b >> 16)); callDataSize.put((byte) (b >> 8)); callDataSize.put((byte) b); + return this; } @@ -712,15 +681,13 @@ public Trace codeFragmentIndex(final long b) { filled.set(7); } - if (b >= 4294967296L) { - throw new IllegalArgumentException( - "txndata.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } codeFragmentIndex.put((byte) (b >> 24)); codeFragmentIndex.put((byte) (b >> 16)); codeFragmentIndex.put((byte) (b >> 8)); codeFragmentIndex.put((byte) b); + return this; } @@ -731,14 +698,13 @@ public Trace coinbaseHi(final long b) { filled.set(8); } - if (b >= 4294967296L) { - throw new IllegalArgumentException("txndata.COINBASE_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.COINBASE_HI has invalid value (" + b + ")"); } coinbaseHi.put((byte) (b >> 24)); coinbaseHi.put((byte) (b >> 16)); coinbaseHi.put((byte) (b >> 8)); coinbaseHi.put((byte) b); + return this; } @@ -752,18 +718,11 @@ public Trace coinbaseLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "txndata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - coinbaseLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { coinbaseLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - coinbaseLo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("txndata.FROM_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.FROM_HI has invalid value (" + b + ")"); } fromHi.put((byte) (b >> 24)); fromHi.put((byte) (b >> 16)); fromHi.put((byte) (b >> 8)); fromHi.put((byte) b); + return this; } @@ -832,18 +790,11 @@ public Trace fromLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "txndata.FROM_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.FROM_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - fromLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { fromLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - fromLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.GAS_CUMULATIVE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.GAS_CUMULATIVE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - gasCumulative.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { gasCumulative.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasCumulative.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - gasInitiallyAvailable.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { gasInitiallyAvailable.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasInitiallyAvailable.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - gasLeftover.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { gasLeftover.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasLeftover.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "txndata.GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasLimit.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasLimit.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasLimit.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "txndata.GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - gasPrice.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { gasPrice.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - gasPrice.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("txndata.INIT_CODE_SIZE has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.INIT_CODE_SIZE has invalid value (" + b + ")"); } initCodeSize.put((byte) (b >> 24)); initCodeSize.put((byte) (b >> 16)); initCodeSize.put((byte) (b >> 8)); initCodeSize.put((byte) b); + return this; } @@ -1006,18 +921,11 @@ public Trace initialBalance(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "txndata.INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - initialBalance.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { initialBalance.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - initialBalance.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "txndata.NONCE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.NONCE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - nonce.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - nonce.put(bs.get(j)); - } + for(int j=0; j 64) { - throw new IllegalArgumentException( - "txndata.OUTGOING_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.OUTGOING_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - outgoingHi.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { outgoingHi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingHi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.OUTGOING_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.OUTGOING_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.OUTGOING_RLP_TXNRCPT has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.OUTGOING_RLP_TXNRCPT has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - outgoingRlpTxnrcpt.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { outgoingRlpTxnrcpt.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - outgoingRlpTxnrcpt.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - priorityFeePerGas.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { priorityFeePerGas.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - priorityFeePerGas.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.REFUND_COUNTER has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.REFUND_COUNTER has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - refundCounter.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { refundCounter.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundCounter.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - refundEffective.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { refundEffective.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - refundEffective.put(bs.get(j)); - } + for(int j=0; j= 65536L) { - throw new IllegalArgumentException("txndata.REL_BLOCK has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("txndata.REL_BLOCK has invalid value (" + b + ")"); } relBlock.put((byte) (b >> 8)); relBlock.put((byte) b); + return this; } @@ -1287,12 +1145,11 @@ public Trace relTxNum(final long b) { filled.set(35); } - if (b >= 65536L) { - throw new IllegalArgumentException("txndata.REL_TX_NUM has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("txndata.REL_TX_NUM has invalid value (" + b + ")"); } relTxNum.put((byte) (b >> 8)); relTxNum.put((byte) b); + return this; } @@ -1303,12 +1160,11 @@ public Trace relTxNumMax(final long b) { filled.set(36); } - if (b >= 65536L) { - throw new IllegalArgumentException("txndata.REL_TX_NUM_MAX has invalid value (" + b + ")"); - } + if(b >= 65536L) { throw new IllegalArgumentException("txndata.REL_TX_NUM_MAX has invalid value (" + b + ")"); } relTxNumMax.put((byte) (b >> 8)); relTxNumMax.put((byte) b); + return this; } @@ -1334,18 +1190,11 @@ public Trace res(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 64) { - throw new IllegalArgumentException( - "txndata.RES has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.RES has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 8; i++) { - res.put((byte) 0); - } + for(int i=bs.size(); i<8; i++) { res.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - res.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("txndata.TO_HI has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.TO_HI has invalid value (" + b + ")"); } toHi.put((byte) (b >> 24)); toHi.put((byte) (b >> 16)); toHi.put((byte) (b >> 8)); toHi.put((byte) b); + return this; } @@ -1390,18 +1238,11 @@ public Trace toLo(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "txndata.TO_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.TO_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - toLo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { toLo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - toLo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "txndata.VALUE has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.VALUE has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - value.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { value.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - value.put(bs.get(j)); - } + for(int j=0; j headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("wcp.ACC_1", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_2", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_3", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_4", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_5", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_6", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_1_HI", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_1_LO", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_2_HI", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_2_LO", 16, length)); - headers.add(new ColumnHeader("wcp.BIT_1", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_2", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_3", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_4", 1, length)); - headers.add(new ColumnHeader("wcp.BITS", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_1", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_2", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_3", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_4", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_5", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_6", 1, length)); - headers.add(new ColumnHeader("wcp.COUNTER", 1, length)); - headers.add(new ColumnHeader("wcp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("wcp.INST", 1, length)); - headers.add(new ColumnHeader("wcp.IS_EQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_GEQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_GT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_ISZERO", 1, length)); - headers.add(new ColumnHeader("wcp.IS_LEQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_LT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_SGT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_SLT", 1, length)); - headers.add(new ColumnHeader("wcp.NEG_1", 1, length)); - headers.add(new ColumnHeader("wcp.NEG_2", 1, length)); - headers.add(new ColumnHeader("wcp.ONE_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("wcp.RESULT", 1, length)); - headers.add(new ColumnHeader("wcp.VARIABLE_LENGTH_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("wcp.WORD_COMPARISON_STAMP", 4, length)); - return headers; + List headers = new ArrayList<>(); + headers.add(new ColumnHeader("wcp.ACC_1", 16, length)); + headers.add(new ColumnHeader("wcp.ACC_2", 16, length)); + headers.add(new ColumnHeader("wcp.ACC_3", 16, length)); + headers.add(new ColumnHeader("wcp.ACC_4", 16, length)); + headers.add(new ColumnHeader("wcp.ACC_5", 16, length)); + headers.add(new ColumnHeader("wcp.ACC_6", 16, length)); + headers.add(new ColumnHeader("wcp.ARGUMENT_1_HI", 16, length)); + headers.add(new ColumnHeader("wcp.ARGUMENT_1_LO", 16, length)); + headers.add(new ColumnHeader("wcp.ARGUMENT_2_HI", 16, length)); + headers.add(new ColumnHeader("wcp.ARGUMENT_2_LO", 16, length)); + headers.add(new ColumnHeader("wcp.BIT_1", 1, length)); + headers.add(new ColumnHeader("wcp.BIT_2", 1, length)); + headers.add(new ColumnHeader("wcp.BIT_3", 1, length)); + headers.add(new ColumnHeader("wcp.BIT_4", 1, length)); + headers.add(new ColumnHeader("wcp.BITS", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_1", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_2", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_3", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_4", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_5", 1, length)); + headers.add(new ColumnHeader("wcp.BYTE_6", 1, length)); + headers.add(new ColumnHeader("wcp.COUNTER", 1, length)); + headers.add(new ColumnHeader("wcp.CT_MAX", 1, length)); + headers.add(new ColumnHeader("wcp.INST", 1, length)); + headers.add(new ColumnHeader("wcp.IS_EQ", 1, length)); + headers.add(new ColumnHeader("wcp.IS_GEQ", 1, length)); + headers.add(new ColumnHeader("wcp.IS_GT", 1, length)); + headers.add(new ColumnHeader("wcp.IS_ISZERO", 1, length)); + headers.add(new ColumnHeader("wcp.IS_LEQ", 1, length)); + headers.add(new ColumnHeader("wcp.IS_LT", 1, length)); + headers.add(new ColumnHeader("wcp.IS_SGT", 1, length)); + headers.add(new ColumnHeader("wcp.IS_SLT", 1, length)); + headers.add(new ColumnHeader("wcp.NEG_1", 1, length)); + headers.add(new ColumnHeader("wcp.NEG_2", 1, length)); + headers.add(new ColumnHeader("wcp.ONE_LINE_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("wcp.RESULT", 1, length)); + headers.add(new ColumnHeader("wcp.VARIABLE_LENGTH_INSTRUCTION", 1, length)); + headers.add(new ColumnHeader("wcp.WORD_COMPARISON_STAMP", 4, length)); + return headers; } - public Trace(List buffers) { + public Trace (List buffers) { this.acc1 = buffers.get(0); this.acc2 = buffers.get(1); this.acc3 = buffers.get(2); @@ -176,18 +177,11 @@ public Trace acc1(final Bytes b) { // Trim array to size Bytes bs = b.trimLeadingZeros(); // Sanity check against expected width - if (bs.bitLength() > 128) { - throw new IllegalArgumentException( - "wcp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc1.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc1.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc2.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc2.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc3.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc3.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc4.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc4.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc5.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc5.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - acc6.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { acc6.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - acc6.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument1Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument1Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument1Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument1Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument1Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument1Lo.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument2Hi.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument2Hi.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument2Hi.put(bs.get(j)); - } + for(int j=0; j 128) { - throw new IllegalArgumentException( - "wcp.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); - } + if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); } // Write padding (if necessary) - for (int i = bs.size(); i < 16; i++) { - argument2Lo.put((byte) 0); - } + for(int i=bs.size(); i<16; i++) { argument2Lo.put((byte) 0); } // Write bytes - for (int j = 0; j < bs.size(); j++) { - argument2Lo.put(bs.get(j)); - } + for(int j=0; j= 4294967296L) { - throw new IllegalArgumentException("wcp.WORD_COMPARISON_STAMP has invalid value (" + b + ")"); - } + if(b >= 4294967296L) { throw new IllegalArgumentException("wcp.WORD_COMPARISON_STAMP has invalid value (" + b + ")"); } wordComparisonStamp.put((byte) (b >> 24)); wordComparisonStamp.put((byte) (b >> 16)); wordComparisonStamp.put((byte) (b >> 8)); wordComparisonStamp.put((byte) b); + return this; } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java index 023c83705..61e5ce98a 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java @@ -16,7 +16,7 @@ import static net.consensys.linea.zktracer.MultiBlockUtils.multiBlocksTest; import static net.consensys.linea.zktracer.module.blockdata.NextGasLimitScenario.*; -import static net.consensys.linea.zktracer.module.constants.Trace.*; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; import java.util.ArrayList; import java.util.List; diff --git a/buildSrc/src/main/groovy/TraceFilesTask.groovy b/buildSrc/src/main/groovy/TraceFilesTask.groovy index 83ca74782..cdb046fca 100644 --- a/buildSrc/src/main/groovy/TraceFilesTask.groovy +++ b/buildSrc/src/main/groovy/TraceFilesTask.groovy @@ -24,12 +24,9 @@ abstract class TraceFilesTask extends Exec { protected void exec() { def arguments = ["besu", "-P", "${moduleDir.getOrElse(module.get()).replaceAll('/','.')}", - "-o", "${project.projectDir}/src/main/java/net/consensys/linea/zktracer/module/${moduleDir.getOrElse(module.get())}" + "-o", "${project.projectDir}/src/main/java/net/consensys/linea/zktracer/module/${moduleDir.getOrElse(module.get())}", + "-c", "${className.getOrElse('Trace')}" ] - if(project.hasProperty("className")) { - arguments.add("-c") - arguments.add("${className.get()}") - } arguments.addAll(files.get().collect({"linea-constraints/${it}"})) workingDir project.rootDir diff --git a/gradle/lint.gradle b/gradle/lint.gradle index 6e14c77bd..494deed61 100644 --- a/gradle/lint.gradle +++ b/gradle/lint.gradle @@ -40,7 +40,8 @@ spotless { java { // This path needs to be relative to each project target 'src/**/*.java' - targetExclude '**/src/main/**/generated/**', '**/src/test/**/generated/**', '**/src/jmh/**/generated/**' + targetExclude '**/Trace.java', '**/GlobalConstants.java' + removeUnusedImports() googleJavaFormat('1.17.0') importOrder '\\#', 'java', 'javax', '' @@ -81,15 +82,3 @@ task checkSpdxHeader(type: CheckSpdxHeader) { } tasks.check.dependsOn(checkSpdxHeader) - -// Enable running spotlessCheck after code compilation. -//allprojects { -// afterEvaluate { -// def spotless = tasks.named('spotlessCheck') -// tasks.withType(JavaCompile).tap { -// configureEach { -// finalizedBy(spotless, checkSpdxHeader) -// } -// } -// } -//} diff --git a/gradle/tests.gradle b/gradle/tests.gradle index 7fc629069..eeb24be97 100644 --- a/gradle/tests.gradle +++ b/gradle/tests.gradle @@ -41,7 +41,8 @@ apply plugin: 'com.adarshr.test-logger' * - 'root.log.level' and 'evm.log.level': allow to control the log level used during the tests. */ tasks.withType(Test).configureEach { - dependsOn(buildZkevmBin) + dependsOn 'buildZkevmBin' + dependsOn 'buildTracer' minHeapSize = "4g" maxHeapSize = "8g" diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index c693636d0..04f89e7fd 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -107,5 +107,26 @@ tasks.register('binreftable', TraceFilesTask) { className = "GlobalConstants" module = moduleName files = [ "${moduleName}/constants.lisp"] + + doFirst { + // Create constants directory (corset doesn't do this for us) + mkdir "src/main/java/net/consensys/linea/zktracer/module/constants" + } } } + +tasks.register('buildTracer') { + group "Trace files generation" + dependsOn 'add', 'ext', 'mul', 'mod' + dependsOn 'hub' + dependsOn 'instdecoder' + dependsOn 'shfreftable' + dependsOn 'binreftable' + dependsOn 'bin', 'blockhash', 'euc', 'mmio', 'shf', 'wcp', 'rlptxn', 'rom', 'romlex', 'trm', 'stp', 'loginfo', 'logdata', 'gas' + dependsOn 'mmu', 'blake2fmodexpdata', 'blockdata', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata' + dependsOn 'txndata' + dependsOn 'constants' +} + +// Configure default build task to require the tracer is built first. +compileJava.dependsOn 'buildTracer' diff --git a/linea-constraints b/linea-constraints index 2a343faa8..fc69fd62b 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 2a343faa803194c2c5853ee449364039324b1439 +Subproject commit fc69fd62bbfe9950ce66694479153d3f7d120aec diff --git a/plugins/build.gradle b/plugins/build.gradle index c3f69bd40..a46164671 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -27,9 +27,10 @@ version = rootProject.version apply from: rootProject.file("gradle/java.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') -apply from: rootProject.file("gradle/corset.gradle") -apply from: rootProject.file("gradle/tests.gradle") -apply from: rootProject.file("gradle/build-aliases.gradle") +//apply from: rootProject.file("gradle/corset.gradle") +//apply from: rootProject.file("gradle/tests.gradle") +//apply from: rootProject.file("gradle/trace-files.gradle") +//apply from: rootProject.file("gradle/build-aliases.gradle") apply from: rootProject.file("gradle/check-licenses.gradle") apply from: rootProject.file("gradle/lint.gradle") diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index f7bdd8379..e231009a0 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -19,7 +19,8 @@ plugins { apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/java.gradle") -apply from: rootProject.file("gradle/tests.gradle") +//apply from: rootProject.file("gradle/tests.gradle") +//apply from: rootProject.file("gradle/trace-files.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') apply from: rootProject.file("gradle/lint.gradle") diff --git a/testing/build.gradle b/testing/build.gradle index def0471af..b8ae6ca2b 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -7,9 +7,10 @@ plugins { id "linea.yul-plugin" } -apply from: rootProject.file("gradle/corset.gradle") +//apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/java.gradle") -apply from: rootProject.file("gradle/tests.gradle") +//apply from: rootProject.file("gradle/tests.gradle") +//apply from: rootProject.file("gradle/trace-files.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') apply from: rootProject.file("gradle/lint.gradle") From c27da85576be9f49fb58f051572f9dbfde3f37bd Mon Sep 17 00:00:00 2001 From: waskow-consensys <104443911+waskow-consensys@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:58:19 -0500 Subject: [PATCH 11/54] CHANGED - use github actions concurrency to reduce outdated runs (#1691) --- .github/workflows/gradle-ethereum-tests.yml | 4 ++++ .github/workflows/gradle-nightly-tests.yml | 4 ++++ .github/workflows/gradle-tests.yml | 4 ++++ .github/workflows/gradle-weekly-tests.yml | 5 +++++ .github/workflows/reference-blockchain-tests.yml | 4 ++++ 5 files changed, 21 insertions(+) diff --git a/.github/workflows/gradle-ethereum-tests.yml b/.github/workflows/gradle-ethereum-tests.yml index a1c96a41a..29cb05dec 100644 --- a/.github/workflows/gradle-ethereum-tests.yml +++ b/.github/workflows/gradle-ethereum-tests.yml @@ -5,6 +5,10 @@ on: - cron: "0 23 * * 1-5" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: ethereum-tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index 8c68b0508..30e99b142 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -5,6 +5,10 @@ on: - cron: "0 22 * * 1-5" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: nightly-tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index 01645de73..2ca42c2d8 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -13,6 +13,10 @@ on: type: boolean default: false +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: # ================================================================== # Build diff --git a/.github/workflows/gradle-weekly-tests.yml b/.github/workflows/gradle-weekly-tests.yml index 4a81da4ad..276f3d77b 100644 --- a/.github/workflows/gradle-weekly-tests.yml +++ b/.github/workflows/gradle-weekly-tests.yml @@ -5,6 +5,11 @@ on: - cron: "0 4 * * 1" workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index a6945da87..bdc1b7518 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -23,6 +23,10 @@ on: required: false type: string +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: blockchain-reference-tests: runs-on: [ubuntu-latest-128] From 9604ddff2c9cf9188294e8b727b77564ff588d44 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Wed, 15 Jan 2025 12:00:05 +1300 Subject: [PATCH 12/54] support default filter for cron job (#1698) --- .github/workflows/reference-blockchain-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index bdc1b7518..17cb567be 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -72,7 +72,7 @@ jobs: run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json - name: Run reference blockchain tests - run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter }}" + run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter || 'BlockchainReferenceTest_*' }}" timeout-minutes: 360 env: REFERENCE_TESTS_PARALLELISM: 2 From 8a1f6b3de7ee6280d21a173791e73b8a93ce6139 Mon Sep 17 00:00:00 2001 From: amkCha <29160563+amkCha@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:23:00 +0100 Subject: [PATCH 13/54] Feat/blockdata unique gas limit constant (#1699) * fix `gradle build` This ensures that, when running `gradle build`, it also arises the `buildTracer` is run beforehand. This is necessary to ensure that all `Trace.java` files (and related) are generated. * force trace files to build beforehand This attempts to force the `Trace.java` files to be built before anything else important happens. * fix(tracejava): replay tests * feat(tracejava): reintegrate blockhash * feat(blockdata): add linea and ethereum tracer build task * fix(blockdata): remove getter * feat(blockdata): add eth trace task for ref tests and gaslimit test fix * feat(blockdata): blockhash generation trace reintegration * feat(blockdata): rebase on 1695 branch * feat(blockdata): update constraints * feat(blockdata): remove trace java file * Enable conditional build This configures the build process to be conditional on a system-wide property called "blockchain". This property can be specified on the command-line with e.g. "-Dblockchain=Ethereum" to set the target chain to Ethereum. By default, the blockchain is assumed to be Linea. Therefore, its only when running the reference tests that this property needs to be set. Furthermore, if the reference tests are run without setting this property ... then an error is reported and the build fails. --------- Co-authored-by: DavePearce --- .github/workflows/gradle-ethereum-tests.yml | 10 +- .github/workflows/gradle-weekly-tests.yml | 2 +- .../workflows/reference-blockchain-tests.yml | 5 +- .../linea/zktracer/module/add/Trace.java | 481 -- .../linea/zktracer/module/bin/Trace.java | 1015 --- .../module/blake2fmodexpdata/Trace.java | 397 - .../module/blockdata/BlockdataOperation.java | 9 +- .../zktracer/module/blockdata/Trace.java | 819 -- .../zktracer/module/blockhash/Trace.java | 563 -- .../module/constants/GlobalConstants.java | 406 - .../linea/zktracer/module/ecdata/Trace.java | 1468 ---- .../linea/zktracer/module/euc/Trace.java | 390 - .../linea/zktracer/module/exp/Trace.java | 859 -- .../linea/zktracer/module/ext/Trace.java | 3195 ------- .../linea/zktracer/module/gas/Trace.java | 383 - .../linea/zktracer/module/hub/Trace.java | 7398 ----------------- .../linea/zktracer/module/logdata/Trace.java | 290 - .../linea/zktracer/module/loginfo/Trace.java | 802 -- .../linea/zktracer/module/mmio/Trace.java | 1952 ----- .../linea/zktracer/module/mmu/Trace.java | 2093 ----- .../linea/zktracer/module/mod/Trace.java | 1803 ---- .../linea/zktracer/module/mul/Trace.java | 1416 ---- .../linea/zktracer/module/mxp/Trace.java | 1524 ---- .../linea/zktracer/module/oob/Trace.java | 1244 --- .../linea/zktracer/module/rlpaddr/Trace.java | 789 -- .../linea/zktracer/module/rlptxn/Trace.java | 1592 ---- .../zktracer/module/rlptxrcpt/Trace.java | 1227 --- .../linea/zktracer/module/rom/Trace.java | 664 -- .../linea/zktracer/module/romlex/Trace.java | 372 - .../zktracer/module/shakiradata/Trace.java | 529 -- .../linea/zktracer/module/shf/Trace.java | 1341 --- .../linea/zktracer/module/stp/Trace.java | 837 -- .../zktracer/module/tables/bin/Trace.java | 167 - .../tables/instructionDecoder/Trace.java | 1122 --- .../zktracer/module/tables/shf/Trace.java | 213 - .../linea/zktracer/module/trm/Trace.java | 418 - .../linea/zktracer/module/txndata/Trace.java | 1712 ---- .../linea/zktracer/module/wcp/Trace.java | 1024 --- .../module/blockdata/GasLimitTest.java | 9 +- .../src/main/groovy/TraceFilesTask.groovy | 2 +- gradle/corset.gradle | 24 +- gradle/tests.gradle | 1 - gradle/trace-files.gradle | 37 +- linea-constraints | 2 +- plugins/build.gradle | 4 - reference-tests/build.gradle | 3 +- testing/build.gradle | 3 - 47 files changed, 67 insertions(+), 40549 deletions(-) delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/euc/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/exp/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/mmio/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/mmu/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/mxp/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/oob/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/romlex/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/bin/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/wcp/Trace.java diff --git a/.github/workflows/gradle-ethereum-tests.yml b/.github/workflows/gradle-ethereum-tests.yml index 29cb05dec..7465dbb0f 100644 --- a/.github/workflows/gradle-ethereum-tests.yml +++ b/.github/workflows/gradle-ethereum-tests.yml @@ -23,9 +23,6 @@ jobs: with: rust-corset: true - - name: Generate zkevm_for_reference_tests.bin - run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd .. - - name: Generate General State Reference Tests run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true env: @@ -33,7 +30,7 @@ jobs: CORSET_FLAGS: fields,expand,expand,expand - name: Run General State Reference Tests - run: ./gradlew referenceGeneralStateTests + run: ./gradlew -Dblockchain=Ethereum referenceGeneralStateTests env: REFERENCE_TESTS_PARALLELISM: 10 JAVA_OPTS: -Dorg.gradle.daemon=false @@ -71,9 +68,6 @@ jobs: with: go-corset: true - - name: Generate zkevm_for_reference_tests.bin - run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd .. - - name: Generate General State Reference Tests run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.caching=true env: @@ -81,7 +75,7 @@ jobs: CORSET_FLAGS: fields,expand,expand,expand - name: Run General State Reference Tests - run: GOMEMLIMIT=196GiB ./gradlew referenceGeneralStateTests + run: GOMEMLIMIT=64GiB ./gradlew -Dblockchain=Ethereum referenceGeneralStateTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable diff --git a/.github/workflows/gradle-weekly-tests.yml b/.github/workflows/gradle-weekly-tests.yml index 276f3d77b..da5927964 100644 --- a/.github/workflows/gradle-weekly-tests.yml +++ b/.github/workflows/gradle-weekly-tests.yml @@ -63,7 +63,7 @@ jobs: go-corset: true - name: Run Weekly tests - run: GOMEMLIMIT=196GiB ./gradlew weeklyTests + run: GOMEMLIMIT=96GiB ./gradlew weeklyTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 17cb567be..696272226 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -48,9 +48,6 @@ jobs: - name: Setup Go Corset uses: ./.github/actions/setup-go-corset - - name: Generate zkevm_for_reference_tests.bin - run: cd ./linea-constraints; make zkevm_for_reference_tests.bin -B; cd .. - - name: Generate block chain reference tests run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.caching=true env: @@ -72,7 +69,7 @@ jobs: run: mv ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests.json ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/failedBlockchainReferenceTests-input.json - name: Run reference blockchain tests - run: GOMEMLIMIT=32GiB ./gradlew referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter || 'BlockchainReferenceTest_*' }}" + run: GOMEMLIMIT=32GiB ./gradlew -Dblockchain=Ethereum referenceBlockchainTests -x spotlessCheck --tests "${{ inputs.test_filter || 'BlockchainReferenceTest_*' }}" timeout-minutes: 360 env: REFERENCE_TESTS_PARALLELISM: 2 diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java deleted file mode 100644 index a720fdd3e..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/add/Trace.java +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.add; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer inst; - private final MappedByteBuffer overflow; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer stamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("add.ACC_1", 16, length)); - headers.add(new ColumnHeader("add.ACC_2", 16, length)); - headers.add(new ColumnHeader("add.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("add.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("add.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("add.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("add.BYTE_1", 1, length)); - headers.add(new ColumnHeader("add.BYTE_2", 1, length)); - headers.add(new ColumnHeader("add.CT", 1, length)); - headers.add(new ColumnHeader("add.CT_MAX", 1, length)); - headers.add(new ColumnHeader("add.INST", 1, length)); - headers.add(new ColumnHeader("add.OVERFLOW", 1, length)); - headers.add(new ColumnHeader("add.RES_HI", 16, length)); - headers.add(new ColumnHeader("add.RES_LO", 16, length)); - headers.add(new ColumnHeader("add.STAMP", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.arg1Hi = buffers.get(2); - this.arg1Lo = buffers.get(3); - this.arg2Hi = buffers.get(4); - this.arg2Lo = buffers.get(5); - this.byte1 = buffers.get(6); - this.byte2 = buffers.get(7); - this.ct = buffers.get(8); - this.ctMax = buffers.get(9); - this.inst = buffers.get(10); - this.overflow = buffers.get(11); - this.resHi = buffers.get(12); - this.resLo = buffers.get(13); - this.stamp = buffers.get(14); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("add.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("add.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("add.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("add.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("add.ACC_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("add.ACC_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("add.ARG_1_HI has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("add.ARG_1_LO has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("add.ARG_2_HI has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("add.ARG_2_LO has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("add.BYTE_1 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("add.BYTE_2 has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("add.CT has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("add.CT_MAX has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("add.INST has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("add.OVERFLOW has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("add.RES_HI has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("add.RES_LO has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("add.STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(1)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(2)) { - arg1Hi.position(arg1Hi.position() + 16); - } - - if (!filled.get(3)) { - arg1Lo.position(arg1Lo.position() + 16); - } - - if (!filled.get(4)) { - arg2Hi.position(arg2Hi.position() + 16); - } - - if (!filled.get(5)) { - arg2Lo.position(arg2Lo.position() + 16); - } - - if (!filled.get(6)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(7)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(8)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(9)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(10)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(11)) { - overflow.position(overflow.position() + 1); - } - - if (!filled.get(12)) { - resHi.position(resHi.position() + 16); - } - - if (!filled.get(13)) { - resLo.position(resLo.position() + 16); - } - - if (!filled.get(14)) { - stamp.position(stamp.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java deleted file mode 100644 index a5ad49fd7..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/bin/Trace.java +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.bin; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer acc5; - private final MappedByteBuffer acc6; - private final MappedByteBuffer argument1Hi; - private final MappedByteBuffer argument1Lo; - private final MappedByteBuffer argument2Hi; - private final MappedByteBuffer argument2Lo; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bitB4; - private final MappedByteBuffer bits; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer byte3; - private final MappedByteBuffer byte4; - private final MappedByteBuffer byte5; - private final MappedByteBuffer byte6; - private final MappedByteBuffer counter; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer inst; - private final MappedByteBuffer isAnd; - private final MappedByteBuffer isByte; - private final MappedByteBuffer isNot; - private final MappedByteBuffer isOr; - private final MappedByteBuffer isSignextend; - private final MappedByteBuffer isXor; - private final MappedByteBuffer low4; - private final MappedByteBuffer neg; - private final MappedByteBuffer pivot; - private final MappedByteBuffer resultHi; - private final MappedByteBuffer resultLo; - private final MappedByteBuffer small; - private final MappedByteBuffer stamp; - private final MappedByteBuffer xxxByteHi; - private final MappedByteBuffer xxxByteLo; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("bin.ACC_1", 16, length)); - headers.add(new ColumnHeader("bin.ACC_2", 16, length)); - headers.add(new ColumnHeader("bin.ACC_3", 16, length)); - headers.add(new ColumnHeader("bin.ACC_4", 16, length)); - headers.add(new ColumnHeader("bin.ACC_5", 16, length)); - headers.add(new ColumnHeader("bin.ACC_6", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_1_HI", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_1_LO", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_2_HI", 16, length)); - headers.add(new ColumnHeader("bin.ARGUMENT_2_LO", 16, length)); - headers.add(new ColumnHeader("bin.BIT_1", 1, length)); - headers.add(new ColumnHeader("bin.BIT_B_4", 1, length)); - headers.add(new ColumnHeader("bin.BITS", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_1", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_2", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_3", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_4", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_5", 1, length)); - headers.add(new ColumnHeader("bin.BYTE_6", 1, length)); - headers.add(new ColumnHeader("bin.COUNTER", 1, length)); - headers.add(new ColumnHeader("bin.CT_MAX", 1, length)); - headers.add(new ColumnHeader("bin.INST", 1, length)); - headers.add(new ColumnHeader("bin.IS_AND", 1, length)); - headers.add(new ColumnHeader("bin.IS_BYTE", 1, length)); - headers.add(new ColumnHeader("bin.IS_NOT", 1, length)); - headers.add(new ColumnHeader("bin.IS_OR", 1, length)); - headers.add(new ColumnHeader("bin.IS_SIGNEXTEND", 1, length)); - headers.add(new ColumnHeader("bin.IS_XOR", 1, length)); - headers.add(new ColumnHeader("bin.LOW_4", 1, length)); - headers.add(new ColumnHeader("bin.NEG", 1, length)); - headers.add(new ColumnHeader("bin.PIVOT", 1, length)); - headers.add(new ColumnHeader("bin.RESULT_HI", 16, length)); - headers.add(new ColumnHeader("bin.RESULT_LO", 16, length)); - headers.add(new ColumnHeader("bin.SMALL", 1, length)); - headers.add(new ColumnHeader("bin.STAMP", 4, length)); - headers.add(new ColumnHeader("bin.XXX_BYTE_HI", 1, length)); - headers.add(new ColumnHeader("bin.XXX_BYTE_LO", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.acc3 = buffers.get(2); - this.acc4 = buffers.get(3); - this.acc5 = buffers.get(4); - this.acc6 = buffers.get(5); - this.argument1Hi = buffers.get(6); - this.argument1Lo = buffers.get(7); - this.argument2Hi = buffers.get(8); - this.argument2Lo = buffers.get(9); - this.bit1 = buffers.get(10); - this.bitB4 = buffers.get(11); - this.bits = buffers.get(12); - this.byte1 = buffers.get(13); - this.byte2 = buffers.get(14); - this.byte3 = buffers.get(15); - this.byte4 = buffers.get(16); - this.byte5 = buffers.get(17); - this.byte6 = buffers.get(18); - this.counter = buffers.get(19); - this.ctMax = buffers.get(20); - this.inst = buffers.get(21); - this.isAnd = buffers.get(22); - this.isByte = buffers.get(23); - this.isNot = buffers.get(24); - this.isOr = buffers.get(25); - this.isSignextend = buffers.get(26); - this.isXor = buffers.get(27); - this.low4 = buffers.get(28); - this.neg = buffers.get(29); - this.pivot = buffers.get(30); - this.resultHi = buffers.get(31); - this.resultLo = buffers.get(32); - this.small = buffers.get(33); - this.stamp = buffers.get(34); - this.xxxByteHi = buffers.get(35); - this.xxxByteLo = buffers.get(36); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("bin.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("bin.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc6.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.RESULT_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resultHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("bin.RESULT_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resultLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("bin.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace xxxByteHi(final UnsignedByte b) { - if (filled.get(35)) { - throw new IllegalStateException("bin.XXX_BYTE_HI already set"); - } else { - filled.set(35); - } - - xxxByteHi.put(b.toByte()); - - return this; - } - - public Trace xxxByteLo(final UnsignedByte b) { - if (filled.get(36)) { - throw new IllegalStateException("bin.XXX_BYTE_LO already set"); - } else { - filled.set(36); - } - - xxxByteLo.put(b.toByte()); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("bin.ACC_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("bin.ACC_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("bin.ACC_3 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("bin.ACC_4 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("bin.ACC_5 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("bin.ACC_6 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("bin.ARGUMENT_1_HI has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("bin.ARGUMENT_1_LO has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("bin.ARGUMENT_2_HI has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("bin.ARGUMENT_2_LO has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("bin.BIT_1 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("bin.BIT_B_4 has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("bin.BITS has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("bin.BYTE_1 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("bin.BYTE_2 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("bin.BYTE_3 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("bin.BYTE_4 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("bin.BYTE_5 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("bin.BYTE_6 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("bin.COUNTER has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("bin.CT_MAX has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("bin.INST has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("bin.IS_AND has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("bin.IS_BYTE has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("bin.IS_NOT has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("bin.IS_OR has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("bin.IS_SIGNEXTEND has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("bin.IS_XOR has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("bin.LOW_4 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("bin.NEG has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("bin.PIVOT has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("bin.RESULT_HI has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("bin.RESULT_LO has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("bin.SMALL has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("bin.STAMP has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("bin.XXX_BYTE_HI has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("bin.XXX_BYTE_LO has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(1)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(2)) { - acc3.position(acc3.position() + 16); - } - - if (!filled.get(3)) { - acc4.position(acc4.position() + 16); - } - - if (!filled.get(4)) { - acc5.position(acc5.position() + 16); - } - - if (!filled.get(5)) { - acc6.position(acc6.position() + 16); - } - - if (!filled.get(6)) { - argument1Hi.position(argument1Hi.position() + 16); - } - - if (!filled.get(7)) { - argument1Lo.position(argument1Lo.position() + 16); - } - - if (!filled.get(8)) { - argument2Hi.position(argument2Hi.position() + 16); - } - - if (!filled.get(9)) { - argument2Lo.position(argument2Lo.position() + 16); - } - - if (!filled.get(11)) { - bit1.position(bit1.position() + 1); - } - - if (!filled.get(12)) { - bitB4.position(bitB4.position() + 1); - } - - if (!filled.get(10)) { - bits.position(bits.position() + 1); - } - - if (!filled.get(13)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(14)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(15)) { - byte3.position(byte3.position() + 1); - } - - if (!filled.get(16)) { - byte4.position(byte4.position() + 1); - } - - if (!filled.get(17)) { - byte5.position(byte5.position() + 1); - } - - if (!filled.get(18)) { - byte6.position(byte6.position() + 1); - } - - if (!filled.get(19)) { - counter.position(counter.position() + 1); - } - - if (!filled.get(20)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(21)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(22)) { - isAnd.position(isAnd.position() + 1); - } - - if (!filled.get(23)) { - isByte.position(isByte.position() + 1); - } - - if (!filled.get(24)) { - isNot.position(isNot.position() + 1); - } - - if (!filled.get(25)) { - isOr.position(isOr.position() + 1); - } - - if (!filled.get(26)) { - isSignextend.position(isSignextend.position() + 1); - } - - if (!filled.get(27)) { - isXor.position(isXor.position() + 1); - } - - if (!filled.get(28)) { - low4.position(low4.position() + 1); - } - - if (!filled.get(29)) { - neg.position(neg.position() + 1); - } - - if (!filled.get(30)) { - pivot.position(pivot.position() + 1); - } - - if (!filled.get(31)) { - resultHi.position(resultHi.position() + 16); - } - - if (!filled.get(32)) { - resultLo.position(resultLo.position() + 16); - } - - if (!filled.get(33)) { - small.position(small.position() + 1); - } - - if (!filled.get(34)) { - stamp.position(stamp.position() + 4); - } - - if (!filled.get(35)) { - xxxByteHi.position(xxxByteHi.position() + 1); - } - - if (!filled.get(36)) { - xxxByteLo.position(xxxByteLo.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java deleted file mode 100644 index 120e48663..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/Trace.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.blake2fmodexpdata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int INDEX_MAX_BLAKE_DATA = 0xc; - public static final int INDEX_MAX_BLAKE_PARAMS = 0x1; - public static final int INDEX_MAX_BLAKE_RESULT = 0x3; - public static final int INDEX_MAX_MODEXP = 0x1f; - public static final int INDEX_MAX_MODEXP_BASE = 0x1f; - public static final int INDEX_MAX_MODEXP_EXPONENT = 0x1f; - public static final int INDEX_MAX_MODEXP_MODULUS = 0x1f; - public static final int INDEX_MAX_MODEXP_RESULT = 0x1f; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer id; - private final MappedByteBuffer index; - private final MappedByteBuffer indexMax; - private final MappedByteBuffer isBlakeData; - private final MappedByteBuffer isBlakeParams; - private final MappedByteBuffer isBlakeResult; - private final MappedByteBuffer isModexpBase; - private final MappedByteBuffer isModexpExponent; - private final MappedByteBuffer isModexpModulus; - private final MappedByteBuffer isModexpResult; - private final MappedByteBuffer limb; - private final MappedByteBuffer phase; - private final MappedByteBuffer stamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blake2fmodexpdata.ID", 4, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.INDEX", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.INDEX_MAX", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_DATA", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_PARAMS", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_BLAKE_RESULT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_BASE", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_EXPONENT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_MODULUS", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.IS_MODEXP_RESULT", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.LIMB", 16, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.PHASE", 1, length)); - headers.add(new ColumnHeader("blake2fmodexpdata.STAMP", 2, length)); - return headers; - } - - public Trace (List buffers) { - this.id = buffers.get(0); - this.index = buffers.get(1); - this.indexMax = buffers.get(2); - this.isBlakeData = buffers.get(3); - this.isBlakeParams = buffers.get(4); - this.isBlakeResult = buffers.get(5); - this.isModexpBase = buffers.get(6); - this.isModexpExponent = buffers.get(7); - this.isModexpModulus = buffers.get(8); - this.isModexpResult = buffers.get(9); - this.limb = buffers.get(10); - this.phase = buffers.get(11); - this.stamp = buffers.get(12); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace id(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("blake2fmodexpdata.ID already set"); - } else { - filled.set(0); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("blake2fmodexpdata.ID has invalid value (" + b + ")"); } - id.put((byte) (b >> 24)); - id.put((byte) (b >> 16)); - id.put((byte) (b >> 8)); - id.put((byte) b); - - - return this; - } - - public Trace index(final UnsignedByte b) { - if (filled.get(1)) { - throw new IllegalStateException("blake2fmodexpdata.INDEX already set"); - } else { - filled.set(1); - } - - index.put(b.toByte()); - - return this; - } - - public Trace indexMax(final UnsignedByte b) { - if (filled.get(2)) { - throw new IllegalStateException("blake2fmodexpdata.INDEX_MAX already set"); - } else { - filled.set(2); - } - - indexMax.put(b.toByte()); - - return this; - } - - public Trace isBlakeData(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_DATA already set"); - } else { - filled.set(3); - } - - isBlakeData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isBlakeParams(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_PARAMS already set"); - } else { - filled.set(4); - } - - isBlakeParams.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isBlakeResult(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_RESULT already set"); - } else { - filled.set(5); - } - - isBlakeResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpBase(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_BASE already set"); - } else { - filled.set(6); - } - - isModexpBase.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpExponent(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_EXPONENT already set"); - } else { - filled.set(7); - } - - isModexpExponent.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpModulus(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_MODULUS already set"); - } else { - filled.set(8); - } - - isModexpModulus.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpResult(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_RESULT already set"); - } else { - filled.set(9); - } - - isModexpResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(10)) { - throw new IllegalStateException("blake2fmodexpdata.LIMB already set"); - } else { - filled.set(10); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blake2fmodexpdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 1024L) { throw new IllegalArgumentException("blake2fmodexpdata.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("blake2fmodexpdata.ID has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("blake2fmodexpdata.INDEX has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("blake2fmodexpdata.INDEX_MAX has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_DATA has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_PARAMS has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("blake2fmodexpdata.IS_BLAKE_RESULT has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_BASE has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_EXPONENT has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_MODULUS has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("blake2fmodexpdata.IS_MODEXP_RESULT has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("blake2fmodexpdata.LIMB has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("blake2fmodexpdata.PHASE has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("blake2fmodexpdata.STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - id.position(id.position() + 4); - } - - if (!filled.get(1)) { - index.position(index.position() + 1); - } - - if (!filled.get(2)) { - indexMax.position(indexMax.position() + 1); - } - - if (!filled.get(3)) { - isBlakeData.position(isBlakeData.position() + 1); - } - - if (!filled.get(4)) { - isBlakeParams.position(isBlakeParams.position() + 1); - } - - if (!filled.get(5)) { - isBlakeResult.position(isBlakeResult.position() + 1); - } - - if (!filled.get(6)) { - isModexpBase.position(isModexpBase.position() + 1); - } - - if (!filled.get(7)) { - isModexpExponent.position(isModexpExponent.position() + 1); - } - - if (!filled.get(8)) { - isModexpModulus.position(isModexpModulus.position() + 1); - } - - if (!filled.get(9)) { - isModexpResult.position(isModexpResult.position() + 1); - } - - if (!filled.get(10)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(11)) { - phase.position(phase.position() + 1); - } - - if (!filled.get(12)) { - stamp.position(stamp.position() + 2); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index 7cd0526ff..650614a19 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -21,8 +21,6 @@ import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_ISZERO; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_LT; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_LIMIT_ADJUSTMENT_FACTOR; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_GAS_LIMIT_MAXIMUM; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LINEA_GAS_LIMIT_MINIMUM; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_GEQ; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; @@ -31,7 +29,6 @@ import java.math.BigInteger; import java.util.Arrays; -import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.experimental.Accessors; import net.consensys.linea.zktracer.container.ModuleOperation; @@ -60,7 +57,7 @@ public class BlockdataOperation extends ModuleOperation { private final boolean firstBlockInConflation; private final int ctMax; - @EqualsAndHashCode.Include @Getter private final OpCode opCode; + private final OpCode opCode; private final long firstBlockNumber; private final int relTxMax; private final long relBlock; @@ -178,11 +175,11 @@ private void handleGasLimit() { // row i // comparison to minimum - wcpCallToGEQ(0, data, EWord.of(LINEA_GAS_LIMIT_MINIMUM)); + wcpCallToGEQ(0, data, EWord.of(GAS_LIMIT_MINIMUM)); // row i + 1 // comparison to maximum - wcpCallToLEQ(1, data, EWord.of(Bytes.ofUnsignedLong(LINEA_GAS_LIMIT_MAXIMUM))); + wcpCallToLEQ(1, data, EWord.of(Bytes.ofUnsignedLong(GAS_LIMIT_MAXIMUM))); if (!firstBlockInConflation) { EWord prevGasLimit = EWord.of(prevBlockHeader.getGasLimit()); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java deleted file mode 100644 index 92ea77303..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Trace.java +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.blockdata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int nROWS_BF = 0x1; - public static final int nROWS_CB = 0x1; - public static final int nROWS_DEPTH = 0xd; - public static final int nROWS_DF = 0x1; - public static final int nROWS_GL = 0x5; - public static final int nROWS_ID = 0x1; - public static final int nROWS_NB = 0x2; - public static final int nROWS_TS = 0x2; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer basefee; - private final MappedByteBuffer blockGasLimit; - private final MappedByteBuffer coinbaseHi; - private final MappedByteBuffer coinbaseLo; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer dataHi; - private final MappedByteBuffer dataLo; - private final MappedByteBuffer eucFlag; - private final MappedByteBuffer exoInst; - private final MappedByteBuffer firstBlockNumber; - private final MappedByteBuffer inst; - private final MappedByteBuffer iomf; - private final MappedByteBuffer isBasefee; - private final MappedByteBuffer isChainid; - private final MappedByteBuffer isCoinbase; - private final MappedByteBuffer isDifficulty; - private final MappedByteBuffer isGaslimit; - private final MappedByteBuffer isNumber; - private final MappedByteBuffer isTimestamp; - private final MappedByteBuffer relBlock; - private final MappedByteBuffer relTxNumMax; - private final MappedByteBuffer res; - private final MappedByteBuffer wcpFlag; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blockdata.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.BASEFEE", 8, length)); - headers.add(new ColumnHeader("blockdata.BLOCK_GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("blockdata.COINBASE_HI", 4, length)); - headers.add(new ColumnHeader("blockdata.COINBASE_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.CT", 1, length)); - headers.add(new ColumnHeader("blockdata.CT_MAX", 1, length)); - headers.add(new ColumnHeader("blockdata.DATA_HI", 16, length)); - headers.add(new ColumnHeader("blockdata.DATA_LO", 16, length)); - headers.add(new ColumnHeader("blockdata.EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("blockdata.EXO_INST", 1, length)); - headers.add(new ColumnHeader("blockdata.FIRST_BLOCK_NUMBER", 6, length)); - headers.add(new ColumnHeader("blockdata.INST", 1, length)); - headers.add(new ColumnHeader("blockdata.IOMF", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_BASEFEE", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_CHAINID", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_COINBASE", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_DIFFICULTY", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_GASLIMIT", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_NUMBER", 1, length)); - headers.add(new ColumnHeader("blockdata.IS_TIMESTAMP", 1, length)); - headers.add(new ColumnHeader("blockdata.REL_BLOCK", 2, length)); - headers.add(new ColumnHeader("blockdata.REL_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("blockdata.RES", 16, length)); - headers.add(new ColumnHeader("blockdata.WCP_FLAG", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.arg1Hi = buffers.get(0); - this.arg1Lo = buffers.get(1); - this.arg2Hi = buffers.get(2); - this.arg2Lo = buffers.get(3); - this.basefee = buffers.get(4); - this.blockGasLimit = buffers.get(5); - this.coinbaseHi = buffers.get(6); - this.coinbaseLo = buffers.get(7); - this.ct = buffers.get(8); - this.ctMax = buffers.get(9); - this.dataHi = buffers.get(10); - this.dataLo = buffers.get(11); - this.eucFlag = buffers.get(12); - this.exoInst = buffers.get(13); - this.firstBlockNumber = buffers.get(14); - this.inst = buffers.get(15); - this.iomf = buffers.get(16); - this.isBasefee = buffers.get(17); - this.isChainid = buffers.get(18); - this.isCoinbase = buffers.get(19); - this.isDifficulty = buffers.get(20); - this.isGaslimit = buffers.get(21); - this.isNumber = buffers.get(22); - this.isTimestamp = buffers.get(23); - this.relBlock = buffers.get(24); - this.relTxNumMax = buffers.get(25); - this.res = buffers.get(26); - this.wcpFlag = buffers.get(27); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace arg1Hi(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("blockdata.ARG_1_HI already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockdata.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockdata.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockdata.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("blockdata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { basefee.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("blockdata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { blockGasLimit.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("blockdata.COINBASE_HI has invalid value (" + b + ")"); } - coinbaseHi.put((byte) (b >> 24)); - coinbaseHi.put((byte) (b >> 16)); - coinbaseHi.put((byte) (b >> 8)); - coinbaseHi.put((byte) b); - - - return this; - } - - public Trace coinbaseLo(final Bytes b) { - if (filled.get(7)) { - throw new IllegalStateException("blockdata.COINBASE_LO already set"); - } else { - filled.set(7); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { coinbaseLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 8L) { throw new IllegalArgumentException("blockdata.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(9)) { - throw new IllegalStateException("blockdata.CT_MAX already set"); - } else { - filled.set(9); - } - - if(b >= 8L) { throw new IllegalArgumentException("blockdata.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace dataHi(final Bytes b) { - if (filled.get(10)) { - throw new IllegalStateException("blockdata.DATA_HI already set"); - } else { - filled.set(10); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockdata.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 281474976710656L) { throw new IllegalArgumentException("blockdata.FIRST_BLOCK_NUMBER has invalid value (" + b + ")"); } - firstBlockNumber.put((byte) (b >> 40)); - firstBlockNumber.put((byte) (b >> 32)); - firstBlockNumber.put((byte) (b >> 24)); - firstBlockNumber.put((byte) (b >> 16)); - firstBlockNumber.put((byte) (b >> 8)); - firstBlockNumber.put((byte) b); - - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(15)) { - throw new IllegalStateException("blockdata.INST already set"); - } else { - filled.set(15); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace iomf(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("blockdata.IOMF already set"); - } else { - filled.set(16); - } - - iomf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isBasefee(final Boolean b) { - if (filled.get(17)) { - throw new IllegalStateException("blockdata.IS_BASEFEE already set"); - } else { - filled.set(17); - } - - isBasefee.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isChainid(final Boolean b) { - if (filled.get(18)) { - throw new IllegalStateException("blockdata.IS_CHAINID already set"); - } else { - filled.set(18); - } - - isChainid.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isCoinbase(final Boolean b) { - if (filled.get(19)) { - throw new IllegalStateException("blockdata.IS_COINBASE already set"); - } else { - filled.set(19); - } - - isCoinbase.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isDifficulty(final Boolean b) { - if (filled.get(20)) { - throw new IllegalStateException("blockdata.IS_DIFFICULTY already set"); - } else { - filled.set(20); - } - - isDifficulty.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isGaslimit(final Boolean b) { - if (filled.get(21)) { - throw new IllegalStateException("blockdata.IS_GASLIMIT already set"); - } else { - filled.set(21); - } - - isGaslimit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isNumber(final Boolean b) { - if (filled.get(22)) { - throw new IllegalStateException("blockdata.IS_NUMBER already set"); - } else { - filled.set(22); - } - - isNumber.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isTimestamp(final Boolean b) { - if (filled.get(23)) { - throw new IllegalStateException("blockdata.IS_TIMESTAMP already set"); - } else { - filled.set(23); - } - - isTimestamp.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace relBlock(final long b) { - if (filled.get(24)) { - throw new IllegalStateException("blockdata.REL_BLOCK already set"); - } else { - filled.set(24); - } - - if(b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_BLOCK has invalid value (" + b + ")"); } - relBlock.put((byte) (b >> 8)); - relBlock.put((byte) b); - - - return this; - } - - public Trace relTxNumMax(final long b) { - if (filled.get(25)) { - throw new IllegalStateException("blockdata.REL_TX_NUM_MAX already set"); - } else { - filled.set(25); - } - - if(b >= 65536L) { throw new IllegalArgumentException("blockdata.REL_TX_NUM_MAX has invalid value (" + b + ")"); } - relTxNumMax.put((byte) (b >> 8)); - relTxNumMax.put((byte) b); - - - return this; - } - - public Trace res(final Bytes b) { - if (filled.get(26)) { - throw new IllegalStateException("blockdata.RES already set"); - } else { - filled.set(26); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockdata.RES has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { res.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int BLOCKHASH_DEPTH = 0x6; - public static final int NEGATIVE_OF_BLOCKHASH_DEPTH = -0x6; - public static final int ROFF___ABS___comparison_to_256 = 0x3; - public static final int ROFF___BLOCKHASH_arguments___equality_test = 0x2; - public static final int ROFF___BLOCKHASH_arguments___monotony = 0x1; - public static final int ROFF___curr_BLOCKHASH_argument___comparison_to_max = 0x4; - public static final int ROFF___curr_BLOCKHASH_argument___comparison_to_min = 0x5; - public static final int nROWS_MACRO = 0x1; - public static final int nROWS_PRPRC = 0x5; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absBlock; - private final MappedByteBuffer blockhashArgHiXorExoArg1Hi; - private final MappedByteBuffer blockhashArgLoXorExoArg1Lo; - private final MappedByteBuffer blockhashResHiXorExoArg2Hi; - private final MappedByteBuffer blockhashResLoXorExoArg2Lo; - private final MappedByteBuffer blockhashValHi; - private final MappedByteBuffer blockhashValLo; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer exoInst; - private final MappedByteBuffer exoRes; - private final MappedByteBuffer iomf; - private final MappedByteBuffer macro; - private final MappedByteBuffer prprc; - private final MappedByteBuffer relBlock; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("blockhash.ABS_BLOCK", 6, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_HI", 16, length)); - headers.add(new ColumnHeader("blockhash.BLOCKHASH_VAL_LO", 16, length)); - headers.add(new ColumnHeader("blockhash.CT", 1, length)); - headers.add(new ColumnHeader("blockhash.CT_MAX", 1, length)); - headers.add(new ColumnHeader("blockhash.EXO_INST", 1, length)); - headers.add(new ColumnHeader("blockhash.EXO_RES", 1, length)); - headers.add(new ColumnHeader("blockhash.IOMF", 1, length)); - headers.add(new ColumnHeader("blockhash.MACRO", 1, length)); - headers.add(new ColumnHeader("blockhash.PRPRC", 1, length)); - headers.add(new ColumnHeader("blockhash.REL_BLOCK", 2, length)); - return headers; - } - - public Trace (List buffers) { - this.absBlock = buffers.get(0); - this.blockhashArgHiXorExoArg1Hi = buffers.get(1); - this.blockhashArgLoXorExoArg1Lo = buffers.get(2); - this.blockhashResHiXorExoArg2Hi = buffers.get(3); - this.blockhashResLoXorExoArg2Lo = buffers.get(4); - this.blockhashValHi = buffers.get(5); - this.blockhashValLo = buffers.get(6); - this.ct = buffers.get(7); - this.ctMax = buffers.get(8); - this.exoInst = buffers.get(9); - this.exoRes = buffers.get(10); - this.iomf = buffers.get(11); - this.macro = buffers.get(12); - this.prprc = buffers.get(13); - this.relBlock = buffers.get(14); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace ct(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("blockhash.CT already set"); - } else { - filled.set(0); - } - - if(b >= 256L) { throw new IllegalArgumentException("blockhash.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("blockhash.CT_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 256L) { throw new IllegalArgumentException("blockhash.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace iomf(final Boolean b) { - if (filled.get(2)) { - throw new IllegalStateException("blockhash.IOMF already set"); - } else { - filled.set(2); - } - - iomf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace macro(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("blockhash.MACRO already set"); - } else { - filled.set(3); - } - - macro.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMacroAbsBlock(final long b) { - if (filled.get(8)) { - throw new IllegalStateException("blockhash.macro/ABS_BLOCK already set"); - } else { - filled.set(8); - } - - if(b >= 281474976710656L) { throw new IllegalArgumentException("blockhash.macro/ABS_BLOCK has invalid value (" + b + ")"); } - absBlock.put((byte) (b >> 40)); - absBlock.put((byte) (b >> 32)); - absBlock.put((byte) (b >> 24)); - absBlock.put((byte) (b >> 16)); - absBlock.put((byte) (b >> 8)); - absBlock.put((byte) b); - - - return this; - } - - public Trace pMacroBlockhashArgHi(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("blockhash.macro/BLOCKHASH_ARG_HI already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_ARG_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashArgHiXorExoArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_ARG_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashArgLoXorExoArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashResHiXorExoArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashResLoXorExoArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_VAL_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashValHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.macro/BLOCKHASH_VAL_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashValLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("blockhash.macro/REL_BLOCK has invalid value (" + b + ")"); } - relBlock.put((byte) (b >> 8)); - relBlock.put((byte) b); - - - return this; - } - - public Trace pPreprocessingExoArg1Hi(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("blockhash.preprocessing/EXO_ARG_1_HI already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashArgHiXorExoArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashArgLoXorExoArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashResHiXorExoArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { blockhashResLoXorExoArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("blockhash.preprocessing/EXO_INST has invalid value (" + b + ")"); } - exoInst.put((byte) b); - - - return this; - } - - public Trace pPreprocessingExoRes(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("blockhash.preprocessing/EXO_RES already set"); - } else { - filled.set(5); - } - - exoRes.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace prprc(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("blockhash.PRPRC already set"); - } else { - filled.set(4); - } - - prprc.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(8)) { - throw new IllegalStateException("blockhash.ABS_BLOCK has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("blockhash.BLOCKHASH_ARG_HI_xor_EXO_ARG_1_HI has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("blockhash.BLOCKHASH_ARG_LO_xor_EXO_ARG_1_LO has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("blockhash.BLOCKHASH_RES_HI_xor_EXO_ARG_2_HI has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("blockhash.BLOCKHASH_RES_LO_xor_EXO_ARG_2_LO has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("blockhash.BLOCKHASH_VAL_HI has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("blockhash.BLOCKHASH_VAL_LO has not been filled"); - } - - if (!filled.get(0)) { - throw new IllegalStateException("blockhash.CT has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("blockhash.CT_MAX has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("blockhash.EXO_INST has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("blockhash.EXO_RES has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("blockhash.IOMF has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("blockhash.MACRO has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("blockhash.PRPRC has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("blockhash.REL_BLOCK has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(8)) { - absBlock.position(absBlock.position() + 6); - } - - if (!filled.get(9)) { - blockhashArgHiXorExoArg1Hi.position(blockhashArgHiXorExoArg1Hi.position() + 16); - } - - if (!filled.get(10)) { - blockhashArgLoXorExoArg1Lo.position(blockhashArgLoXorExoArg1Lo.position() + 16); - } - - if (!filled.get(11)) { - blockhashResHiXorExoArg2Hi.position(blockhashResHiXorExoArg2Hi.position() + 16); - } - - if (!filled.get(12)) { - blockhashResLoXorExoArg2Lo.position(blockhashResLoXorExoArg2Lo.position() + 16); - } - - if (!filled.get(13)) { - blockhashValHi.position(blockhashValHi.position() + 16); - } - - if (!filled.get(14)) { - blockhashValLo.position(blockhashValLo.position() + 16); - } - - if (!filled.get(0)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(1)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(6)) { - exoInst.position(exoInst.position() + 1); - } - - if (!filled.get(5)) { - exoRes.position(exoRes.position() + 1); - } - - if (!filled.get(2)) { - iomf.position(iomf.position() + 1); - } - - if (!filled.get(3)) { - macro.position(macro.position() + 1); - } - - if (!filled.get(4)) { - prprc.position(prprc.position() + 1); - } - - if (!filled.get(7)) { - relBlock.position(relBlock.position() + 2); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java deleted file mode 100644 index 7971e3797..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/constants/GlobalConstants.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.constants; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class GlobalConstants { - public static final int BLOCKHASH_MAX_HISTORY = 0x100; - public static final int CREATE2_SHIFT = 0xff; - public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; - public static final int EIP_3541_MARKER = 0xef; - public static final BigInteger EMPTY_KECCAK_HI = new BigInteger("262949717399590921288928019264691438528"); - public static final BigInteger EMPTY_KECCAK_LO = new BigInteger("304396909071904405792975023732328604784"); - public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; - public static final BigInteger EMPTY_RIPEMD_LO = new BigInteger("263072838190121256777638892741499129137"); - public static final BigInteger EMPTY_SHA2_HI = new BigInteger("302652579918965577886386472538583578916"); - public static final BigInteger EMPTY_SHA2_LO = new BigInteger("52744687940778649747319168982913824853"); - public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; - public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; - public static final int EVM_INST_ADD = 0x1; - public static final int EVM_INST_ADDMOD = 0x8; - public static final int EVM_INST_ADDRESS = 0x30; - public static final int EVM_INST_AND = 0x16; - public static final int EVM_INST_BALANCE = 0x31; - public static final int EVM_INST_BASEFEE = 0x48; - public static final int EVM_INST_BLOCKHASH = 0x40; - public static final int EVM_INST_BYTE = 0x1a; - public static final int EVM_INST_CALL = 0xf1; - public static final int EVM_INST_CALLCODE = 0xf2; - public static final int EVM_INST_CALLDATACOPY = 0x37; - public static final int EVM_INST_CALLDATALOAD = 0x35; - public static final int EVM_INST_CALLDATASIZE = 0x36; - public static final int EVM_INST_CALLER = 0x33; - public static final int EVM_INST_CALLVALUE = 0x34; - public static final int EVM_INST_CHAINID = 0x46; - public static final int EVM_INST_CODECOPY = 0x39; - public static final int EVM_INST_CODESIZE = 0x38; - public static final int EVM_INST_COINBASE = 0x41; - public static final int EVM_INST_CREATE = 0xf0; - public static final int EVM_INST_CREATE2 = 0xf5; - public static final int EVM_INST_DELEGATECALL = 0xf4; - public static final int EVM_INST_DIFFICULTY = 0x44; - public static final int EVM_INST_DIV = 0x4; - public static final int EVM_INST_DUP1 = 0x80; - public static final int EVM_INST_DUP10 = 0x89; - public static final int EVM_INST_DUP11 = 0x8a; - public static final int EVM_INST_DUP12 = 0x8b; - public static final int EVM_INST_DUP13 = 0x8c; - public static final int EVM_INST_DUP14 = 0x8d; - public static final int EVM_INST_DUP15 = 0x8e; - public static final int EVM_INST_DUP16 = 0x8f; - public static final int EVM_INST_DUP2 = 0x81; - public static final int EVM_INST_DUP3 = 0x82; - public static final int EVM_INST_DUP4 = 0x83; - public static final int EVM_INST_DUP5 = 0x84; - public static final int EVM_INST_DUP6 = 0x85; - public static final int EVM_INST_DUP7 = 0x86; - public static final int EVM_INST_DUP8 = 0x87; - public static final int EVM_INST_DUP9 = 0x88; - public static final int EVM_INST_EQ = 0x14; - public static final int EVM_INST_EXP = 0xa; - public static final int EVM_INST_EXTCODECOPY = 0x3c; - public static final int EVM_INST_EXTCODEHASH = 0x3f; - public static final int EVM_INST_EXTCODESIZE = 0x3b; - public static final int EVM_INST_GAS = 0x5a; - public static final int EVM_INST_GASLIMIT = 0x45; - public static final int EVM_INST_GASPRICE = 0x3a; - public static final int EVM_INST_GT = 0x11; - public static final int EVM_INST_INVALID = 0xfe; - public static final int EVM_INST_ISZERO = 0x15; - public static final int EVM_INST_JUMP = 0x56; - public static final int EVM_INST_JUMPDEST = 0x5b; - public static final int EVM_INST_JUMPI = 0x57; - public static final int EVM_INST_LOG0 = 0xa0; - public static final int EVM_INST_LOG1 = 0xa1; - public static final int EVM_INST_LOG2 = 0xa2; - public static final int EVM_INST_LOG3 = 0xa3; - public static final int EVM_INST_LOG4 = 0xa4; - public static final int EVM_INST_LT = 0x10; - public static final int EVM_INST_MLOAD = 0x51; - public static final int EVM_INST_MOD = 0x6; - public static final int EVM_INST_MSIZE = 0x59; - public static final int EVM_INST_MSTORE = 0x52; - public static final int EVM_INST_MSTORE8 = 0x53; - public static final int EVM_INST_MUL = 0x2; - public static final int EVM_INST_MULMOD = 0x9; - public static final int EVM_INST_NOT = 0x19; - public static final int EVM_INST_NUMBER = 0x43; - public static final int EVM_INST_OR = 0x17; - public static final int EVM_INST_ORIGIN = 0x32; - public static final int EVM_INST_PC = 0x58; - public static final int EVM_INST_POP = 0x50; - public static final int EVM_INST_PUSH1 = 0x60; - public static final int EVM_INST_PUSH10 = 0x69; - public static final int EVM_INST_PUSH11 = 0x6a; - public static final int EVM_INST_PUSH12 = 0x6b; - public static final int EVM_INST_PUSH13 = 0x6c; - public static final int EVM_INST_PUSH14 = 0x6d; - public static final int EVM_INST_PUSH15 = 0x6e; - public static final int EVM_INST_PUSH16 = 0x6f; - public static final int EVM_INST_PUSH17 = 0x70; - public static final int EVM_INST_PUSH18 = 0x71; - public static final int EVM_INST_PUSH19 = 0x72; - public static final int EVM_INST_PUSH2 = 0x61; - public static final int EVM_INST_PUSH20 = 0x73; - public static final int EVM_INST_PUSH21 = 0x74; - public static final int EVM_INST_PUSH22 = 0x75; - public static final int EVM_INST_PUSH23 = 0x76; - public static final int EVM_INST_PUSH24 = 0x77; - public static final int EVM_INST_PUSH25 = 0x78; - public static final int EVM_INST_PUSH26 = 0x79; - public static final int EVM_INST_PUSH27 = 0x7a; - public static final int EVM_INST_PUSH28 = 0x7b; - public static final int EVM_INST_PUSH29 = 0x7c; - public static final int EVM_INST_PUSH3 = 0x62; - public static final int EVM_INST_PUSH30 = 0x7d; - public static final int EVM_INST_PUSH31 = 0x7e; - public static final int EVM_INST_PUSH32 = 0x7f; - public static final int EVM_INST_PUSH4 = 0x63; - public static final int EVM_INST_PUSH5 = 0x64; - public static final int EVM_INST_PUSH6 = 0x65; - public static final int EVM_INST_PUSH7 = 0x66; - public static final int EVM_INST_PUSH8 = 0x67; - public static final int EVM_INST_PUSH9 = 0x68; - public static final int EVM_INST_RETURN = 0xf3; - public static final int EVM_INST_RETURNDATACOPY = 0x3e; - public static final int EVM_INST_RETURNDATASIZE = 0x3d; - public static final int EVM_INST_REVERT = 0xfd; - public static final int EVM_INST_SAR = 0x1d; - public static final int EVM_INST_SDIV = 0x5; - public static final int EVM_INST_SELFBALANCE = 0x47; - public static final int EVM_INST_SELFDESTRUCT = 0xff; - public static final int EVM_INST_SGT = 0x13; - public static final int EVM_INST_SHA3 = 0x20; - public static final int EVM_INST_SHL = 0x1b; - public static final int EVM_INST_SHR = 0x1c; - public static final int EVM_INST_SIGNEXTEND = 0xb; - public static final int EVM_INST_SLOAD = 0x54; - public static final int EVM_INST_SLT = 0x12; - public static final int EVM_INST_SMOD = 0x7; - public static final int EVM_INST_SSTORE = 0x55; - public static final int EVM_INST_STATICCALL = 0xfa; - public static final int EVM_INST_STOP = 0x0; - public static final int EVM_INST_SUB = 0x3; - public static final int EVM_INST_SWAP1 = 0x90; - public static final int EVM_INST_SWAP10 = 0x99; - public static final int EVM_INST_SWAP11 = 0x9a; - public static final int EVM_INST_SWAP12 = 0x9b; - public static final int EVM_INST_SWAP13 = 0x9c; - public static final int EVM_INST_SWAP14 = 0x9d; - public static final int EVM_INST_SWAP15 = 0x9e; - public static final int EVM_INST_SWAP16 = 0x9f; - public static final int EVM_INST_SWAP2 = 0x91; - public static final int EVM_INST_SWAP3 = 0x92; - public static final int EVM_INST_SWAP4 = 0x93; - public static final int EVM_INST_SWAP5 = 0x94; - public static final int EVM_INST_SWAP6 = 0x95; - public static final int EVM_INST_SWAP7 = 0x96; - public static final int EVM_INST_SWAP8 = 0x97; - public static final int EVM_INST_SWAP9 = 0x98; - public static final int EVM_INST_TIMESTAMP = 0x42; - public static final int EVM_INST_XOR = 0x18; - public static final int EXO_SUM_INDEX_BLAKEMODEXP = 0x6; - public static final int EXO_SUM_INDEX_ECDATA = 0x4; - public static final int EXO_SUM_INDEX_KEC = 0x1; - public static final int EXO_SUM_INDEX_LOG = 0x2; - public static final int EXO_SUM_INDEX_RIPSHA = 0x5; - public static final int EXO_SUM_INDEX_ROM = 0x0; - public static final int EXO_SUM_INDEX_TXCD = 0x3; - public static final int EXO_SUM_WEIGHT_BLAKEMODEXP = 0x40; - public static final int EXO_SUM_WEIGHT_ECDATA = 0x10; - public static final int EXO_SUM_WEIGHT_KEC = 0x2; - public static final int EXO_SUM_WEIGHT_LOG = 0x4; - public static final int EXO_SUM_WEIGHT_RIPSHA = 0x20; - public static final int EXO_SUM_WEIGHT_ROM = 0x1; - public static final int EXO_SUM_WEIGHT_TXCD = 0x8; - public static final int EXP_INST_EXPLOG = 0xee0a; - public static final int EXP_INST_MODEXPLOG = 0xee05; - public static final int GAS_CONST_G_ACCESS_LIST_ADRESS = 0x960; - public static final int GAS_CONST_G_ACCESS_LIST_STORAGE = 0x76c; - public static final int GAS_CONST_G_BASE = 0x2; - public static final int GAS_CONST_G_BLOCKHASH = 0x14; - public static final int GAS_CONST_G_CALL_STIPEND = 0x8fc; - public static final int GAS_CONST_G_CALL_VALUE = 0x2328; - public static final int GAS_CONST_G_CODE_DEPOSIT = 0xc8; - public static final int GAS_CONST_G_COLD_ACCOUNT_ACCESS = 0xa28; - public static final int GAS_CONST_G_COLD_SLOAD = 0x834; - public static final int GAS_CONST_G_COPY = 0x3; - public static final int GAS_CONST_G_CREATE = 0x7d00; - public static final int GAS_CONST_G_EXP = 0xa; - public static final int GAS_CONST_G_EXP_BYTE = 0x32; - public static final int GAS_CONST_G_HIGH = 0xa; - public static final int GAS_CONST_G_JUMPDEST = 0x1; - public static final int GAS_CONST_G_KECCAK_256 = 0x1e; - public static final int GAS_CONST_G_KECCAK_256_WORD = 0x6; - public static final int GAS_CONST_G_LOG = 0x177; - public static final int GAS_CONST_G_LOG_DATA = 0x8; - public static final int GAS_CONST_G_LOG_TOPIC = 0x177; - public static final int GAS_CONST_G_LOW = 0x5; - public static final int GAS_CONST_G_MEMORY = 0x3; - public static final int GAS_CONST_G_MID = 0x8; - public static final int GAS_CONST_G_NEW_ACCOUNT = 0x61a8; - public static final int GAS_CONST_G_SELFDESTRUCT = 0x1388; - public static final int GAS_CONST_G_SRESET = 0xb54; - public static final int GAS_CONST_G_SSET = 0x4e20; - public static final int GAS_CONST_G_TRANSACTION = 0x5208; - public static final int GAS_CONST_G_TX_CREATE = 0x7d00; - public static final int GAS_CONST_G_TX_DATA_NONZERO = 0x10; - public static final int GAS_CONST_G_TX_DATA_ZERO = 0x4; - public static final int GAS_CONST_G_VERY_LOW = 0x3; - public static final int GAS_CONST_G_WARM_ACCESS = 0x64; - public static final int GAS_CONST_G_ZERO = 0x0; - public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; - public static final int LINEA_BASE_FEE = 0x7; - public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; - public static final int LINEA_CHAIN_ID = 0xe708; - public static final int LINEA_DIFFICULTY = 0x2; - public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; - public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; - public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; - public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; - public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; - public static final int LLARGE = 0x10; - public static final int LLARGEMO = 0xf; - public static final int LLARGEPO = 0x11; - public static final int MAX_CODE_SIZE = 0x6000; - public static final int MAX_REFUND_QUOTIENT = 0x5; - public static final int MISC_WEIGHT_EXP = 0x1; - public static final int MISC_WEIGHT_MMU = 0x2; - public static final int MISC_WEIGHT_MXP = 0x4; - public static final int MISC_WEIGHT_OOB = 0x8; - public static final int MISC_WEIGHT_STP = 0x10; - public static final int MMEDIUM = 0x8; - public static final int MMEDIUMMO = 0x7; - public static final int MMIO_INST_LIMB_TO_RAM_ONE_TARGET = 0xfe12; - public static final int MMIO_INST_LIMB_TO_RAM_TRANSPLANT = 0xfe11; - public static final int MMIO_INST_LIMB_TO_RAM_TWO_TARGET = 0xfe13; - public static final int MMIO_INST_LIMB_VANISHES = 0xfe01; - public static final int MMIO_INST_RAM_EXCISION = 0xfe41; - public static final int MMIO_INST_RAM_TO_LIMB_ONE_SOURCE = 0xfe22; - public static final int MMIO_INST_RAM_TO_LIMB_TRANSPLANT = 0xfe21; - public static final int MMIO_INST_RAM_TO_LIMB_TWO_SOURCE = 0xfe23; - public static final int MMIO_INST_RAM_TO_RAM_PARTIAL = 0xfe32; - public static final int MMIO_INST_RAM_TO_RAM_TRANSPLANT = 0xfe31; - public static final int MMIO_INST_RAM_TO_RAM_TWO_SOURCE = 0xfe34; - public static final int MMIO_INST_RAM_TO_RAM_TWO_TARGET = 0xfe33; - public static final int MMIO_INST_RAM_VANISHES = 0xfe42; - public static final int MMU_INST_ANY_TO_RAM_WITH_PADDING = 0xfe50; - public static final int MMU_INST_BLAKE = 0xfe80; - public static final int MMU_INST_EXO_TO_RAM_TRANSPLANTS = 0xfe30; - public static final int MMU_INST_INVALID_CODE_PREFIX = 0xfe00; - public static final int MMU_INST_MLOAD = 0xfe01; - public static final int MMU_INST_MODEXP_DATA = 0xfe70; - public static final int MMU_INST_MODEXP_ZERO = 0xfe60; - public static final int MMU_INST_MSTORE = 0xfe02; - public static final int MMU_INST_MSTORE8 = 0xfe03; - public static final int MMU_INST_RAM_TO_EXO_WITH_PADDING = 0xfe20; - public static final int MMU_INST_RAM_TO_RAM_SANS_PADDING = 0xfe40; - public static final int MMU_INST_RIGHT_PADDED_WORD_EXTRACTION = 0xfe10; - public static final int OOB_INST_BLAKE_CDS = 0xfa09; - public static final int OOB_INST_BLAKE_PARAMS = 0xfb09; - public static final int OOB_INST_CALL = 0xca; - public static final int OOB_INST_CDL = 0x35; - public static final int OOB_INST_CREATE = 0xce; - public static final int OOB_INST_DEPLOYMENT = 0xf3; - public static final int OOB_INST_ECADD = 0xff06; - public static final int OOB_INST_ECMUL = 0xff07; - public static final int OOB_INST_ECPAIRING = 0xff08; - public static final int OOB_INST_ECRECOVER = 0xff01; - public static final int OOB_INST_IDENTITY = 0xff04; - public static final int OOB_INST_JUMP = 0x56; - public static final int OOB_INST_JUMPI = 0x57; - public static final int OOB_INST_MODEXP_CDS = 0xfa05; - public static final int OOB_INST_MODEXP_EXTRACT = 0xfe05; - public static final int OOB_INST_MODEXP_LEAD = 0xfc05; - public static final int OOB_INST_MODEXP_PRICING = 0xfd05; - public static final int OOB_INST_MODEXP_XBS = 0xfb05; - public static final int OOB_INST_RDC = 0x3e; - public static final int OOB_INST_RIPEMD = 0xff03; - public static final int OOB_INST_SHA2 = 0xff02; - public static final int OOB_INST_SSTORE = 0x55; - public static final int OOB_INST_XCALL = 0xcc; - public static final int PHASE_BLAKE_DATA = 0x5; - public static final int PHASE_BLAKE_PARAMS = 0x6; - public static final int PHASE_BLAKE_RESULT = 0x7; - public static final int PHASE_ECADD_DATA = 0x60a; - public static final int PHASE_ECADD_RESULT = 0x60b; - public static final int PHASE_ECMUL_DATA = 0x70a; - public static final int PHASE_ECMUL_RESULT = 0x70b; - public static final int PHASE_ECPAIRING_DATA = 0x80a; - public static final int PHASE_ECPAIRING_RESULT = 0x80b; - public static final int PHASE_ECRECOVER_DATA = 0x10a; - public static final int PHASE_ECRECOVER_RESULT = 0x10b; - public static final int PHASE_KECCAK_DATA = 0x5; - public static final int PHASE_KECCAK_RESULT = 0x6; - public static final int PHASE_MODEXP_BASE = 0x1; - public static final int PHASE_MODEXP_EXPONENT = 0x2; - public static final int PHASE_MODEXP_MODULUS = 0x3; - public static final int PHASE_MODEXP_RESULT = 0x4; - public static final int PHASE_RIPEMD_DATA = 0x3; - public static final int PHASE_RIPEMD_RESULT = 0x4; - public static final int PHASE_SHA2_DATA = 0x1; - public static final int PHASE_SHA2_RESULT = 0x2; - public static final int REFUND_CONST_R_SCLEAR = 0x12c0; - public static final int RLP_ADDR_RECIPE_1 = 0x1; - public static final int RLP_ADDR_RECIPE_2 = 0x2; - public static final int RLP_PREFIX_INT_LONG = 0xb7; - public static final int RLP_PREFIX_INT_SHORT = 0x80; - public static final int RLP_PREFIX_LIST_LONG = 0xf7; - public static final int RLP_PREFIX_LIST_SHORT = 0xc0; - public static final int RLP_RCPT_SUBPHASE_ID_ADDR = 0x35; - public static final int RLP_RCPT_SUBPHASE_ID_CUMUL_GAS = 0x3; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_LIMB = 0x4d; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_SIZE = 0x53; - public static final int RLP_RCPT_SUBPHASE_ID_NO_LOG_ENTRY = 0xb; - public static final int RLP_RCPT_SUBPHASE_ID_STATUS_CODE = 0x2; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_BASE = 0x41; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_DELTA = 0x60; - public static final int RLP_RCPT_SUBPHASE_ID_TYPE = 0x7; - public static final int RLP_TXN_PHASE_ACCESS_LIST = 0xb; - public static final int RLP_TXN_PHASE_BETA = 0xc; - public static final int RLP_TXN_PHASE_CHAIN_ID = 0x2; - public static final int RLP_TXN_PHASE_DATA = 0xa; - public static final int RLP_TXN_PHASE_GAS_LIMIT = 0x7; - public static final int RLP_TXN_PHASE_GAS_PRICE = 0x4; - public static final int RLP_TXN_PHASE_MAX_FEE_PER_GAS = 0x6; - public static final int RLP_TXN_PHASE_MAX_PRIORITY_FEE_PER_GAS = 0x5; - public static final int RLP_TXN_PHASE_NONCE = 0x3; - public static final int RLP_TXN_PHASE_R = 0xe; - public static final int RLP_TXN_PHASE_RLP_PREFIX = 0x1; - public static final int RLP_TXN_PHASE_S = 0xf; - public static final int RLP_TXN_PHASE_TO = 0x8; - public static final int RLP_TXN_PHASE_VALUE = 0x9; - public static final int RLP_TXN_PHASE_Y = 0xd; - public static final int WCP_INST_GEQ = 0xe; - public static final int WCP_INST_LEQ = 0xf; - public static final int WORD_SIZE = 0x20; - public static final int WORD_SIZE_MO = 0x1f; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - - static List headers(int length) { - List headers = new ArrayList<>(); - return headers; - } - - public GlobalConstants (List buffers) { - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public GlobalConstants validateRow() { - filled.clear(); - this.currentLine++; - - return this; - } - - public GlobalConstants fillAndValidateRow() { - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java deleted file mode 100644 index 872c29937..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ecdata/Trace.java +++ /dev/null @@ -1,1468 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.ecdata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int ADDMOD = 0x8; - public static final int CT_MAX_LARGE_POINT = 0x7; - public static final int CT_MAX_SMALL_POINT = 0x3; - public static final int ECADD = 0x6; - public static final int ECMUL = 0x7; - public static final int ECPAIRING = 0x8; - public static final int ECRECOVER = 0x1; - public static final int INDEX_MAX_ECADD_DATA = 0x7; - public static final int INDEX_MAX_ECADD_RESULT = 0x3; - public static final int INDEX_MAX_ECMUL_DATA = 0x5; - public static final int INDEX_MAX_ECMUL_RESULT = 0x3; - public static final int INDEX_MAX_ECPAIRING_DATA_MIN = 0xb; - public static final int INDEX_MAX_ECPAIRING_RESULT = 0x1; - public static final int INDEX_MAX_ECRECOVER_DATA = 0x7; - public static final int INDEX_MAX_ECRECOVER_RESULT = 0x1; - public static final int MULMOD = 0x9; - public static final BigInteger P_BN_HI = new BigInteger("64323764613183177041862057485226039389"); - public static final BigInteger P_BN_LO = new BigInteger("201385395114098847380338600778089168199"); - public static final BigInteger SECP256K1N_HI = new BigInteger("340282366920938463463374607431768211455"); - public static final BigInteger SECP256K1N_LO = new BigInteger("340282366920938463463374607427473243183"); - public static final int TOTAL_SIZE_ECADD_DATA = 0x80; - public static final int TOTAL_SIZE_ECADD_RESULT = 0x40; - public static final int TOTAL_SIZE_ECMUL_DATA = 0x60; - public static final int TOTAL_SIZE_ECMUL_RESULT = 0x40; - public static final int TOTAL_SIZE_ECPAIRING_DATA_MIN = 0xc0; - public static final int TOTAL_SIZE_ECPAIRING_RESULT = 0x20; - public static final int TOTAL_SIZE_ECRECOVER_DATA = 0x80; - public static final int TOTAL_SIZE_ECRECOVER_RESULT = 0x20; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer accPairings; - private final MappedByteBuffer acceptablePairOfPointsForPairingCircuit; - private final MappedByteBuffer byteDelta; - private final MappedByteBuffer circuitSelectorEcadd; - private final MappedByteBuffer circuitSelectorEcmul; - private final MappedByteBuffer circuitSelectorEcpairing; - private final MappedByteBuffer circuitSelectorEcrecover; - private final MappedByteBuffer circuitSelectorG2Membership; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer extArg1Hi; - private final MappedByteBuffer extArg1Lo; - private final MappedByteBuffer extArg2Hi; - private final MappedByteBuffer extArg2Lo; - private final MappedByteBuffer extArg3Hi; - private final MappedByteBuffer extArg3Lo; - private final MappedByteBuffer extFlag; - private final MappedByteBuffer extInst; - private final MappedByteBuffer extResHi; - private final MappedByteBuffer extResLo; - private final MappedByteBuffer g2MembershipTestRequired; - private final MappedByteBuffer hurdle; - private final MappedByteBuffer id; - private final MappedByteBuffer index; - private final MappedByteBuffer indexMax; - private final MappedByteBuffer internalChecksPassed; - private final MappedByteBuffer isEcaddData; - private final MappedByteBuffer isEcaddResult; - private final MappedByteBuffer isEcmulData; - private final MappedByteBuffer isEcmulResult; - private final MappedByteBuffer isEcpairingData; - private final MappedByteBuffer isEcpairingResult; - private final MappedByteBuffer isEcrecoverData; - private final MappedByteBuffer isEcrecoverResult; - private final MappedByteBuffer isInfinity; - private final MappedByteBuffer isLargePoint; - private final MappedByteBuffer isSmallPoint; - private final MappedByteBuffer limb; - private final MappedByteBuffer notOnG2; - private final MappedByteBuffer notOnG2Acc; - private final MappedByteBuffer notOnG2AccMax; - private final MappedByteBuffer overallTrivialPairing; - private final MappedByteBuffer phase; - private final MappedByteBuffer stamp; - private final MappedByteBuffer successBit; - private final MappedByteBuffer totalPairings; - private final MappedByteBuffer totalSize; - private final MappedByteBuffer wcpArg1Hi; - private final MappedByteBuffer wcpArg1Lo; - private final MappedByteBuffer wcpArg2Hi; - private final MappedByteBuffer wcpArg2Lo; - private final MappedByteBuffer wcpFlag; - private final MappedByteBuffer wcpInst; - private final MappedByteBuffer wcpRes; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("ecdata.ACC_PAIRINGS", 2, length)); - headers.add(new ColumnHeader("ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT", 1, length)); - headers.add(new ColumnHeader("ecdata.BYTE_DELTA", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECADD", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECMUL", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECPAIRING", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_ECRECOVER", 1, length)); - headers.add(new ColumnHeader("ecdata.CIRCUIT_SELECTOR_G2_MEMBERSHIP", 1, length)); - headers.add(new ColumnHeader("ecdata.CT", 1, length)); - headers.add(new ColumnHeader("ecdata.CT_MAX", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG1_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG2_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG3_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_ARG3_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_FLAG", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_INST", 1, length)); - headers.add(new ColumnHeader("ecdata.EXT_RES_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.EXT_RES_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.G2_MEMBERSHIP_TEST_REQUIRED", 1, length)); - headers.add(new ColumnHeader("ecdata.HURDLE", 1, length)); - headers.add(new ColumnHeader("ecdata.ID", 4, length)); - headers.add(new ColumnHeader("ecdata.INDEX", 2, length)); - headers.add(new ColumnHeader("ecdata.INDEX_MAX", 2, length)); - headers.add(new ColumnHeader("ecdata.INTERNAL_CHECKS_PASSED", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECADD_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECADD_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECMUL_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECMUL_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECPAIRING_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_DATA", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_ECRECOVER_RESULT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_INFINITY", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_LARGE_POINT", 1, length)); - headers.add(new ColumnHeader("ecdata.IS_SMALL_POINT", 1, length)); - headers.add(new ColumnHeader("ecdata.LIMB", 16, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2", 1, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC", 1, length)); - headers.add(new ColumnHeader("ecdata.NOT_ON_G2_ACC_MAX", 1, length)); - headers.add(new ColumnHeader("ecdata.OVERALL_TRIVIAL_PAIRING", 1, length)); - headers.add(new ColumnHeader("ecdata.PHASE", 2, length)); - headers.add(new ColumnHeader("ecdata.STAMP", 4, length)); - headers.add(new ColumnHeader("ecdata.SUCCESS_BIT", 1, length)); - headers.add(new ColumnHeader("ecdata.TOTAL_PAIRINGS", 2, length)); - headers.add(new ColumnHeader("ecdata.TOTAL_SIZE", 2, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG1_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG2_HI", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("ecdata.WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("ecdata.WCP_INST", 1, length)); - headers.add(new ColumnHeader("ecdata.WCP_RES", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.accPairings = buffers.get(0); - this.acceptablePairOfPointsForPairingCircuit = buffers.get(1); - this.byteDelta = buffers.get(2); - this.circuitSelectorEcadd = buffers.get(3); - this.circuitSelectorEcmul = buffers.get(4); - this.circuitSelectorEcpairing = buffers.get(5); - this.circuitSelectorEcrecover = buffers.get(6); - this.circuitSelectorG2Membership = buffers.get(7); - this.ct = buffers.get(8); - this.ctMax = buffers.get(9); - this.extArg1Hi = buffers.get(10); - this.extArg1Lo = buffers.get(11); - this.extArg2Hi = buffers.get(12); - this.extArg2Lo = buffers.get(13); - this.extArg3Hi = buffers.get(14); - this.extArg3Lo = buffers.get(15); - this.extFlag = buffers.get(16); - this.extInst = buffers.get(17); - this.extResHi = buffers.get(18); - this.extResLo = buffers.get(19); - this.g2MembershipTestRequired = buffers.get(20); - this.hurdle = buffers.get(21); - this.id = buffers.get(22); - this.index = buffers.get(23); - this.indexMax = buffers.get(24); - this.internalChecksPassed = buffers.get(25); - this.isEcaddData = buffers.get(26); - this.isEcaddResult = buffers.get(27); - this.isEcmulData = buffers.get(28); - this.isEcmulResult = buffers.get(29); - this.isEcpairingData = buffers.get(30); - this.isEcpairingResult = buffers.get(31); - this.isEcrecoverData = buffers.get(32); - this.isEcrecoverResult = buffers.get(33); - this.isInfinity = buffers.get(34); - this.isLargePoint = buffers.get(35); - this.isSmallPoint = buffers.get(36); - this.limb = buffers.get(37); - this.notOnG2 = buffers.get(38); - this.notOnG2Acc = buffers.get(39); - this.notOnG2AccMax = buffers.get(40); - this.overallTrivialPairing = buffers.get(41); - this.phase = buffers.get(42); - this.stamp = buffers.get(43); - this.successBit = buffers.get(44); - this.totalPairings = buffers.get(45); - this.totalSize = buffers.get(46); - this.wcpArg1Hi = buffers.get(47); - this.wcpArg1Lo = buffers.get(48); - this.wcpArg2Hi = buffers.get(49); - this.wcpArg2Lo = buffers.get(50); - this.wcpFlag = buffers.get(51); - this.wcpInst = buffers.get(52); - this.wcpRes = buffers.get(53); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace accPairings(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("ecdata.ACC_PAIRINGS already set"); - } else { - filled.set(1); - } - - if(b >= 65536L) { throw new IllegalArgumentException("ecdata.ACC_PAIRINGS has invalid value (" + b + ")"); } - accPairings.put((byte) (b >> 8)); - accPairings.put((byte) b); - - - return this; - } - - public Trace acceptablePairOfPointsForPairingCircuit(final Boolean b) { - if (filled.get(0)) { - throw new IllegalStateException("ecdata.ACCEPTABLE_PAIR_OF_POINTS_FOR_PAIRING_CIRCUIT already set"); - } else { - filled.set(0); - } - - acceptablePairOfPointsForPairingCircuit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace byteDelta(final UnsignedByte b) { - if (filled.get(2)) { - throw new IllegalStateException("ecdata.BYTE_DELTA already set"); - } else { - filled.set(2); - } - - byteDelta.put(b.toByte()); - - return this; - } - - public Trace circuitSelectorEcadd(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("ecdata.CIRCUIT_SELECTOR_ECADD already set"); - } else { - filled.set(3); - } - - circuitSelectorEcadd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace circuitSelectorEcmul(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("ecdata.CIRCUIT_SELECTOR_ECMUL already set"); - } else { - filled.set(4); - } - - circuitSelectorEcmul.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace circuitSelectorEcpairing(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("ecdata.CIRCUIT_SELECTOR_ECPAIRING already set"); - } else { - filled.set(5); - } - - circuitSelectorEcpairing.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace circuitSelectorEcrecover(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("ecdata.CIRCUIT_SELECTOR_ECRECOVER already set"); - } else { - filled.set(6); - } - - circuitSelectorEcrecover.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace circuitSelectorG2Membership(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("ecdata.CIRCUIT_SELECTOR_G2_MEMBERSHIP already set"); - } else { - filled.set(7); - } - - circuitSelectorG2Membership.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ct(final long b) { - if (filled.get(8)) { - throw new IllegalStateException("ecdata.CT already set"); - } else { - filled.set(8); - } - - if(b >= 8L) { throw new IllegalArgumentException("ecdata.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(9)) { - throw new IllegalStateException("ecdata.CT_MAX already set"); - } else { - filled.set(9); - } - - if(b >= 8L) { throw new IllegalArgumentException("ecdata.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace extArg1Hi(final Bytes b) { - if (filled.get(10)) { - throw new IllegalStateException("ecdata.EXT_ARG1_HI already set"); - } else { - filled.set(10); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.EXT_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_ARG3_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg3Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_ARG3_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extArg3Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extResHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.EXT_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { extResLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("ecdata.ID has invalid value (" + b + ")"); } - id.put((byte) (b >> 24)); - id.put((byte) (b >> 16)); - id.put((byte) (b >> 8)); - id.put((byte) b); - - - return this; - } - - public Trace index(final long b) { - if (filled.get(23)) { - throw new IllegalStateException("ecdata.INDEX already set"); - } else { - filled.set(23); - } - - if(b >= 65536L) { throw new IllegalArgumentException("ecdata.INDEX has invalid value (" + b + ")"); } - index.put((byte) (b >> 8)); - index.put((byte) b); - - - return this; - } - - public Trace indexMax(final long b) { - if (filled.get(24)) { - throw new IllegalStateException("ecdata.INDEX_MAX already set"); - } else { - filled.set(24); - } - - if(b >= 65536L) { throw new IllegalArgumentException("ecdata.INDEX_MAX has invalid value (" + b + ")"); } - indexMax.put((byte) (b >> 8)); - indexMax.put((byte) b); - - - return this; - } - - public Trace internalChecksPassed(final Boolean b) { - if (filled.get(25)) { - throw new IllegalStateException("ecdata.INTERNAL_CHECKS_PASSED already set"); - } else { - filled.set(25); - } - - internalChecksPassed.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcaddData(final Boolean b) { - if (filled.get(26)) { - throw new IllegalStateException("ecdata.IS_ECADD_DATA already set"); - } else { - filled.set(26); - } - - isEcaddData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcaddResult(final Boolean b) { - if (filled.get(27)) { - throw new IllegalStateException("ecdata.IS_ECADD_RESULT already set"); - } else { - filled.set(27); - } - - isEcaddResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcmulData(final Boolean b) { - if (filled.get(28)) { - throw new IllegalStateException("ecdata.IS_ECMUL_DATA already set"); - } else { - filled.set(28); - } - - isEcmulData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcmulResult(final Boolean b) { - if (filled.get(29)) { - throw new IllegalStateException("ecdata.IS_ECMUL_RESULT already set"); - } else { - filled.set(29); - } - - isEcmulResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcpairingData(final Boolean b) { - if (filled.get(30)) { - throw new IllegalStateException("ecdata.IS_ECPAIRING_DATA already set"); - } else { - filled.set(30); - } - - isEcpairingData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcpairingResult(final Boolean b) { - if (filled.get(31)) { - throw new IllegalStateException("ecdata.IS_ECPAIRING_RESULT already set"); - } else { - filled.set(31); - } - - isEcpairingResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcrecoverData(final Boolean b) { - if (filled.get(32)) { - throw new IllegalStateException("ecdata.IS_ECRECOVER_DATA already set"); - } else { - filled.set(32); - } - - isEcrecoverData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isEcrecoverResult(final Boolean b) { - if (filled.get(33)) { - throw new IllegalStateException("ecdata.IS_ECRECOVER_RESULT already set"); - } else { - filled.set(33); - } - - isEcrecoverResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isInfinity(final Boolean b) { - if (filled.get(34)) { - throw new IllegalStateException("ecdata.IS_INFINITY already set"); - } else { - filled.set(34); - } - - isInfinity.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isLargePoint(final Boolean b) { - if (filled.get(35)) { - throw new IllegalStateException("ecdata.IS_LARGE_POINT already set"); - } else { - filled.set(35); - } - - isLargePoint.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isSmallPoint(final Boolean b) { - if (filled.get(36)) { - throw new IllegalStateException("ecdata.IS_SMALL_POINT already set"); - } else { - filled.set(36); - } - - isSmallPoint.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(37)) { - throw new IllegalStateException("ecdata.LIMB already set"); - } else { - filled.set(37); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("ecdata.PHASE has invalid value (" + b + ")"); } - phase.put((byte) (b >> 8)); - phase.put((byte) b); - - - return this; - } - - public Trace stamp(final long b) { - if (filled.get(43)) { - throw new IllegalStateException("ecdata.STAMP already set"); - } else { - filled.set(43); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("ecdata.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace successBit(final Boolean b) { - if (filled.get(44)) { - throw new IllegalStateException("ecdata.SUCCESS_BIT already set"); - } else { - filled.set(44); - } - - successBit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace totalPairings(final long b) { - if (filled.get(45)) { - throw new IllegalStateException("ecdata.TOTAL_PAIRINGS already set"); - } else { - filled.set(45); - } - - if(b >= 65536L) { throw new IllegalArgumentException("ecdata.TOTAL_PAIRINGS has invalid value (" + b + ")"); } - totalPairings.put((byte) (b >> 8)); - totalPairings.put((byte) b); - - - return this; - } - - public Trace totalSize(final long b) { - if (filled.get(46)) { - throw new IllegalStateException("ecdata.TOTAL_SIZE already set"); - } else { - filled.set(46); - } - - if(b >= 65536L) { throw new IllegalArgumentException("ecdata.TOTAL_SIZE has invalid value (" + b + ")"); } - totalSize.put((byte) (b >> 8)); - totalSize.put((byte) b); - - - return this; - } - - public Trace wcpArg1Hi(final Bytes b) { - if (filled.get(47)) { - throw new IllegalStateException("ecdata.WCP_ARG1_HI already set"); - } else { - filled.set(47); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("ecdata.WCP_ARG1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.WCP_ARG2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ecdata.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer ceil; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer dividend; - private final MappedByteBuffer divisor; - private final MappedByteBuffer divisorByte; - private final MappedByteBuffer done; - private final MappedByteBuffer iomf; - private final MappedByteBuffer quotient; - private final MappedByteBuffer quotientByte; - private final MappedByteBuffer remainder; - private final MappedByteBuffer remainderByte; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("euc.CEIL", 8, length)); - headers.add(new ColumnHeader("euc.CT", 1, length)); - headers.add(new ColumnHeader("euc.CT_MAX", 1, length)); - headers.add(new ColumnHeader("euc.DIVIDEND", 8, length)); - headers.add(new ColumnHeader("euc.DIVISOR", 8, length)); - headers.add(new ColumnHeader("euc.DIVISOR_BYTE", 1, length)); - headers.add(new ColumnHeader("euc.DONE", 1, length)); - headers.add(new ColumnHeader("euc.IOMF", 1, length)); - headers.add(new ColumnHeader("euc.QUOTIENT", 8, length)); - headers.add(new ColumnHeader("euc.QUOTIENT_BYTE", 1, length)); - headers.add(new ColumnHeader("euc.REMAINDER", 8, length)); - headers.add(new ColumnHeader("euc.REMAINDER_BYTE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.ceil = buffers.get(0); - this.ct = buffers.get(1); - this.ctMax = buffers.get(2); - this.dividend = buffers.get(3); - this.divisor = buffers.get(4); - this.divisorByte = buffers.get(5); - this.done = buffers.get(6); - this.iomf = buffers.get(7); - this.quotient = buffers.get(8); - this.quotientByte = buffers.get(9); - this.remainder = buffers.get(10); - this.remainderByte = buffers.get(11); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace ceil(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("euc.CEIL already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.CEIL has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { ceil.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("euc.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("euc.CT_MAX already set"); - } else { - filled.set(2); - } - - if(b >= 256L) { throw new IllegalArgumentException("euc.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace dividend(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("euc.DIVIDEND already set"); - } else { - filled.set(3); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("euc.DIVIDEND has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { dividend.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("euc.DIVISOR has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { divisor.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("euc.QUOTIENT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { quotient.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("euc.REMAINDER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { remainder.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int CT_MAX_CMPTN_EXP_LOG = 0xf; - public static final int CT_MAX_CMPTN_MODEXP_LOG = 0xf; - public static final int CT_MAX_MACRO_EXP_LOG = 0x0; - public static final int CT_MAX_MACRO_MODEXP_LOG = 0x0; - public static final int CT_MAX_PRPRC_EXP_LOG = 0x0; - public static final int CT_MAX_PRPRC_MODEXP_LOG = 0x3; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer cmptn; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer data3XorWcpArg2Hi; - private final MappedByteBuffer data4XorWcpArg2Lo; - private final MappedByteBuffer data5; - private final MappedByteBuffer expInst; - private final MappedByteBuffer isExpLog; - private final MappedByteBuffer isModexpLog; - private final MappedByteBuffer macro; - private final MappedByteBuffer manzbAcc; - private final MappedByteBuffer manzbXorWcpFlag; - private final MappedByteBuffer msbAcc; - private final MappedByteBuffer msbBitXorWcpRes; - private final MappedByteBuffer msbXorWcpInst; - private final MappedByteBuffer pltBit; - private final MappedByteBuffer pltJmp; - private final MappedByteBuffer prprc; - private final MappedByteBuffer rawAccXorData1XorWcpArg1Hi; - private final MappedByteBuffer rawByte; - private final MappedByteBuffer stamp; - private final MappedByteBuffer tanzb; - private final MappedByteBuffer tanzbAcc; - private final MappedByteBuffer trimAccXorData2XorWcpArg1Lo; - private final MappedByteBuffer trimByte; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("exp.CMPTN", 1, length)); - headers.add(new ColumnHeader("exp.CT", 1, length)); - headers.add(new ColumnHeader("exp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("exp.DATA_3_xor_WCP_ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("exp.DATA_4_xor_WCP_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("exp.DATA_5", 16, length)); - headers.add(new ColumnHeader("exp.EXP_INST", 2, length)); - headers.add(new ColumnHeader("exp.IS_EXP_LOG", 1, length)); - headers.add(new ColumnHeader("exp.IS_MODEXP_LOG", 1, length)); - headers.add(new ColumnHeader("exp.MACRO", 1, length)); - headers.add(new ColumnHeader("exp.MANZB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.MANZB_xor_WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("exp.MSB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.MSB_BIT_xor_WCP_RES", 1, length)); - headers.add(new ColumnHeader("exp.MSB_xor_WCP_INST", 1, length)); - headers.add(new ColumnHeader("exp.PLT_BIT", 1, length)); - headers.add(new ColumnHeader("exp.PLT_JMP", 1, length)); - headers.add(new ColumnHeader("exp.PRPRC", 1, length)); - headers.add(new ColumnHeader("exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("exp.RAW_BYTE", 1, length)); - headers.add(new ColumnHeader("exp.STAMP", 4, length)); - headers.add(new ColumnHeader("exp.TANZB", 1, length)); - headers.add(new ColumnHeader("exp.TANZB_ACC", 1, length)); - headers.add(new ColumnHeader("exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("exp.TRIM_BYTE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.cmptn = buffers.get(0); - this.ct = buffers.get(1); - this.ctMax = buffers.get(2); - this.data3XorWcpArg2Hi = buffers.get(3); - this.data4XorWcpArg2Lo = buffers.get(4); - this.data5 = buffers.get(5); - this.expInst = buffers.get(6); - this.isExpLog = buffers.get(7); - this.isModexpLog = buffers.get(8); - this.macro = buffers.get(9); - this.manzbAcc = buffers.get(10); - this.manzbXorWcpFlag = buffers.get(11); - this.msbAcc = buffers.get(12); - this.msbBitXorWcpRes = buffers.get(13); - this.msbXorWcpInst = buffers.get(14); - this.pltBit = buffers.get(15); - this.pltJmp = buffers.get(16); - this.prprc = buffers.get(17); - this.rawAccXorData1XorWcpArg1Hi = buffers.get(18); - this.rawByte = buffers.get(19); - this.stamp = buffers.get(20); - this.tanzb = buffers.get(21); - this.tanzbAcc = buffers.get(22); - this.trimAccXorData2XorWcpArg1Lo = buffers.get(23); - this.trimByte = buffers.get(24); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace cmptn(final Boolean b) { - if (filled.get(0)) { - throw new IllegalStateException("exp.CMPTN already set"); - } else { - filled.set(0); - } - - cmptn.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ct(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("exp.CT already set"); - } else { - filled.set(1); - } - - if(b >= 16L) { throw new IllegalArgumentException("exp.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("exp.CT_MAX already set"); - } else { - filled.set(2); - } - - if(b >= 16L) { throw new IllegalArgumentException("exp.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace isExpLog(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("exp.IS_EXP_LOG already set"); - } else { - filled.set(3); - } - - isExpLog.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpLog(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("exp.IS_MODEXP_LOG already set"); - } else { - filled.set(4); - } - - isModexpLog.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace macro(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("exp.MACRO already set"); - } else { - filled.set(5); - } - - macro.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pComputationManzb(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("exp.computation/MANZB already set"); - } else { - filled.set(8); - } - - manzbXorWcpFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pComputationManzbAcc(final long b) { - if (filled.get(16)) { - throw new IllegalStateException("exp.computation/MANZB_ACC already set"); - } else { - filled.set(16); - } - - if(b >= 16L) { throw new IllegalArgumentException("exp.computation/MANZB_ACC has invalid value (" + b + ")"); } - manzbAcc.put((byte) b); - - - return this; - } - - public Trace pComputationMsb(final UnsignedByte b) { - if (filled.get(12)) { - throw new IllegalStateException("exp.computation/MSB already set"); - } else { - filled.set(12); - } - - msbXorWcpInst.put(b.toByte()); - - return this; - } - - public Trace pComputationMsbAcc(final UnsignedByte b) { - if (filled.get(13)) { - throw new IllegalStateException("exp.computation/MSB_ACC already set"); - } else { - filled.set(13); - } - - msbAcc.put(b.toByte()); - - return this; - } - - public Trace pComputationMsbBit(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("exp.computation/MSB_BIT already set"); - } else { - filled.set(9); - } - - msbBitXorWcpRes.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pComputationPltBit(final Boolean b) { - if (filled.get(10)) { - throw new IllegalStateException("exp.computation/PLT_BIT already set"); - } else { - filled.set(10); - } - - pltBit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pComputationPltJmp(final long b) { - if (filled.get(18)) { - throw new IllegalStateException("exp.computation/PLT_JMP already set"); - } else { - filled.set(18); - } - - if(b >= 64L) { throw new IllegalArgumentException("exp.computation/PLT_JMP has invalid value (" + b + ")"); } - pltJmp.put((byte) b); - - - return this; - } - - public Trace pComputationRawAcc(final Bytes b) { - if (filled.get(20)) { - throw new IllegalStateException("exp.computation/RAW_ACC already set"); - } else { - filled.set(20); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.computation/RAW_ACC has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j= 32L) { throw new IllegalArgumentException("exp.computation/TANZB_ACC has invalid value (" + b + ")"); } - tanzbAcc.put((byte) b); - - - return this; - } - - public Trace pComputationTrimAcc(final Bytes b) { - if (filled.get(21)) { - throw new IllegalStateException("exp.computation/TRIM_ACC already set"); - } else { - filled.set(21); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.computation/TRIM_ACC has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.macro/DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.macro/DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.macro/DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data3XorWcpArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.macro/DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data4XorWcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.macro/DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data5.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("exp.macro/EXP_INST has invalid value (" + b + ")"); } - expInst.put((byte) (b >> 8)); - expInst.put((byte) b); - - - return this; - } - - public Trace pPreprocessingWcpArg1Hi(final Bytes b) { - if (filled.get(20)) { - throw new IllegalStateException("exp.preprocessing/WCP_ARG_1_HI already set"); - } else { - filled.set(20); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAccXorData1XorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { trimAccXorData2XorWcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data3XorWcpArg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("exp.preprocessing/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data4XorWcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("exp.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("exp.CMPTN has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("exp.CT has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("exp.CT_MAX has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("exp.DATA_3_xor_WCP_ARG_2_HI has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("exp.DATA_4_xor_WCP_ARG_2_LO has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("exp.DATA_5 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("exp.EXP_INST has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("exp.IS_EXP_LOG has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("exp.IS_MODEXP_LOG has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("exp.MACRO has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("exp.MANZB_ACC has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("exp.MANZB_xor_WCP_FLAG has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("exp.MSB_ACC has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("exp.MSB_BIT_xor_WCP_RES has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("exp.MSB_xor_WCP_INST has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("exp.PLT_BIT has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("exp.PLT_JMP has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("exp.PRPRC has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("exp.RAW_ACC_xor_DATA_1_xor_WCP_ARG_1_HI has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("exp.RAW_BYTE has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("exp.STAMP has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("exp.TANZB has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("exp.TANZB_ACC has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("exp.TRIM_ACC_xor_DATA_2_xor_WCP_ARG_1_LO has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("exp.TRIM_BYTE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - cmptn.position(cmptn.position() + 1); - } - - if (!filled.get(1)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(2)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(22)) { - data3XorWcpArg2Hi.position(data3XorWcpArg2Hi.position() + 16); - } - - if (!filled.get(23)) { - data4XorWcpArg2Lo.position(data4XorWcpArg2Lo.position() + 16); - } - - if (!filled.get(24)) { - data5.position(data5.position() + 16); - } - - if (!filled.get(19)) { - expInst.position(expInst.position() + 2); - } - - if (!filled.get(3)) { - isExpLog.position(isExpLog.position() + 1); - } - - if (!filled.get(4)) { - isModexpLog.position(isModexpLog.position() + 1); - } - - if (!filled.get(5)) { - macro.position(macro.position() + 1); - } - - if (!filled.get(16)) { - manzbAcc.position(manzbAcc.position() + 1); - } - - if (!filled.get(8)) { - manzbXorWcpFlag.position(manzbXorWcpFlag.position() + 1); - } - - if (!filled.get(13)) { - msbAcc.position(msbAcc.position() + 1); - } - - if (!filled.get(9)) { - msbBitXorWcpRes.position(msbBitXorWcpRes.position() + 1); - } - - if (!filled.get(12)) { - msbXorWcpInst.position(msbXorWcpInst.position() + 1); - } - - if (!filled.get(10)) { - pltBit.position(pltBit.position() + 1); - } - - if (!filled.get(18)) { - pltJmp.position(pltJmp.position() + 1); - } - - if (!filled.get(6)) { - prprc.position(prprc.position() + 1); - } - - if (!filled.get(20)) { - rawAccXorData1XorWcpArg1Hi.position(rawAccXorData1XorWcpArg1Hi.position() + 16); - } - - if (!filled.get(14)) { - rawByte.position(rawByte.position() + 1); - } - - if (!filled.get(7)) { - stamp.position(stamp.position() + 4); - } - - if (!filled.get(11)) { - tanzb.position(tanzb.position() + 1); - } - - if (!filled.get(17)) { - tanzbAcc.position(tanzbAcc.position() + 1); - } - - if (!filled.get(21)) { - trimAccXorData2XorWcpArg1Lo.position(trimAccXorData2XorWcpArg1Lo.position() + 16); - } - - if (!filled.get(15)) { - trimByte.position(trimByte.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java deleted file mode 100644 index 30ccb5517..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/ext/Trace.java +++ /dev/null @@ -1,3195 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.ext; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer accA0; - private final MappedByteBuffer accA1; - private final MappedByteBuffer accA2; - private final MappedByteBuffer accA3; - private final MappedByteBuffer accB0; - private final MappedByteBuffer accB1; - private final MappedByteBuffer accB2; - private final MappedByteBuffer accB3; - private final MappedByteBuffer accC0; - private final MappedByteBuffer accC1; - private final MappedByteBuffer accC2; - private final MappedByteBuffer accC3; - private final MappedByteBuffer accDelta0; - private final MappedByteBuffer accDelta1; - private final MappedByteBuffer accDelta2; - private final MappedByteBuffer accDelta3; - private final MappedByteBuffer accH0; - private final MappedByteBuffer accH1; - private final MappedByteBuffer accH2; - private final MappedByteBuffer accH3; - private final MappedByteBuffer accH4; - private final MappedByteBuffer accH5; - private final MappedByteBuffer accI0; - private final MappedByteBuffer accI1; - private final MappedByteBuffer accI2; - private final MappedByteBuffer accI3; - private final MappedByteBuffer accI4; - private final MappedByteBuffer accI5; - private final MappedByteBuffer accI6; - private final MappedByteBuffer accJ0; - private final MappedByteBuffer accJ1; - private final MappedByteBuffer accJ2; - private final MappedByteBuffer accJ3; - private final MappedByteBuffer accJ4; - private final MappedByteBuffer accJ5; - private final MappedByteBuffer accJ6; - private final MappedByteBuffer accJ7; - private final MappedByteBuffer accQ0; - private final MappedByteBuffer accQ1; - private final MappedByteBuffer accQ2; - private final MappedByteBuffer accQ3; - private final MappedByteBuffer accQ4; - private final MappedByteBuffer accQ5; - private final MappedByteBuffer accQ6; - private final MappedByteBuffer accQ7; - private final MappedByteBuffer accR0; - private final MappedByteBuffer accR1; - private final MappedByteBuffer accR2; - private final MappedByteBuffer accR3; - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer arg3Hi; - private final MappedByteBuffer arg3Lo; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bit2; - private final MappedByteBuffer bit3; - private final MappedByteBuffer byteA0; - private final MappedByteBuffer byteA1; - private final MappedByteBuffer byteA2; - private final MappedByteBuffer byteA3; - private final MappedByteBuffer byteB0; - private final MappedByteBuffer byteB1; - private final MappedByteBuffer byteB2; - private final MappedByteBuffer byteB3; - private final MappedByteBuffer byteC0; - private final MappedByteBuffer byteC1; - private final MappedByteBuffer byteC2; - private final MappedByteBuffer byteC3; - private final MappedByteBuffer byteDelta0; - private final MappedByteBuffer byteDelta1; - private final MappedByteBuffer byteDelta2; - private final MappedByteBuffer byteDelta3; - private final MappedByteBuffer byteH0; - private final MappedByteBuffer byteH1; - private final MappedByteBuffer byteH2; - private final MappedByteBuffer byteH3; - private final MappedByteBuffer byteH4; - private final MappedByteBuffer byteH5; - private final MappedByteBuffer byteI0; - private final MappedByteBuffer byteI1; - private final MappedByteBuffer byteI2; - private final MappedByteBuffer byteI3; - private final MappedByteBuffer byteI4; - private final MappedByteBuffer byteI5; - private final MappedByteBuffer byteI6; - private final MappedByteBuffer byteJ0; - private final MappedByteBuffer byteJ1; - private final MappedByteBuffer byteJ2; - private final MappedByteBuffer byteJ3; - private final MappedByteBuffer byteJ4; - private final MappedByteBuffer byteJ5; - private final MappedByteBuffer byteJ6; - private final MappedByteBuffer byteJ7; - private final MappedByteBuffer byteQ0; - private final MappedByteBuffer byteQ1; - private final MappedByteBuffer byteQ2; - private final MappedByteBuffer byteQ3; - private final MappedByteBuffer byteQ4; - private final MappedByteBuffer byteQ5; - private final MappedByteBuffer byteQ6; - private final MappedByteBuffer byteQ7; - private final MappedByteBuffer byteR0; - private final MappedByteBuffer byteR1; - private final MappedByteBuffer byteR2; - private final MappedByteBuffer byteR3; - private final MappedByteBuffer cmp; - private final MappedByteBuffer ct; - private final MappedByteBuffer inst; - private final MappedByteBuffer ofH; - private final MappedByteBuffer ofI; - private final MappedByteBuffer ofJ; - private final MappedByteBuffer ofRes; - private final MappedByteBuffer oli; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer stamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("ext.ACC_A_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_A_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_C_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_DELTA_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_H_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_I_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_J_7", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_3", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_4", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_5", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_6", 8, length)); - headers.add(new ColumnHeader("ext.ACC_Q_7", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_0", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_1", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_2", 8, length)); - headers.add(new ColumnHeader("ext.ACC_R_3", 8, length)); - headers.add(new ColumnHeader("ext.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("ext.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("ext.ARG_3_HI", 16, length)); - headers.add(new ColumnHeader("ext.ARG_3_LO", 16, length)); - headers.add(new ColumnHeader("ext.BIT_1", 1, length)); - headers.add(new ColumnHeader("ext.BIT_2", 1, length)); - headers.add(new ColumnHeader("ext.BIT_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_A_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_C_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_DELTA_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_H_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_I_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_J_7", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_3", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_4", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_5", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_6", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_Q_7", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_0", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_1", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_2", 1, length)); - headers.add(new ColumnHeader("ext.BYTE_R_3", 1, length)); - headers.add(new ColumnHeader("ext.CMP", 1, length)); - headers.add(new ColumnHeader("ext.CT", 1, length)); - headers.add(new ColumnHeader("ext.INST", 1, length)); - headers.add(new ColumnHeader("ext.OF_H", 1, length)); - headers.add(new ColumnHeader("ext.OF_I", 1, length)); - headers.add(new ColumnHeader("ext.OF_J", 1, length)); - headers.add(new ColumnHeader("ext.OF_RES", 1, length)); - headers.add(new ColumnHeader("ext.OLI", 1, length)); - headers.add(new ColumnHeader("ext.RES_HI", 16, length)); - headers.add(new ColumnHeader("ext.RES_LO", 16, length)); - headers.add(new ColumnHeader("ext.STAMP", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.accA0 = buffers.get(0); - this.accA1 = buffers.get(1); - this.accA2 = buffers.get(2); - this.accA3 = buffers.get(3); - this.accB0 = buffers.get(4); - this.accB1 = buffers.get(5); - this.accB2 = buffers.get(6); - this.accB3 = buffers.get(7); - this.accC0 = buffers.get(8); - this.accC1 = buffers.get(9); - this.accC2 = buffers.get(10); - this.accC3 = buffers.get(11); - this.accDelta0 = buffers.get(12); - this.accDelta1 = buffers.get(13); - this.accDelta2 = buffers.get(14); - this.accDelta3 = buffers.get(15); - this.accH0 = buffers.get(16); - this.accH1 = buffers.get(17); - this.accH2 = buffers.get(18); - this.accH3 = buffers.get(19); - this.accH4 = buffers.get(20); - this.accH5 = buffers.get(21); - this.accI0 = buffers.get(22); - this.accI1 = buffers.get(23); - this.accI2 = buffers.get(24); - this.accI3 = buffers.get(25); - this.accI4 = buffers.get(26); - this.accI5 = buffers.get(27); - this.accI6 = buffers.get(28); - this.accJ0 = buffers.get(29); - this.accJ1 = buffers.get(30); - this.accJ2 = buffers.get(31); - this.accJ3 = buffers.get(32); - this.accJ4 = buffers.get(33); - this.accJ5 = buffers.get(34); - this.accJ6 = buffers.get(35); - this.accJ7 = buffers.get(36); - this.accQ0 = buffers.get(37); - this.accQ1 = buffers.get(38); - this.accQ2 = buffers.get(39); - this.accQ3 = buffers.get(40); - this.accQ4 = buffers.get(41); - this.accQ5 = buffers.get(42); - this.accQ6 = buffers.get(43); - this.accQ7 = buffers.get(44); - this.accR0 = buffers.get(45); - this.accR1 = buffers.get(46); - this.accR2 = buffers.get(47); - this.accR3 = buffers.get(48); - this.arg1Hi = buffers.get(49); - this.arg1Lo = buffers.get(50); - this.arg2Hi = buffers.get(51); - this.arg2Lo = buffers.get(52); - this.arg3Hi = buffers.get(53); - this.arg3Lo = buffers.get(54); - this.bit1 = buffers.get(55); - this.bit2 = buffers.get(56); - this.bit3 = buffers.get(57); - this.byteA0 = buffers.get(58); - this.byteA1 = buffers.get(59); - this.byteA2 = buffers.get(60); - this.byteA3 = buffers.get(61); - this.byteB0 = buffers.get(62); - this.byteB1 = buffers.get(63); - this.byteB2 = buffers.get(64); - this.byteB3 = buffers.get(65); - this.byteC0 = buffers.get(66); - this.byteC1 = buffers.get(67); - this.byteC2 = buffers.get(68); - this.byteC3 = buffers.get(69); - this.byteDelta0 = buffers.get(70); - this.byteDelta1 = buffers.get(71); - this.byteDelta2 = buffers.get(72); - this.byteDelta3 = buffers.get(73); - this.byteH0 = buffers.get(74); - this.byteH1 = buffers.get(75); - this.byteH2 = buffers.get(76); - this.byteH3 = buffers.get(77); - this.byteH4 = buffers.get(78); - this.byteH5 = buffers.get(79); - this.byteI0 = buffers.get(80); - this.byteI1 = buffers.get(81); - this.byteI2 = buffers.get(82); - this.byteI3 = buffers.get(83); - this.byteI4 = buffers.get(84); - this.byteI5 = buffers.get(85); - this.byteI6 = buffers.get(86); - this.byteJ0 = buffers.get(87); - this.byteJ1 = buffers.get(88); - this.byteJ2 = buffers.get(89); - this.byteJ3 = buffers.get(90); - this.byteJ4 = buffers.get(91); - this.byteJ5 = buffers.get(92); - this.byteJ6 = buffers.get(93); - this.byteJ7 = buffers.get(94); - this.byteQ0 = buffers.get(95); - this.byteQ1 = buffers.get(96); - this.byteQ2 = buffers.get(97); - this.byteQ3 = buffers.get(98); - this.byteQ4 = buffers.get(99); - this.byteQ5 = buffers.get(100); - this.byteQ6 = buffers.get(101); - this.byteQ7 = buffers.get(102); - this.byteR0 = buffers.get(103); - this.byteR1 = buffers.get(104); - this.byteR2 = buffers.get(105); - this.byteR3 = buffers.get(106); - this.cmp = buffers.get(107); - this.ct = buffers.get(108); - this.inst = buffers.get(109); - this.ofH = buffers.get(110); - this.ofI = buffers.get(111); - this.ofJ = buffers.get(112); - this.ofRes = buffers.get(113); - this.oli = buffers.get(114); - this.resHi = buffers.get(115); - this.resLo = buffers.get(116); - this.stamp = buffers.get(117); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace accA0(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("ext.ACC_A_0 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("ext.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH4.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_H_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH5.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI4.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI5.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_I_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accI6.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ4.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ5.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ6.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_J_7 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accJ7.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ4.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ5.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ6.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_Q_7 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ7.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("ext.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_3_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg3Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.ARG_3_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg3Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 8L) { throw new IllegalArgumentException("ext.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(109)) { - throw new IllegalStateException("ext.INST already set"); - } else { - filled.set(109); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace ofH(final Boolean b) { - if (filled.get(110)) { - throw new IllegalStateException("ext.OF_H already set"); - } else { - filled.set(110); - } - - ofH.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ofI(final Boolean b) { - if (filled.get(111)) { - throw new IllegalStateException("ext.OF_I already set"); - } else { - filled.set(111); - } - - ofI.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ofJ(final Boolean b) { - if (filled.get(112)) { - throw new IllegalStateException("ext.OF_J already set"); - } else { - filled.set(112); - } - - ofJ.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ofRes(final Boolean b) { - if (filled.get(113)) { - throw new IllegalStateException("ext.OF_RES already set"); - } else { - filled.set(113); - } - - ofRes.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace oli(final Boolean b) { - if (filled.get(114)) { - throw new IllegalStateException("ext.OLI already set"); - } else { - filled.set(114); - } - - oli.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace resHi(final Bytes b) { - if (filled.get(115)) { - throw new IllegalStateException("ext.RES_HI already set"); - } else { - filled.set(115); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("ext.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("ext.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("ext.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("ext.ACC_A_0 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("ext.ACC_A_1 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("ext.ACC_A_2 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("ext.ACC_A_3 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("ext.ACC_B_0 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("ext.ACC_B_1 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("ext.ACC_B_2 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("ext.ACC_B_3 has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("ext.ACC_C_0 has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("ext.ACC_C_1 has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("ext.ACC_C_2 has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("ext.ACC_C_3 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("ext.ACC_DELTA_0 has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("ext.ACC_DELTA_1 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("ext.ACC_DELTA_2 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("ext.ACC_DELTA_3 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("ext.ACC_H_0 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("ext.ACC_H_1 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("ext.ACC_H_2 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("ext.ACC_H_3 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("ext.ACC_H_4 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("ext.ACC_H_5 has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("ext.ACC_I_0 has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("ext.ACC_I_1 has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("ext.ACC_I_2 has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("ext.ACC_I_3 has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("ext.ACC_I_4 has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("ext.ACC_I_5 has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("ext.ACC_I_6 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("ext.ACC_J_0 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("ext.ACC_J_1 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("ext.ACC_J_2 has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("ext.ACC_J_3 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("ext.ACC_J_4 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("ext.ACC_J_5 has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("ext.ACC_J_6 has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("ext.ACC_J_7 has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("ext.ACC_Q_0 has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("ext.ACC_Q_1 has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("ext.ACC_Q_2 has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("ext.ACC_Q_3 has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("ext.ACC_Q_4 has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("ext.ACC_Q_5 has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("ext.ACC_Q_6 has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("ext.ACC_Q_7 has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("ext.ACC_R_0 has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("ext.ACC_R_1 has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("ext.ACC_R_2 has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("ext.ACC_R_3 has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("ext.ARG_1_HI has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("ext.ARG_1_LO has not been filled"); - } - - if (!filled.get(51)) { - throw new IllegalStateException("ext.ARG_2_HI has not been filled"); - } - - if (!filled.get(52)) { - throw new IllegalStateException("ext.ARG_2_LO has not been filled"); - } - - if (!filled.get(53)) { - throw new IllegalStateException("ext.ARG_3_HI has not been filled"); - } - - if (!filled.get(54)) { - throw new IllegalStateException("ext.ARG_3_LO has not been filled"); - } - - if (!filled.get(55)) { - throw new IllegalStateException("ext.BIT_1 has not been filled"); - } - - if (!filled.get(56)) { - throw new IllegalStateException("ext.BIT_2 has not been filled"); - } - - if (!filled.get(57)) { - throw new IllegalStateException("ext.BIT_3 has not been filled"); - } - - if (!filled.get(58)) { - throw new IllegalStateException("ext.BYTE_A_0 has not been filled"); - } - - if (!filled.get(59)) { - throw new IllegalStateException("ext.BYTE_A_1 has not been filled"); - } - - if (!filled.get(60)) { - throw new IllegalStateException("ext.BYTE_A_2 has not been filled"); - } - - if (!filled.get(61)) { - throw new IllegalStateException("ext.BYTE_A_3 has not been filled"); - } - - if (!filled.get(62)) { - throw new IllegalStateException("ext.BYTE_B_0 has not been filled"); - } - - if (!filled.get(63)) { - throw new IllegalStateException("ext.BYTE_B_1 has not been filled"); - } - - if (!filled.get(64)) { - throw new IllegalStateException("ext.BYTE_B_2 has not been filled"); - } - - if (!filled.get(65)) { - throw new IllegalStateException("ext.BYTE_B_3 has not been filled"); - } - - if (!filled.get(66)) { - throw new IllegalStateException("ext.BYTE_C_0 has not been filled"); - } - - if (!filled.get(67)) { - throw new IllegalStateException("ext.BYTE_C_1 has not been filled"); - } - - if (!filled.get(68)) { - throw new IllegalStateException("ext.BYTE_C_2 has not been filled"); - } - - if (!filled.get(69)) { - throw new IllegalStateException("ext.BYTE_C_3 has not been filled"); - } - - if (!filled.get(70)) { - throw new IllegalStateException("ext.BYTE_DELTA_0 has not been filled"); - } - - if (!filled.get(71)) { - throw new IllegalStateException("ext.BYTE_DELTA_1 has not been filled"); - } - - if (!filled.get(72)) { - throw new IllegalStateException("ext.BYTE_DELTA_2 has not been filled"); - } - - if (!filled.get(73)) { - throw new IllegalStateException("ext.BYTE_DELTA_3 has not been filled"); - } - - if (!filled.get(74)) { - throw new IllegalStateException("ext.BYTE_H_0 has not been filled"); - } - - if (!filled.get(75)) { - throw new IllegalStateException("ext.BYTE_H_1 has not been filled"); - } - - if (!filled.get(76)) { - throw new IllegalStateException("ext.BYTE_H_2 has not been filled"); - } - - if (!filled.get(77)) { - throw new IllegalStateException("ext.BYTE_H_3 has not been filled"); - } - - if (!filled.get(78)) { - throw new IllegalStateException("ext.BYTE_H_4 has not been filled"); - } - - if (!filled.get(79)) { - throw new IllegalStateException("ext.BYTE_H_5 has not been filled"); - } - - if (!filled.get(80)) { - throw new IllegalStateException("ext.BYTE_I_0 has not been filled"); - } - - if (!filled.get(81)) { - throw new IllegalStateException("ext.BYTE_I_1 has not been filled"); - } - - if (!filled.get(82)) { - throw new IllegalStateException("ext.BYTE_I_2 has not been filled"); - } - - if (!filled.get(83)) { - throw new IllegalStateException("ext.BYTE_I_3 has not been filled"); - } - - if (!filled.get(84)) { - throw new IllegalStateException("ext.BYTE_I_4 has not been filled"); - } - - if (!filled.get(85)) { - throw new IllegalStateException("ext.BYTE_I_5 has not been filled"); - } - - if (!filled.get(86)) { - throw new IllegalStateException("ext.BYTE_I_6 has not been filled"); - } - - if (!filled.get(87)) { - throw new IllegalStateException("ext.BYTE_J_0 has not been filled"); - } - - if (!filled.get(88)) { - throw new IllegalStateException("ext.BYTE_J_1 has not been filled"); - } - - if (!filled.get(89)) { - throw new IllegalStateException("ext.BYTE_J_2 has not been filled"); - } - - if (!filled.get(90)) { - throw new IllegalStateException("ext.BYTE_J_3 has not been filled"); - } - - if (!filled.get(91)) { - throw new IllegalStateException("ext.BYTE_J_4 has not been filled"); - } - - if (!filled.get(92)) { - throw new IllegalStateException("ext.BYTE_J_5 has not been filled"); - } - - if (!filled.get(93)) { - throw new IllegalStateException("ext.BYTE_J_6 has not been filled"); - } - - if (!filled.get(94)) { - throw new IllegalStateException("ext.BYTE_J_7 has not been filled"); - } - - if (!filled.get(95)) { - throw new IllegalStateException("ext.BYTE_Q_0 has not been filled"); - } - - if (!filled.get(96)) { - throw new IllegalStateException("ext.BYTE_Q_1 has not been filled"); - } - - if (!filled.get(97)) { - throw new IllegalStateException("ext.BYTE_Q_2 has not been filled"); - } - - if (!filled.get(98)) { - throw new IllegalStateException("ext.BYTE_Q_3 has not been filled"); - } - - if (!filled.get(99)) { - throw new IllegalStateException("ext.BYTE_Q_4 has not been filled"); - } - - if (!filled.get(100)) { - throw new IllegalStateException("ext.BYTE_Q_5 has not been filled"); - } - - if (!filled.get(101)) { - throw new IllegalStateException("ext.BYTE_Q_6 has not been filled"); - } - - if (!filled.get(102)) { - throw new IllegalStateException("ext.BYTE_Q_7 has not been filled"); - } - - if (!filled.get(103)) { - throw new IllegalStateException("ext.BYTE_R_0 has not been filled"); - } - - if (!filled.get(104)) { - throw new IllegalStateException("ext.BYTE_R_1 has not been filled"); - } - - if (!filled.get(105)) { - throw new IllegalStateException("ext.BYTE_R_2 has not been filled"); - } - - if (!filled.get(106)) { - throw new IllegalStateException("ext.BYTE_R_3 has not been filled"); - } - - if (!filled.get(107)) { - throw new IllegalStateException("ext.CMP has not been filled"); - } - - if (!filled.get(108)) { - throw new IllegalStateException("ext.CT has not been filled"); - } - - if (!filled.get(109)) { - throw new IllegalStateException("ext.INST has not been filled"); - } - - if (!filled.get(110)) { - throw new IllegalStateException("ext.OF_H has not been filled"); - } - - if (!filled.get(111)) { - throw new IllegalStateException("ext.OF_I has not been filled"); - } - - if (!filled.get(112)) { - throw new IllegalStateException("ext.OF_J has not been filled"); - } - - if (!filled.get(113)) { - throw new IllegalStateException("ext.OF_RES has not been filled"); - } - - if (!filled.get(114)) { - throw new IllegalStateException("ext.OLI has not been filled"); - } - - if (!filled.get(115)) { - throw new IllegalStateException("ext.RES_HI has not been filled"); - } - - if (!filled.get(116)) { - throw new IllegalStateException("ext.RES_LO has not been filled"); - } - - if (!filled.get(117)) { - throw new IllegalStateException("ext.STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - accA0.position(accA0.position() + 8); - } - - if (!filled.get(1)) { - accA1.position(accA1.position() + 8); - } - - if (!filled.get(2)) { - accA2.position(accA2.position() + 8); - } - - if (!filled.get(3)) { - accA3.position(accA3.position() + 8); - } - - if (!filled.get(4)) { - accB0.position(accB0.position() + 8); - } - - if (!filled.get(5)) { - accB1.position(accB1.position() + 8); - } - - if (!filled.get(6)) { - accB2.position(accB2.position() + 8); - } - - if (!filled.get(7)) { - accB3.position(accB3.position() + 8); - } - - if (!filled.get(8)) { - accC0.position(accC0.position() + 8); - } - - if (!filled.get(9)) { - accC1.position(accC1.position() + 8); - } - - if (!filled.get(10)) { - accC2.position(accC2.position() + 8); - } - - if (!filled.get(11)) { - accC3.position(accC3.position() + 8); - } - - if (!filled.get(12)) { - accDelta0.position(accDelta0.position() + 8); - } - - if (!filled.get(13)) { - accDelta1.position(accDelta1.position() + 8); - } - - if (!filled.get(14)) { - accDelta2.position(accDelta2.position() + 8); - } - - if (!filled.get(15)) { - accDelta3.position(accDelta3.position() + 8); - } - - if (!filled.get(16)) { - accH0.position(accH0.position() + 8); - } - - if (!filled.get(17)) { - accH1.position(accH1.position() + 8); - } - - if (!filled.get(18)) { - accH2.position(accH2.position() + 8); - } - - if (!filled.get(19)) { - accH3.position(accH3.position() + 8); - } - - if (!filled.get(20)) { - accH4.position(accH4.position() + 8); - } - - if (!filled.get(21)) { - accH5.position(accH5.position() + 8); - } - - if (!filled.get(22)) { - accI0.position(accI0.position() + 8); - } - - if (!filled.get(23)) { - accI1.position(accI1.position() + 8); - } - - if (!filled.get(24)) { - accI2.position(accI2.position() + 8); - } - - if (!filled.get(25)) { - accI3.position(accI3.position() + 8); - } - - if (!filled.get(26)) { - accI4.position(accI4.position() + 8); - } - - if (!filled.get(27)) { - accI5.position(accI5.position() + 8); - } - - if (!filled.get(28)) { - accI6.position(accI6.position() + 8); - } - - if (!filled.get(29)) { - accJ0.position(accJ0.position() + 8); - } - - if (!filled.get(30)) { - accJ1.position(accJ1.position() + 8); - } - - if (!filled.get(31)) { - accJ2.position(accJ2.position() + 8); - } - - if (!filled.get(32)) { - accJ3.position(accJ3.position() + 8); - } - - if (!filled.get(33)) { - accJ4.position(accJ4.position() + 8); - } - - if (!filled.get(34)) { - accJ5.position(accJ5.position() + 8); - } - - if (!filled.get(35)) { - accJ6.position(accJ6.position() + 8); - } - - if (!filled.get(36)) { - accJ7.position(accJ7.position() + 8); - } - - if (!filled.get(37)) { - accQ0.position(accQ0.position() + 8); - } - - if (!filled.get(38)) { - accQ1.position(accQ1.position() + 8); - } - - if (!filled.get(39)) { - accQ2.position(accQ2.position() + 8); - } - - if (!filled.get(40)) { - accQ3.position(accQ3.position() + 8); - } - - if (!filled.get(41)) { - accQ4.position(accQ4.position() + 8); - } - - if (!filled.get(42)) { - accQ5.position(accQ5.position() + 8); - } - - if (!filled.get(43)) { - accQ6.position(accQ6.position() + 8); - } - - if (!filled.get(44)) { - accQ7.position(accQ7.position() + 8); - } - - if (!filled.get(45)) { - accR0.position(accR0.position() + 8); - } - - if (!filled.get(46)) { - accR1.position(accR1.position() + 8); - } - - if (!filled.get(47)) { - accR2.position(accR2.position() + 8); - } - - if (!filled.get(48)) { - accR3.position(accR3.position() + 8); - } - - if (!filled.get(49)) { - arg1Hi.position(arg1Hi.position() + 16); - } - - if (!filled.get(50)) { - arg1Lo.position(arg1Lo.position() + 16); - } - - if (!filled.get(51)) { - arg2Hi.position(arg2Hi.position() + 16); - } - - if (!filled.get(52)) { - arg2Lo.position(arg2Lo.position() + 16); - } - - if (!filled.get(53)) { - arg3Hi.position(arg3Hi.position() + 16); - } - - if (!filled.get(54)) { - arg3Lo.position(arg3Lo.position() + 16); - } - - if (!filled.get(55)) { - bit1.position(bit1.position() + 1); - } - - if (!filled.get(56)) { - bit2.position(bit2.position() + 1); - } - - if (!filled.get(57)) { - bit3.position(bit3.position() + 1); - } - - if (!filled.get(58)) { - byteA0.position(byteA0.position() + 1); - } - - if (!filled.get(59)) { - byteA1.position(byteA1.position() + 1); - } - - if (!filled.get(60)) { - byteA2.position(byteA2.position() + 1); - } - - if (!filled.get(61)) { - byteA3.position(byteA3.position() + 1); - } - - if (!filled.get(62)) { - byteB0.position(byteB0.position() + 1); - } - - if (!filled.get(63)) { - byteB1.position(byteB1.position() + 1); - } - - if (!filled.get(64)) { - byteB2.position(byteB2.position() + 1); - } - - if (!filled.get(65)) { - byteB3.position(byteB3.position() + 1); - } - - if (!filled.get(66)) { - byteC0.position(byteC0.position() + 1); - } - - if (!filled.get(67)) { - byteC1.position(byteC1.position() + 1); - } - - if (!filled.get(68)) { - byteC2.position(byteC2.position() + 1); - } - - if (!filled.get(69)) { - byteC3.position(byteC3.position() + 1); - } - - if (!filled.get(70)) { - byteDelta0.position(byteDelta0.position() + 1); - } - - if (!filled.get(71)) { - byteDelta1.position(byteDelta1.position() + 1); - } - - if (!filled.get(72)) { - byteDelta2.position(byteDelta2.position() + 1); - } - - if (!filled.get(73)) { - byteDelta3.position(byteDelta3.position() + 1); - } - - if (!filled.get(74)) { - byteH0.position(byteH0.position() + 1); - } - - if (!filled.get(75)) { - byteH1.position(byteH1.position() + 1); - } - - if (!filled.get(76)) { - byteH2.position(byteH2.position() + 1); - } - - if (!filled.get(77)) { - byteH3.position(byteH3.position() + 1); - } - - if (!filled.get(78)) { - byteH4.position(byteH4.position() + 1); - } - - if (!filled.get(79)) { - byteH5.position(byteH5.position() + 1); - } - - if (!filled.get(80)) { - byteI0.position(byteI0.position() + 1); - } - - if (!filled.get(81)) { - byteI1.position(byteI1.position() + 1); - } - - if (!filled.get(82)) { - byteI2.position(byteI2.position() + 1); - } - - if (!filled.get(83)) { - byteI3.position(byteI3.position() + 1); - } - - if (!filled.get(84)) { - byteI4.position(byteI4.position() + 1); - } - - if (!filled.get(85)) { - byteI5.position(byteI5.position() + 1); - } - - if (!filled.get(86)) { - byteI6.position(byteI6.position() + 1); - } - - if (!filled.get(87)) { - byteJ0.position(byteJ0.position() + 1); - } - - if (!filled.get(88)) { - byteJ1.position(byteJ1.position() + 1); - } - - if (!filled.get(89)) { - byteJ2.position(byteJ2.position() + 1); - } - - if (!filled.get(90)) { - byteJ3.position(byteJ3.position() + 1); - } - - if (!filled.get(91)) { - byteJ4.position(byteJ4.position() + 1); - } - - if (!filled.get(92)) { - byteJ5.position(byteJ5.position() + 1); - } - - if (!filled.get(93)) { - byteJ6.position(byteJ6.position() + 1); - } - - if (!filled.get(94)) { - byteJ7.position(byteJ7.position() + 1); - } - - if (!filled.get(95)) { - byteQ0.position(byteQ0.position() + 1); - } - - if (!filled.get(96)) { - byteQ1.position(byteQ1.position() + 1); - } - - if (!filled.get(97)) { - byteQ2.position(byteQ2.position() + 1); - } - - if (!filled.get(98)) { - byteQ3.position(byteQ3.position() + 1); - } - - if (!filled.get(99)) { - byteQ4.position(byteQ4.position() + 1); - } - - if (!filled.get(100)) { - byteQ5.position(byteQ5.position() + 1); - } - - if (!filled.get(101)) { - byteQ6.position(byteQ6.position() + 1); - } - - if (!filled.get(102)) { - byteQ7.position(byteQ7.position() + 1); - } - - if (!filled.get(103)) { - byteR0.position(byteR0.position() + 1); - } - - if (!filled.get(104)) { - byteR1.position(byteR1.position() + 1); - } - - if (!filled.get(105)) { - byteR2.position(byteR2.position() + 1); - } - - if (!filled.get(106)) { - byteR3.position(byteR3.position() + 1); - } - - if (!filled.get(107)) { - cmp.position(cmp.position() + 1); - } - - if (!filled.get(108)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(109)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(110)) { - ofH.position(ofH.position() + 1); - } - - if (!filled.get(111)) { - ofI.position(ofI.position() + 1); - } - - if (!filled.get(112)) { - ofJ.position(ofJ.position() + 1); - } - - if (!filled.get(113)) { - ofRes.position(ofRes.position() + 1); - } - - if (!filled.get(114)) { - oli.position(oli.position() + 1); - } - - if (!filled.get(115)) { - resHi.position(resHi.position() + 16); - } - - if (!filled.get(116)) { - resLo.position(resLo.position() + 16); - } - - if (!filled.get(117)) { - stamp.position(stamp.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java deleted file mode 100644 index f56762d10..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/gas/Trace.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.gas; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer exceptionsAhoy; - private final MappedByteBuffer first; - private final MappedByteBuffer gasActual; - private final MappedByteBuffer gasCost; - private final MappedByteBuffer inputsAndOutputsAreMeaningful; - private final MappedByteBuffer outOfGasException; - private final MappedByteBuffer wcpArg1Lo; - private final MappedByteBuffer wcpArg2Lo; - private final MappedByteBuffer wcpInst; - private final MappedByteBuffer wcpRes; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("gas.CT", 1, length)); - headers.add(new ColumnHeader("gas.CT_MAX", 1, length)); - headers.add(new ColumnHeader("gas.EXCEPTIONS_AHOY", 1, length)); - headers.add(new ColumnHeader("gas.FIRST", 1, length)); - headers.add(new ColumnHeader("gas.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("gas.GAS_COST", 8, length)); - headers.add(new ColumnHeader("gas.INPUTS_AND_OUTPUTS_ARE_MEANINGFUL", 1, length)); - headers.add(new ColumnHeader("gas.OUT_OF_GAS_EXCEPTION", 1, length)); - headers.add(new ColumnHeader("gas.WCP_ARG1_LO", 16, length)); - headers.add(new ColumnHeader("gas.WCP_ARG2_LO", 16, length)); - headers.add(new ColumnHeader("gas.WCP_INST", 1, length)); - headers.add(new ColumnHeader("gas.WCP_RES", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.ct = buffers.get(0); - this.ctMax = buffers.get(1); - this.exceptionsAhoy = buffers.get(2); - this.first = buffers.get(3); - this.gasActual = buffers.get(4); - this.gasCost = buffers.get(5); - this.inputsAndOutputsAreMeaningful = buffers.get(6); - this.outOfGasException = buffers.get(7); - this.wcpArg1Lo = buffers.get(8); - this.wcpArg2Lo = buffers.get(9); - this.wcpInst = buffers.get(10); - this.wcpRes = buffers.get(11); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace ct(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("gas.CT already set"); - } else { - filled.set(0); - } - - if(b >= 8L) { throw new IllegalArgumentException("gas.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("gas.CT_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 8L) { throw new IllegalArgumentException("gas.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace exceptionsAhoy(final Boolean b) { - if (filled.get(2)) { - throw new IllegalStateException("gas.EXCEPTIONS_AHOY already set"); - } else { - filled.set(2); - } - - exceptionsAhoy.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace first(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("gas.FIRST already set"); - } else { - filled.set(3); - } - - first.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace gasActual(final Bytes b) { - if (filled.get(4)) { - throw new IllegalStateException("gas.GAS_ACTUAL already set"); - } else { - filled.set(4); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("gas.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("gas.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasCost.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("gas.WCP_ARG1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("gas.WCP_ARG2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { wcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int DOM_SUB_STAMP_OFFSET___FINALIZATION = 0x9; - public static final int DOM_SUB_STAMP_OFFSET___REVERT = 0x8; - public static final int DOM_SUB_STAMP_OFFSET___SELFDESTRUCT = 0xa; - public static final int MULTIPLIER___DOM_SUB_STAMPS = 0x10; - public static final int MULTIPLIER___STACK_STAMP = 0x8; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absoluteTransactionNumber; - private final MappedByteBuffer addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize; - private final MappedByteBuffer addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo; - private final MappedByteBuffer againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd; - private final MappedByteBuffer againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment; - private final MappedByteBuffer againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2; - private final MappedByteBuffer alpha; - private final MappedByteBuffer balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance; - private final MappedByteBuffer balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo; - private final MappedByteBuffer callDataOffsetXorMmuSize; - private final MappedByteBuffer callDataSizeXorMmuSrcId; - private final MappedByteBuffer callStackDepthXorStackItemHeight1; - private final MappedByteBuffer callerContextNumber; - private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi; - private final MappedByteBuffer codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue; - private final MappedByteBuffer codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo; - private final MappedByteBuffer codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo; - private final MappedByteBuffer codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi; - private final MappedByteBuffer codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize; - private final MappedByteBuffer codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi; - private final MappedByteBuffer contextGetsReverted; - private final MappedByteBuffer contextMayChange; - private final MappedByteBuffer contextNumber; - private final MappedByteBuffer contextNumberNew; - private final MappedByteBuffer contextNumberXorMmuTgtId; - private final MappedByteBuffer contextRevertStamp; - private final MappedByteBuffer contextSelfReverts; - private final MappedByteBuffer contextWillRevert; - private final MappedByteBuffer counterNsr; - private final MappedByteBuffer counterTli; - private final MappedByteBuffer delta; - private final MappedByteBuffer deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock; - private final MappedByteBuffer deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock; - private final MappedByteBuffer deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase; - private final MappedByteBuffer deploymentNumberNewXorCallerAddressHiXorMmuRefOffset; - private final MappedByteBuffer deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi; - private final MappedByteBuffer deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode; - private final MappedByteBuffer deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn; - private final MappedByteBuffer deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution; - private final MappedByteBuffer domStamp; - private final MappedByteBuffer exceptionAhoy; - private final MappedByteBuffer existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf; - private final MappedByteBuffer existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk; - private final MappedByteBuffer finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn; - private final MappedByteBuffer finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges; - private final MappedByteBuffer finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig; - private final MappedByteBuffer firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero; - private final MappedByteBuffer firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr; - private final MappedByteBuffer firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig; - private final MappedByteBuffer gasActual; - private final MappedByteBuffer gasCost; - private final MappedByteBuffer gasExpected; - private final MappedByteBuffer gasLimit; - private final MappedByteBuffer gasNext; - private final MappedByteBuffer gasPrice; - private final MappedByteBuffer hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero; - private final MappedByteBuffer hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero; - private final MappedByteBuffer height; - private final MappedByteBuffer heightNew; - private final MappedByteBuffer hubStamp; - private final MappedByteBuffer hubStampTransactionEnd; - private final MappedByteBuffer instruction; - private final MappedByteBuffer isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth; - private final MappedByteBuffer logInfoStamp; - private final MappedByteBuffer markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx; - private final MappedByteBuffer markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew; - private final MappedByteBuffer mmuStamp; - private final MappedByteBuffer mxpOffset2Hi; - private final MappedByteBuffer mxpOffset2Lo; - private final MappedByteBuffer mxpSize1Hi; - private final MappedByteBuffer mxpSize1Lo; - private final MappedByteBuffer mxpSize2Hi; - private final MappedByteBuffer mxpSize2Lo; - private final MappedByteBuffer mxpStamp; - private final MappedByteBuffer mxpWords; - private final MappedByteBuffer nonStackRows; - private final MappedByteBuffer nonce; - private final MappedByteBuffer nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable; - private final MappedByteBuffer nonceXorStpGasMxpXorPrcCalleeGasXorBasefee; - private final MappedByteBuffer oobData1; - private final MappedByteBuffer oobData2; - private final MappedByteBuffer oobData3; - private final MappedByteBuffer oobData4; - private final MappedByteBuffer oobData5; - private final MappedByteBuffer oobData6; - private final MappedByteBuffer oobData7; - private final MappedByteBuffer oobData8; - private final MappedByteBuffer oobData9; - private final MappedByteBuffer peekAtAccount; - private final MappedByteBuffer peekAtContext; - private final MappedByteBuffer peekAtMiscellaneous; - private final MappedByteBuffer peekAtScenario; - private final MappedByteBuffer peekAtStack; - private final MappedByteBuffer peekAtStorage; - private final MappedByteBuffer peekAtTransaction; - private final MappedByteBuffer prcEcmulXorMachineStateFlag; - private final MappedByteBuffer prcEcpairingXorMaxcsx; - private final MappedByteBuffer prcEcrecoverXorModFlag; - private final MappedByteBuffer prcFailureKnownToHubXorMulFlag; - private final MappedByteBuffer prcFailureKnownToRamXorMxpx; - private final MappedByteBuffer prcIdentityXorMxpFlag; - private final MappedByteBuffer prcModexpXorOogx; - private final MappedByteBuffer prcRipemd160XorOpcx; - private final MappedByteBuffer prcSha2256XorPushpopFlag; - private final MappedByteBuffer prcSuccessCallerWillRevertXorRdcx; - private final MappedByteBuffer prcSuccessCallerWontRevertXorShfFlag; - private final MappedByteBuffer priorityFeePerGas; - private final MappedByteBuffer programCounter; - private final MappedByteBuffer programCounterNew; - private final MappedByteBuffer refundCounter; - private final MappedByteBuffer refundCounterInfinity; - private final MappedByteBuffer refundCounterNew; - private final MappedByteBuffer refundEffective; - private final MappedByteBuffer relativeBlockNumber; - private final MappedByteBuffer returnAtCapacityXorMxpInst; - private final MappedByteBuffer returnAtOffsetXorOobInst; - private final MappedByteBuffer returnDataContextNumberXorStpGasStipend; - private final MappedByteBuffer returnDataOffsetXorStpInstruction; - private final MappedByteBuffer returnDataSize; - private final MappedByteBuffer returnExceptionXorSox; - private final MappedByteBuffer returnFromDeploymentEmptyCodeWillRevertXorSstorex; - private final MappedByteBuffer returnFromDeploymentEmptyCodeWontRevertXorStackramFlag; - private final MappedByteBuffer returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1; - private final MappedByteBuffer returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2; - private final MappedByteBuffer returnFromMessageCallWillTouchRamXorStackItemPop3; - private final MappedByteBuffer returnFromMessageCallWontTouchRamXorStackItemPop4; - private final MappedByteBuffer rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize; - private final MappedByteBuffer rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi; - private final MappedByteBuffer rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired; - private final MappedByteBuffer rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo; - private final MappedByteBuffer rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2; - private final MappedByteBuffer rlpaddrRecipe; - private final MappedByteBuffer rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3; - private final MappedByteBuffer rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4; - private final MappedByteBuffer romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag; - private final MappedByteBuffer selfdestructExceptionXorStaticx; - private final MappedByteBuffer selfdestructWillRevertXorStaticFlag; - private final MappedByteBuffer selfdestructWontRevertAlreadyMarkedXorStoFlag; - private final MappedByteBuffer selfdestructWontRevertNotYetMarkedXorSux; - private final MappedByteBuffer stackItemHeight2; - private final MappedByteBuffer stackItemHeight3; - private final MappedByteBuffer stackItemHeight4; - private final MappedByteBuffer stackItemStamp1; - private final MappedByteBuffer stackItemStamp2; - private final MappedByteBuffer stackItemStamp3; - private final MappedByteBuffer stackItemStamp4; - private final MappedByteBuffer stpGasHi; - private final MappedByteBuffer stpGasLo; - private final MappedByteBuffer stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover; - private final MappedByteBuffer stpValueHi; - private final MappedByteBuffer stpValueLo; - private final MappedByteBuffer subStamp; - private final MappedByteBuffer swapFlag; - private final MappedByteBuffer trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag; - private final MappedByteBuffer trmRawAddressHiXorMxpOffset1Lo; - private final MappedByteBuffer twoLineInstruction; - private final MappedByteBuffer txExec; - private final MappedByteBuffer txFinl; - private final MappedByteBuffer txInit; - private final MappedByteBuffer txSkip; - private final MappedByteBuffer txWarm; - private final MappedByteBuffer txnFlag; - private final MappedByteBuffer warmthNewXorPrcEcaddXorLogInfoFlag; - private final MappedByteBuffer warmthXorPrcBlake2FXorLogFlag; - private final MappedByteBuffer wcpFlag; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("hub.ABSOLUTE_TRANSACTION_NUMBER", 2, length)); - headers.add(new ColumnHeader("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD", 1, length)); - headers.add(new ColumnHeader("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT", 1, length)); - headers.add(new ColumnHeader("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2", 1, length)); - headers.add(new ColumnHeader("hub.ALPHA", 1, length)); - headers.add(new ColumnHeader("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE", 16, length)); - headers.add(new ColumnHeader("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("hub.CALL_DATA_OFFSET_xor_MMU_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID", 4, length)); - headers.add(new ColumnHeader("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1", 2, length)); - headers.add(new ColumnHeader("hub.CALLER_CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI", 4, length)); - headers.add(new ColumnHeader("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE", 16, length)); - headers.add(new ColumnHeader("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO", 16, length)); - headers.add(new ColumnHeader("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI", 16, length)); - headers.add(new ColumnHeader("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_GETS_REVERTED", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_MAY_CHANGE", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_REVERT_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.CONTEXT_SELF_REVERTS", 1, length)); - headers.add(new ColumnHeader("hub.CONTEXT_WILL_REVERT", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_NSR", 1, length)); - headers.add(new ColumnHeader("hub.COUNTER_TLI", 1, length)); - headers.add(new ColumnHeader("hub.DELTA", 1, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK", 2, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK", 2, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE", 4, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET", 4, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI", 4, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE", 1, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN", 1, length)); - headers.add(new ColumnHeader("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION", 1, length)); - headers.add(new ColumnHeader("hub.DOM_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.EXCEPTION_AHOY", 1, length)); - headers.add(new ColumnHeader("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF", 1, length)); - headers.add(new ColumnHeader("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK", 1, length)); - headers.add(new ColumnHeader("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN", 1, length)); - headers.add(new ColumnHeader("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES", 1, length)); - headers.add(new ColumnHeader("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG", 1, length)); - headers.add(new ColumnHeader("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO", 1, length)); - headers.add(new ColumnHeader("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR", 1, length)); - headers.add(new ColumnHeader("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG", 1, length)); - headers.add(new ColumnHeader("hub.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("hub.GAS_COST", 8, length)); - headers.add(new ColumnHeader("hub.GAS_EXPECTED", 8, length)); - headers.add(new ColumnHeader("hub.GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_NEXT", 8, length)); - headers.add(new ColumnHeader("hub.GAS_PRICE", 8, length)); - headers.add(new ColumnHeader("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO", 1, length)); - headers.add(new ColumnHeader("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO", 1, length)); - headers.add(new ColumnHeader("hub.HEIGHT", 2, length)); - headers.add(new ColumnHeader("hub.HEIGHT_NEW", 2, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.HUB_STAMP_TRANSACTION_END", 4, length)); - headers.add(new ColumnHeader("hub.INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH", 1, length)); - headers.add(new ColumnHeader("hub.LOG_INFO_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX", 1, length)); - headers.add(new ColumnHeader("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW", 1, length)); - headers.add(new ColumnHeader("hub.MMU_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_OFFSET_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_HI", 16, length)); - headers.add(new ColumnHeader("hub.MXP_SIZE_2_LO", 16, length)); - headers.add(new ColumnHeader("hub.MXP_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.MXP_WORDS", 16, length)); - headers.add(new ColumnHeader("hub.NON_STACK_ROWS", 1, length)); - headers.add(new ColumnHeader("hub.NONCE", 8, length)); - headers.add(new ColumnHeader("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE", 8, length)); - headers.add(new ColumnHeader("hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE", 8, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_1", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_2", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_3", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_4", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_5", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_6", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_7", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_8", 16, length)); - headers.add(new ColumnHeader("hub.OOB_DATA_9", 16, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_ACCOUNT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_CONTEXT", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_MISCELLANEOUS", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_SCENARIO", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STACK", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_STORAGE", 1, length)); - headers.add(new ColumnHeader("hub.PEEK_AT_TRANSACTION", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECPAIRING_xor_MAXCSX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_ECRECOVER_xor_MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_IDENTITY_xor_MXP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_MODEXP_xor_OOGX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_RIPEMD-160_xor_OPCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX", 1, length)); - headers.add(new ColumnHeader("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.PRIORITY_FEE_PER_GAS", 8, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.PROGRAM_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_INFINITY", 8, length)); - headers.add(new ColumnHeader("hub.REFUND_COUNTER_NEW", 4, length)); - headers.add(new ColumnHeader("hub.REFUND_EFFECTIVE", 8, length)); - headers.add(new ColumnHeader("hub.RELATIVE_BLOCK_NUMBER", 2, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_CAPACITY_xor_MXP_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_AT_OFFSET_xor_OOB_INST", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.RETURN_EXCEPTION_xor_SOX", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3", 1, length)); - headers.add(new ColumnHeader("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4", 1, length)); - headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE", 4, length)); - headers.add(new ColumnHeader("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED", 1, length)); - headers.add(new ColumnHeader("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_RECIPE", 1, length)); - headers.add(new ColumnHeader("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3", 16, length)); - headers.add(new ColumnHeader("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4", 16, length)); - headers.add(new ColumnHeader("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX", 1, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_2", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_3", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_HEIGHT_4", 2, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_1", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_2", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_3", 5, length)); - headers.add(new ColumnHeader("hub.STACK_ITEM_STAMP_4", 5, length)); - headers.add(new ColumnHeader("hub.STP_GAS_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_GAS_LO", 16, length)); - headers.add(new ColumnHeader("hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER", 8, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_HI", 16, length)); - headers.add(new ColumnHeader("hub.STP_VALUE_LO", 16, length)); - headers.add(new ColumnHeader("hub.SUB_STAMP", 4, length)); - headers.add(new ColumnHeader("hub.SWAP_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO", 16, length)); - headers.add(new ColumnHeader("hub.TWO_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("hub.TX_EXEC", 1, length)); - headers.add(new ColumnHeader("hub.TX_FINL", 1, length)); - headers.add(new ColumnHeader("hub.TX_INIT", 1, length)); - headers.add(new ColumnHeader("hub.TX_SKIP", 1, length)); - headers.add(new ColumnHeader("hub.TX_WARM", 1, length)); - headers.add(new ColumnHeader("hub.TXN_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG", 1, length)); - headers.add(new ColumnHeader("hub.WCP_FLAG", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.absoluteTransactionNumber = buffers.get(0); - this.addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize = buffers.get(1); - this.addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo = buffers.get(2); - this.againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd = buffers.get(3); - this.againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment = buffers.get(4); - this.againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2 = buffers.get(5); - this.alpha = buffers.get(6); - this.balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance = buffers.get(7); - this.balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo = buffers.get(8); - this.callDataOffsetXorMmuSize = buffers.get(9); - this.callDataSizeXorMmuSrcId = buffers.get(10); - this.callStackDepthXorStackItemHeight1 = buffers.get(11); - this.callerContextNumber = buffers.get(12); - this.codeFragmentIndex = buffers.get(13); - this.codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi = buffers.get(14); - this.codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue = buffers.get(15); - this.codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo = buffers.get(16); - this.codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo = buffers.get(17); - this.codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi = buffers.get(18); - this.codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize = buffers.get(19); - this.codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi = buffers.get(20); - this.contextGetsReverted = buffers.get(21); - this.contextMayChange = buffers.get(22); - this.contextNumber = buffers.get(23); - this.contextNumberNew = buffers.get(24); - this.contextNumberXorMmuTgtId = buffers.get(25); - this.contextRevertStamp = buffers.get(26); - this.contextSelfReverts = buffers.get(27); - this.contextWillRevert = buffers.get(28); - this.counterNsr = buffers.get(29); - this.counterTli = buffers.get(30); - this.delta = buffers.get(31); - this.deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock = buffers.get(32); - this.deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock = buffers.get(33); - this.deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase = buffers.get(34); - this.deploymentNumberNewXorCallerAddressHiXorMmuRefOffset = buffers.get(35); - this.deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi = buffers.get(36); - this.deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode = buffers.get(37); - this.deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn = buffers.get(38); - this.deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution = buffers.get(39); - this.domStamp = buffers.get(40); - this.exceptionAhoy = buffers.get(41); - this.existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf = buffers.get(42); - this.existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk = buffers.get(43); - this.finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn = buffers.get(44); - this.finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges = buffers.get(45); - this.finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig = buffers.get(46); - this.firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero = buffers.get(47); - this.firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr = buffers.get(48); - this.firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig = buffers.get(49); - this.gasActual = buffers.get(50); - this.gasCost = buffers.get(51); - this.gasExpected = buffers.get(52); - this.gasLimit = buffers.get(53); - this.gasNext = buffers.get(54); - this.gasPrice = buffers.get(55); - this.hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero = buffers.get(56); - this.hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero = buffers.get(57); - this.height = buffers.get(58); - this.heightNew = buffers.get(59); - this.hubStamp = buffers.get(60); - this.hubStampTransactionEnd = buffers.get(61); - this.instruction = buffers.get(62); - this.isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth = buffers.get(63); - this.logInfoStamp = buffers.get(64); - this.markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx = buffers.get(65); - this.markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew = buffers.get(66); - this.mmuStamp = buffers.get(67); - this.mxpOffset2Hi = buffers.get(68); - this.mxpOffset2Lo = buffers.get(69); - this.mxpSize1Hi = buffers.get(70); - this.mxpSize1Lo = buffers.get(71); - this.mxpSize2Hi = buffers.get(72); - this.mxpSize2Lo = buffers.get(73); - this.mxpStamp = buffers.get(74); - this.mxpWords = buffers.get(75); - this.nonStackRows = buffers.get(76); - this.nonce = buffers.get(77); - this.nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable = buffers.get(78); - this.nonceXorStpGasMxpXorPrcCalleeGasXorBasefee = buffers.get(79); - this.oobData1 = buffers.get(80); - this.oobData2 = buffers.get(81); - this.oobData3 = buffers.get(82); - this.oobData4 = buffers.get(83); - this.oobData5 = buffers.get(84); - this.oobData6 = buffers.get(85); - this.oobData7 = buffers.get(86); - this.oobData8 = buffers.get(87); - this.oobData9 = buffers.get(88); - this.peekAtAccount = buffers.get(89); - this.peekAtContext = buffers.get(90); - this.peekAtMiscellaneous = buffers.get(91); - this.peekAtScenario = buffers.get(92); - this.peekAtStack = buffers.get(93); - this.peekAtStorage = buffers.get(94); - this.peekAtTransaction = buffers.get(95); - this.prcEcmulXorMachineStateFlag = buffers.get(96); - this.prcEcpairingXorMaxcsx = buffers.get(97); - this.prcEcrecoverXorModFlag = buffers.get(98); - this.prcFailureKnownToHubXorMulFlag = buffers.get(99); - this.prcFailureKnownToRamXorMxpx = buffers.get(100); - this.prcIdentityXorMxpFlag = buffers.get(101); - this.prcModexpXorOogx = buffers.get(102); - this.prcRipemd160XorOpcx = buffers.get(103); - this.prcSha2256XorPushpopFlag = buffers.get(104); - this.prcSuccessCallerWillRevertXorRdcx = buffers.get(105); - this.prcSuccessCallerWontRevertXorShfFlag = buffers.get(106); - this.priorityFeePerGas = buffers.get(107); - this.programCounter = buffers.get(108); - this.programCounterNew = buffers.get(109); - this.refundCounter = buffers.get(110); - this.refundCounterInfinity = buffers.get(111); - this.refundCounterNew = buffers.get(112); - this.refundEffective = buffers.get(113); - this.relativeBlockNumber = buffers.get(114); - this.returnAtCapacityXorMxpInst = buffers.get(115); - this.returnAtOffsetXorOobInst = buffers.get(116); - this.returnDataContextNumberXorStpGasStipend = buffers.get(117); - this.returnDataOffsetXorStpInstruction = buffers.get(118); - this.returnDataSize = buffers.get(119); - this.returnExceptionXorSox = buffers.get(120); - this.returnFromDeploymentEmptyCodeWillRevertXorSstorex = buffers.get(121); - this.returnFromDeploymentEmptyCodeWontRevertXorStackramFlag = buffers.get(122); - this.returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1 = buffers.get(123); - this.returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2 = buffers.get(124); - this.returnFromMessageCallWillTouchRamXorStackItemPop3 = buffers.get(125); - this.returnFromMessageCallWontTouchRamXorStackItemPop4 = buffers.get(126); - this.rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize = buffers.get(127); - this.rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi = buffers.get(128); - this.rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired = buffers.get(129); - this.rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo = buffers.get(130); - this.rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2 = buffers.get(131); - this.rlpaddrRecipe = buffers.get(132); - this.rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3 = buffers.get(133); - this.rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4 = buffers.get(134); - this.romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag = buffers.get(135); - this.selfdestructExceptionXorStaticx = buffers.get(136); - this.selfdestructWillRevertXorStaticFlag = buffers.get(137); - this.selfdestructWontRevertAlreadyMarkedXorStoFlag = buffers.get(138); - this.selfdestructWontRevertNotYetMarkedXorSux = buffers.get(139); - this.stackItemHeight2 = buffers.get(140); - this.stackItemHeight3 = buffers.get(141); - this.stackItemHeight4 = buffers.get(142); - this.stackItemStamp1 = buffers.get(143); - this.stackItemStamp2 = buffers.get(144); - this.stackItemStamp3 = buffers.get(145); - this.stackItemStamp4 = buffers.get(146); - this.stpGasHi = buffers.get(147); - this.stpGasLo = buffers.get(148); - this.stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover = buffers.get(149); - this.stpValueHi = buffers.get(150); - this.stpValueLo = buffers.get(151); - this.subStamp = buffers.get(152); - this.swapFlag = buffers.get(153); - this.trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag = buffers.get(154); - this.trmRawAddressHiXorMxpOffset1Lo = buffers.get(155); - this.twoLineInstruction = buffers.get(156); - this.txExec = buffers.get(157); - this.txFinl = buffers.get(158); - this.txInit = buffers.get(159); - this.txSkip = buffers.get(160); - this.txWarm = buffers.get(161); - this.txnFlag = buffers.get(162); - this.warmthNewXorPrcEcaddXorLogInfoFlag = buffers.get(163); - this.warmthXorPrcBlake2FXorLogFlag = buffers.get(164); - this.wcpFlag = buffers.get(165); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absoluteTransactionNumber(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("hub.ABSOLUTE_TRANSACTION_NUMBER already set"); - } else { - filled.set(0); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.ABSOLUTE_TRANSACTION_NUMBER has invalid value (" + b + ")"); } - absoluteTransactionNumber.put((byte) (b >> 8)); - absoluteTransactionNumber.put((byte) b); - - - return this; - } - - public Trace callerContextNumber(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("hub.CALLER_CONTEXT_NUMBER already set"); - } else { - filled.set(1); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CALLER_CONTEXT_NUMBER has invalid value (" + b + ")"); } - callerContextNumber.put((byte) (b >> 24)); - callerContextNumber.put((byte) (b >> 16)); - callerContextNumber.put((byte) (b >> 8)); - callerContextNumber.put((byte) b); - - - return this; - } - - public Trace codeFragmentIndex(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX already set"); - } else { - filled.set(2); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndex.put((byte) (b >> 24)); - codeFragmentIndex.put((byte) (b >> 16)); - codeFragmentIndex.put((byte) (b >> 8)); - codeFragmentIndex.put((byte) b); - - - return this; - } - - public Trace contextGetsReverted(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("hub.CONTEXT_GETS_REVERTED already set"); - } else { - filled.set(3); - } - - contextGetsReverted.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace contextMayChange(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("hub.CONTEXT_MAY_CHANGE already set"); - } else { - filled.set(4); - } - - contextMayChange.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace contextNumber(final long b) { - if (filled.get(5)) { - throw new IllegalStateException("hub.CONTEXT_NUMBER already set"); - } else { - filled.set(5); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER has invalid value (" + b + ")"); } - contextNumber.put((byte) (b >> 24)); - contextNumber.put((byte) (b >> 16)); - contextNumber.put((byte) (b >> 8)); - contextNumber.put((byte) b); - - - return this; - } - - public Trace contextNumberNew(final long b) { - if (filled.get(6)) { - throw new IllegalStateException("hub.CONTEXT_NUMBER_NEW already set"); - } else { - filled.set(6); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_NUMBER_NEW has invalid value (" + b + ")"); } - contextNumberNew.put((byte) (b >> 24)); - contextNumberNew.put((byte) (b >> 16)); - contextNumberNew.put((byte) (b >> 8)); - contextNumberNew.put((byte) b); - - - return this; - } - - public Trace contextRevertStamp(final long b) { - if (filled.get(7)) { - throw new IllegalStateException("hub.CONTEXT_REVERT_STAMP already set"); - } else { - filled.set(7); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.CONTEXT_REVERT_STAMP has invalid value (" + b + ")"); } - contextRevertStamp.put((byte) (b >> 24)); - contextRevertStamp.put((byte) (b >> 16)); - contextRevertStamp.put((byte) (b >> 8)); - contextRevertStamp.put((byte) b); - - - return this; - } - - public Trace contextSelfReverts(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("hub.CONTEXT_SELF_REVERTS already set"); - } else { - filled.set(8); - } - - contextSelfReverts.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace contextWillRevert(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("hub.CONTEXT_WILL_REVERT already set"); - } else { - filled.set(9); - } - - contextWillRevert.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace counterNsr(final long b) { - if (filled.get(10)) { - throw new IllegalStateException("hub.COUNTER_NSR already set"); - } else { - filled.set(10); - } - - if(b >= 256L) { throw new IllegalArgumentException("hub.COUNTER_NSR has invalid value (" + b + ")"); } - counterNsr.put((byte) b); - - - return this; - } - - public Trace counterTli(final Boolean b) { - if (filled.get(11)) { - throw new IllegalStateException("hub.COUNTER_TLI already set"); - } else { - filled.set(11); - } - - counterTli.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace domStamp(final long b) { - if (filled.get(12)) { - throw new IllegalStateException("hub.DOM_STAMP already set"); - } else { - filled.set(12); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.DOM_STAMP has invalid value (" + b + ")"); } - domStamp.put((byte) (b >> 24)); - domStamp.put((byte) (b >> 16)); - domStamp.put((byte) (b >> 8)); - domStamp.put((byte) b); - - - return this; - } - - public Trace exceptionAhoy(final Boolean b) { - if (filled.get(13)) { - throw new IllegalStateException("hub.EXCEPTION_AHOY already set"); - } else { - filled.set(13); - } - - exceptionAhoy.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace gasActual(final Bytes b) { - if (filled.get(14)) { - throw new IllegalStateException("hub.GAS_ACTUAL already set"); - } else { - filled.set(14); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasCost.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.GAS_EXPECTED has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasExpected.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.GAS_NEXT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasNext.put((byte) 0); } - // Write bytes - for(int j=0; j= 2048L) { throw new IllegalArgumentException("hub.HEIGHT has invalid value (" + b + ")"); } - height.put((byte) (b >> 8)); - height.put((byte) b); - - - return this; - } - - public Trace heightNew(final long b) { - if (filled.get(19)) { - throw new IllegalStateException("hub.HEIGHT_NEW already set"); - } else { - filled.set(19); - } - - if(b >= 2048L) { throw new IllegalArgumentException("hub.HEIGHT_NEW has invalid value (" + b + ")"); } - heightNew.put((byte) (b >> 8)); - heightNew.put((byte) b); - - - return this; - } - - public Trace hubStamp(final long b) { - if (filled.get(20)) { - throw new IllegalStateException("hub.HUB_STAMP already set"); - } else { - filled.set(20); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP has invalid value (" + b + ")"); } - hubStamp.put((byte) (b >> 24)); - hubStamp.put((byte) (b >> 16)); - hubStamp.put((byte) (b >> 8)); - hubStamp.put((byte) b); - - - return this; - } - - public Trace hubStampTransactionEnd(final long b) { - if (filled.get(21)) { - throw new IllegalStateException("hub.HUB_STAMP_TRANSACTION_END already set"); - } else { - filled.set(21); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.HUB_STAMP_TRANSACTION_END has invalid value (" + b + ")"); } - hubStampTransactionEnd.put((byte) (b >> 24)); - hubStampTransactionEnd.put((byte) (b >> 16)); - hubStampTransactionEnd.put((byte) (b >> 8)); - hubStampTransactionEnd.put((byte) b); - - - return this; - } - - public Trace logInfoStamp(final long b) { - if (filled.get(22)) { - throw new IllegalStateException("hub.LOG_INFO_STAMP already set"); - } else { - filled.set(22); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.LOG_INFO_STAMP has invalid value (" + b + ")"); } - logInfoStamp.put((byte) (b >> 24)); - logInfoStamp.put((byte) (b >> 16)); - logInfoStamp.put((byte) (b >> 8)); - logInfoStamp.put((byte) b); - - - return this; - } - - public Trace mmuStamp(final long b) { - if (filled.get(23)) { - throw new IllegalStateException("hub.MMU_STAMP already set"); - } else { - filled.set(23); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MMU_STAMP has invalid value (" + b + ")"); } - mmuStamp.put((byte) (b >> 24)); - mmuStamp.put((byte) (b >> 16)); - mmuStamp.put((byte) (b >> 8)); - mmuStamp.put((byte) b); - - - return this; - } - - public Trace mxpStamp(final long b) { - if (filled.get(24)) { - throw new IllegalStateException("hub.MXP_STAMP already set"); - } else { - filled.set(24); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.MXP_STAMP has invalid value (" + b + ")"); } - mxpStamp.put((byte) (b >> 24)); - mxpStamp.put((byte) (b >> 16)); - mxpStamp.put((byte) (b >> 8)); - mxpStamp.put((byte) b); - - - return this; - } - - public Trace nonStackRows(final long b) { - if (filled.get(25)) { - throw new IllegalStateException("hub.NON_STACK_ROWS already set"); - } else { - filled.set(25); - } - - if(b >= 256L) { throw new IllegalArgumentException("hub.NON_STACK_ROWS has invalid value (" + b + ")"); } - nonStackRows.put((byte) b); - - - return this; - } - - public Trace pAccountAddressHi(final long b) { - if (filled.get(104)) { - throw new IllegalStateException("hub.account/ADDRESS_HI already set"); - } else { - filled.set(104); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/ADDRESS_HI has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pAccountAddressLo(final Bytes b) { - if (filled.get(133)) { - throw new IllegalStateException("hub.account/ADDRESS_LO already set"); - } else { - filled.set(133); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/BALANCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/BALANCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pAccountCodeHashHi(final Bytes b) { - if (filled.get(136)) { - throw new IllegalStateException("hub.account/CODE_HASH_HI already set"); - } else { - filled.set(136); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_HI_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/CODE_HASH_LO_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pAccountCodeSizeNew(final long b) { - if (filled.get(107)) { - throw new IllegalStateException("hub.account/CODE_SIZE_NEW already set"); - } else { - filled.set(107); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/CODE_SIZE_NEW has invalid value (" + b + ")"); } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentNumber(final long b) { - if (filled.get(108)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER already set"); - } else { - filled.set(108); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentNumberFinalInBlock(final long b) { - if (filled.get(102)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); - } else { - filled.set(102); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentNumberFirstInBlock(final long b) { - if (filled.get(103)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); - } else { - filled.set(103); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentNumberInfty(final long b) { - if (filled.get(109)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_INFTY already set"); - } else { - filled.set(109); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentNumberNew(final long b) { - if (filled.get(110)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_NUMBER_NEW already set"); - } else { - filled.set(110); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.account/DEPLOYMENT_NUMBER_NEW has invalid value (" + b + ")"); } - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); - - - return this; - } - - public Trace pAccountDeploymentStatus(final Boolean b) { - if (filled.get(48)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_STATUS already set"); - } else { - filled.set(48); - } - - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountDeploymentStatusInfty(final Boolean b) { - if (filled.get(49)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_STATUS_INFTY already set"); - } else { - filled.set(49); - } - - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountDeploymentStatusNew(final Boolean b) { - if (filled.get(50)) { - throw new IllegalStateException("hub.account/DEPLOYMENT_STATUS_NEW already set"); - } else { - filled.set(50); - } - - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountExists(final Boolean b) { - if (filled.get(51)) { - throw new IllegalStateException("hub.account/EXISTS already set"); - } else { - filled.set(51); - } - - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountExistsNew(final Boolean b) { - if (filled.get(52)) { - throw new IllegalStateException("hub.account/EXISTS_NEW already set"); - } else { - filled.set(52); - } - - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFinalInBlk(final Boolean b) { - if (filled.get(53)) { - throw new IllegalStateException("hub.account/FINAL_IN_BLK already set"); - } else { - filled.set(53); - } - - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFinalInCnf(final Boolean b) { - if (filled.get(54)) { - throw new IllegalStateException("hub.account/FINAL_IN_CNF already set"); - } else { - filled.set(54); - } - - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFinalInTxn(final Boolean b) { - if (filled.get(55)) { - throw new IllegalStateException("hub.account/FINAL_IN_TXN already set"); - } else { - filled.set(55); - } - - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFirstInBlk(final Boolean b) { - if (filled.get(56)) { - throw new IllegalStateException("hub.account/FIRST_IN_BLK already set"); - } else { - filled.set(56); - } - - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFirstInCnf(final Boolean b) { - if (filled.get(57)) { - throw new IllegalStateException("hub.account/FIRST_IN_CNF already set"); - } else { - filled.set(57); - } - - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountFirstInTxn(final Boolean b) { - if (filled.get(58)) { - throw new IllegalStateException("hub.account/FIRST_IN_TXN already set"); - } else { - filled.set(58); - } - - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountHasCode(final Boolean b) { - if (filled.get(59)) { - throw new IllegalStateException("hub.account/HAS_CODE already set"); - } else { - filled.set(59); - } - - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountHasCodeNew(final Boolean b) { - if (filled.get(60)) { - throw new IllegalStateException("hub.account/HAS_CODE_NEW already set"); - } else { - filled.set(60); - } - - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountIsPrecompile(final Boolean b) { - if (filled.get(61)) { - throw new IllegalStateException("hub.account/IS_PRECOMPILE already set"); - } else { - filled.set(61); - } - - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountMarkedForSelfdestruct(final Boolean b) { - if (filled.get(62)) { - throw new IllegalStateException("hub.account/MARKED_FOR_SELFDESTRUCT already set"); - } else { - filled.set(62); - } - - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountMarkedForSelfdestructNew(final Boolean b) { - if (filled.get(63)) { - throw new IllegalStateException("hub.account/MARKED_FOR_SELFDESTRUCT_NEW already set"); - } else { - filled.set(63); - } - - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pAccountNonce(final Bytes b) { - if (filled.get(124)) { - throw new IllegalStateException("hub.account/NONCE already set"); - } else { - filled.set(124); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.account/NONCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.account/NONCE_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_HI has invalid value (" + b + ")"); } - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); - - - return this; - } - - public Trace pAccountRlpaddrDepAddrLo(final Bytes b) { - if (filled.get(140)) { - throw new IllegalStateException("hub.account/RLPADDR_DEP_ADDR_LO already set"); - } else { - filled.set(140); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/RLPADDR_KEC_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("hub.account/RLPADDR_RECIPE has invalid value (" + b + ")"); } - rlpaddrRecipe.put((byte) b); - - - return this; - } - - public Trace pAccountRlpaddrSaltHi(final Bytes b) { - if (filled.get(143)) { - throw new IllegalStateException("hub.account/RLPADDR_SALT_HI already set"); - } else { - filled.set(143); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/RLPADDR_SALT_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.account/TRM_RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_HI has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pContextAccountAddressLo(final Bytes b) { - if (filled.get(133)) { - throw new IllegalStateException("hub.context/ACCOUNT_ADDRESS_LO already set"); - } else { - filled.set(133); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/ACCOUNT_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.context/ACCOUNT_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pContextByteCodeAddressHi(final long b) { - if (filled.get(106)) { - throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_HI already set"); - } else { - filled.set(106); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_HI has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pContextByteCodeAddressLo(final Bytes b) { - if (filled.get(134)) { - throw new IllegalStateException("hub.context/BYTE_CODE_ADDRESS_LO already set"); - } else { - filled.set(134); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/BYTE_CODE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); - - - return this; - } - - public Trace pContextByteCodeDeploymentNumber(final long b) { - if (filled.get(108)) { - throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER already set"); - } else { - filled.set(108); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); - - - return this; - } - - public Trace pContextByteCodeDeploymentStatus(final long b) { - if (filled.get(109)) { - throw new IllegalStateException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS already set"); - } else { - filled.set(109); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/BYTE_CODE_DEPLOYMENT_STATUS has invalid value (" + b + ")"); } - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); - - - return this; - } - - public Trace pContextCallDataContextNumber(final long b) { - if (filled.get(111)) { - throw new IllegalStateException("hub.context/CALL_DATA_CONTEXT_NUMBER already set"); - } else { - filled.set(111); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); - - - return this; - } - - public Trace pContextCallDataOffset(final long b) { - if (filled.get(112)) { - throw new IllegalStateException("hub.context/CALL_DATA_OFFSET already set"); - } else { - filled.set(112); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_OFFSET has invalid value (" + b + ")"); } - callDataOffsetXorMmuSize.put((byte) (b >> 24)); - callDataOffsetXorMmuSize.put((byte) (b >> 16)); - callDataOffsetXorMmuSize.put((byte) (b >> 8)); - callDataOffsetXorMmuSize.put((byte) b); - - - return this; - } - - public Trace pContextCallDataSize(final long b) { - if (filled.get(113)) { - throw new IllegalStateException("hub.context/CALL_DATA_SIZE already set"); - } else { - filled.set(113); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/CALL_DATA_SIZE has invalid value (" + b + ")"); } - callDataSizeXorMmuSrcId.put((byte) (b >> 24)); - callDataSizeXorMmuSrcId.put((byte) (b >> 16)); - callDataSizeXorMmuSrcId.put((byte) (b >> 8)); - callDataSizeXorMmuSrcId.put((byte) b); - - - return this; - } - - public Trace pContextCallStackDepth(final long b) { - if (filled.get(98)) { - throw new IllegalStateException("hub.context/CALL_STACK_DEPTH already set"); - } else { - filled.set(98); - } - - if(b >= 2048L) { throw new IllegalArgumentException("hub.context/CALL_STACK_DEPTH has invalid value (" + b + ")"); } - callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); - callStackDepthXorStackItemHeight1.put((byte) b); - - - return this; - } - - public Trace pContextCallValue(final Bytes b) { - if (filled.get(136)) { - throw new IllegalStateException("hub.context/CALL_VALUE already set"); - } else { - filled.set(136); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALL_VALUE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_HI has invalid value (" + b + ")"); } - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); - - - return this; - } - - public Trace pContextCallerAddressLo(final Bytes b) { - if (filled.get(135)) { - throw new IllegalStateException("hub.context/CALLER_ADDRESS_LO already set"); - } else { - filled.set(135); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.context/CALLER_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.context/CONTEXT_NUMBER has invalid value (" + b + ")"); } - contextNumberXorMmuTgtId.put((byte) (b >> 24)); - contextNumberXorMmuTgtId.put((byte) (b >> 16)); - contextNumberXorMmuTgtId.put((byte) (b >> 8)); - contextNumberXorMmuTgtId.put((byte) b); - - - return this; - } - - public Trace pContextIsRoot(final Boolean b) { - if (filled.get(45)) { - throw new IllegalStateException("hub.context/IS_ROOT already set"); - } else { - filled.set(45); - } - - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pContextIsStatic(final Boolean b) { - if (filled.get(46)) { - throw new IllegalStateException("hub.context/IS_STATIC already set"); - } else { - filled.set(46); - } - - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pContextReturnAtCapacity(final long b) { - if (filled.get(115)) { - throw new IllegalStateException("hub.context/RETURN_AT_CAPACITY already set"); - } else { - filled.set(115); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_CAPACITY has invalid value (" + b + ")"); } - returnAtCapacityXorMxpInst.put((byte) (b >> 24)); - returnAtCapacityXorMxpInst.put((byte) (b >> 16)); - returnAtCapacityXorMxpInst.put((byte) (b >> 8)); - returnAtCapacityXorMxpInst.put((byte) b); - - - return this; - } - - public Trace pContextReturnAtOffset(final long b) { - if (filled.get(116)) { - throw new IllegalStateException("hub.context/RETURN_AT_OFFSET already set"); - } else { - filled.set(116); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_AT_OFFSET has invalid value (" + b + ")"); } - returnAtOffsetXorOobInst.put((byte) (b >> 24)); - returnAtOffsetXorOobInst.put((byte) (b >> 16)); - returnAtOffsetXorOobInst.put((byte) (b >> 8)); - returnAtOffsetXorOobInst.put((byte) b); - - - return this; - } - - public Trace pContextReturnDataContextNumber(final long b) { - if (filled.get(117)) { - throw new IllegalStateException("hub.context/RETURN_DATA_CONTEXT_NUMBER already set"); - } else { - filled.set(117); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_CONTEXT_NUMBER has invalid value (" + b + ")"); } - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); - returnDataContextNumberXorStpGasStipend.put((byte) b); - - - return this; - } - - public Trace pContextReturnDataOffset(final long b) { - if (filled.get(118)) { - throw new IllegalStateException("hub.context/RETURN_DATA_OFFSET already set"); - } else { - filled.set(118); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_OFFSET has invalid value (" + b + ")"); } - returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); - returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); - returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); - returnDataOffsetXorStpInstruction.put((byte) b); - - - return this; - } - - public Trace pContextReturnDataSize(final long b) { - if (filled.get(119)) { - throw new IllegalStateException("hub.context/RETURN_DATA_SIZE already set"); - } else { - filled.set(119); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.context/RETURN_DATA_SIZE has invalid value (" + b + ")"); } - returnDataSize.put((byte) (b >> 24)); - returnDataSize.put((byte) (b >> 16)); - returnDataSize.put((byte) (b >> 8)); - returnDataSize.put((byte) b); - - - return this; - } - - public Trace pContextUpdate(final Boolean b) { - if (filled.get(47)) { - throw new IllegalStateException("hub.context/UPDATE already set"); - } else { - filled.set(47); - } - - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscCcrsStamp(final long b) { - if (filled.get(104)) { - throw new IllegalStateException("hub.misc/CCRS_STAMP already set"); - } else { - filled.set(104); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/CCRS_STAMP has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pMiscCcsrFlag(final Boolean b) { - if (filled.get(45)) { - throw new IllegalStateException("hub.misc/CCSR_FLAG already set"); - } else { - filled.set(45); - } - - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscExpData1(final Bytes b) { - if (filled.get(133)) { - throw new IllegalStateException("hub.misc/EXP_DATA_1 already set"); - } else { - filled.set(133); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/EXP_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/EXP_INST has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pMiscMmuAuxId(final long b) { - if (filled.get(106)) { - throw new IllegalStateException("hub.misc/MMU_AUX_ID already set"); - } else { - filled.set(106); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_AUX_ID has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pMiscMmuExoSum(final long b) { - if (filled.get(107)) { - throw new IllegalStateException("hub.misc/MMU_EXO_SUM already set"); - } else { - filled.set(107); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_EXO_SUM has invalid value (" + b + ")"); } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); - - - return this; - } - - public Trace pMiscMmuFlag(final Boolean b) { - if (filled.get(47)) { - throw new IllegalStateException("hub.misc/MMU_FLAG already set"); - } else { - filled.set(47); - } - - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscMmuInst(final long b) { - if (filled.get(108)) { - throw new IllegalStateException("hub.misc/MMU_INST already set"); - } else { - filled.set(108); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_INST has invalid value (" + b + ")"); } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); - - - return this; - } - - public Trace pMiscMmuLimb1(final Bytes b) { - if (filled.get(138)) { - throw new IllegalStateException("hub.misc/MMU_LIMB_1 already set"); - } else { - filled.set(138); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MMU_LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_PHASE has invalid value (" + b + ")"); } - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 24)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 16)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) (b >> 8)); - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.put((byte) b); - - - return this; - } - - public Trace pMiscMmuRefOffset(final long b) { - if (filled.get(110)) { - throw new IllegalStateException("hub.misc/MMU_REF_OFFSET already set"); - } else { - filled.set(110); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_OFFSET has invalid value (" + b + ")"); } - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 24)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 16)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) (b >> 8)); - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.put((byte) b); - - - return this; - } - - public Trace pMiscMmuRefSize(final long b) { - if (filled.get(111)) { - throw new IllegalStateException("hub.misc/MMU_REF_SIZE already set"); - } else { - filled.set(111); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_REF_SIZE has invalid value (" + b + ")"); } - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 24)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 16)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) (b >> 8)); - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.put((byte) b); - - - return this; - } - - public Trace pMiscMmuSize(final long b) { - if (filled.get(112)) { - throw new IllegalStateException("hub.misc/MMU_SIZE already set"); - } else { - filled.set(112); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SIZE has invalid value (" + b + ")"); } - callDataOffsetXorMmuSize.put((byte) (b >> 24)); - callDataOffsetXorMmuSize.put((byte) (b >> 16)); - callDataOffsetXorMmuSize.put((byte) (b >> 8)); - callDataOffsetXorMmuSize.put((byte) b); - - - return this; - } - - public Trace pMiscMmuSrcId(final long b) { - if (filled.get(113)) { - throw new IllegalStateException("hub.misc/MMU_SRC_ID already set"); - } else { - filled.set(113); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_SRC_ID has invalid value (" + b + ")"); } - callDataSizeXorMmuSrcId.put((byte) (b >> 24)); - callDataSizeXorMmuSrcId.put((byte) (b >> 16)); - callDataSizeXorMmuSrcId.put((byte) (b >> 8)); - callDataSizeXorMmuSrcId.put((byte) b); - - - return this; - } - - public Trace pMiscMmuSrcOffsetHi(final Bytes b) { - if (filled.get(140)) { - throw new IllegalStateException("hub.misc/MMU_SRC_OFFSET_HI already set"); - } else { - filled.set(140); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MMU_SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/MMU_TGT_ID has invalid value (" + b + ")"); } - contextNumberXorMmuTgtId.put((byte) (b >> 24)); - contextNumberXorMmuTgtId.put((byte) (b >> 16)); - contextNumberXorMmuTgtId.put((byte) (b >> 8)); - contextNumberXorMmuTgtId.put((byte) b); - - - return this; - } - - public Trace pMiscMmuTgtOffsetLo(final Bytes b) { - if (filled.get(142)) { - throw new IllegalStateException("hub.misc/MMU_TGT_OFFSET_LO already set"); - } else { - filled.set(142); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MMU_TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/MXP_INST has invalid value (" + b + ")"); } - returnAtCapacityXorMxpInst.put((byte) (b >> 24)); - returnAtCapacityXorMxpInst.put((byte) (b >> 16)); - returnAtCapacityXorMxpInst.put((byte) (b >> 8)); - returnAtCapacityXorMxpInst.put((byte) b); - - - return this; - } - - public Trace pMiscMxpMtntop(final Boolean b) { - if (filled.get(51)) { - throw new IllegalStateException("hub.misc/MXP_MTNTOP already set"); - } else { - filled.set(51); - } - - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscMxpMxpx(final Boolean b) { - if (filled.get(52)) { - throw new IllegalStateException("hub.misc/MXP_MXPX already set"); - } else { - filled.set(52); - } - - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscMxpOffset1Hi(final Bytes b) { - if (filled.get(144)) { - throw new IllegalStateException("hub.misc/MXP_OFFSET_1_HI already set"); - } else { - filled.set(144); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { trmRawAddressHiXorMxpOffset1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpOffset2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpOffset2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpSize1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpSize1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpSize2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpSize2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/MXP_WORDS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { mxpWords.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData5.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData6.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_7 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData7.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_8 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData8.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/OOB_DATA_9 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { oobData9.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/OOB_INST has invalid value (" + b + ")"); } - returnAtOffsetXorOobInst.put((byte) (b >> 24)); - returnAtOffsetXorOobInst.put((byte) (b >> 16)); - returnAtOffsetXorOobInst.put((byte) (b >> 8)); - returnAtOffsetXorOobInst.put((byte) b); - - - return this; - } - - public Trace pMiscStpExists(final Boolean b) { - if (filled.get(56)) { - throw new IllegalStateException("hub.misc/STP_EXISTS already set"); - } else { - filled.set(56); - } - - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscStpFlag(final Boolean b) { - if (filled.get(57)) { - throw new IllegalStateException("hub.misc/STP_FLAG already set"); - } else { - filled.set(57); - } - - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscStpGasHi(final Bytes b) { - if (filled.get(162)) { - throw new IllegalStateException("hub.misc/STP_GAS_HI already set"); - } else { - filled.set(162); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { stpGasHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/STP_GAS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { stpGasLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_PAID_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_GAS_STIPEND has invalid value (" + b + ")"); } - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 24)); - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 16)); - returnDataContextNumberXorStpGasStipend.put((byte) (b >> 8)); - returnDataContextNumberXorStpGasStipend.put((byte) b); - - - return this; - } - - public Trace pMiscStpGasUpfrontGasCost(final Bytes b) { - if (filled.get(126)) { - throw new IllegalStateException("hub.misc/STP_GAS_UPFRONT_GAS_COST already set"); - } else { - filled.set(126); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.misc/STP_GAS_UPFRONT_GAS_COST has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.misc/STP_INSTRUCTION has invalid value (" + b + ")"); } - returnDataOffsetXorStpInstruction.put((byte) (b >> 24)); - returnDataOffsetXorStpInstruction.put((byte) (b >> 16)); - returnDataOffsetXorStpInstruction.put((byte) (b >> 8)); - returnDataOffsetXorStpInstruction.put((byte) b); - - - return this; - } - - public Trace pMiscStpOogx(final Boolean b) { - if (filled.get(58)) { - throw new IllegalStateException("hub.misc/STP_OOGX already set"); - } else { - filled.set(58); - } - - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pMiscStpValueHi(final Bytes b) { - if (filled.get(164)) { - throw new IllegalStateException("hub.misc/STP_VALUE_HI already set"); - } else { - filled.set(164); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { stpValueHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.misc/STP_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { stpValueLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.scenario/PRC_CALLEE_GAS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.scenario/PRC_CALLER_GAS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDO has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pScenarioPrcCds(final long b) { - if (filled.get(105)) { - throw new IllegalStateException("hub.scenario/PRC_CDS already set"); - } else { - filled.set(105); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_CDS has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pScenarioPrcEcadd(final Boolean b) { - if (filled.get(68)) { - throw new IllegalStateException("hub.scenario/PRC_ECADD already set"); - } else { - filled.set(68); - } - - warmthNewXorPrcEcaddXorLogInfoFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcEcmul(final Boolean b) { - if (filled.get(69)) { - throw new IllegalStateException("hub.scenario/PRC_ECMUL already set"); - } else { - filled.set(69); - } - - prcEcmulXorMachineStateFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcEcpairing(final Boolean b) { - if (filled.get(70)) { - throw new IllegalStateException("hub.scenario/PRC_ECPAIRING already set"); - } else { - filled.set(70); - } - - prcEcpairingXorMaxcsx.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcEcrecover(final Boolean b) { - if (filled.get(71)) { - throw new IllegalStateException("hub.scenario/PRC_ECRECOVER already set"); - } else { - filled.set(71); - } - - prcEcrecoverXorModFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcFailureKnownToHub(final Boolean b) { - if (filled.get(72)) { - throw new IllegalStateException("hub.scenario/PRC_FAILURE_KNOWN_TO_HUB already set"); - } else { - filled.set(72); - } - - prcFailureKnownToHubXorMulFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcFailureKnownToRam(final Boolean b) { - if (filled.get(73)) { - throw new IllegalStateException("hub.scenario/PRC_FAILURE_KNOWN_TO_RAM already set"); - } else { - filled.set(73); - } - - prcFailureKnownToRamXorMxpx.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcIdentity(final Boolean b) { - if (filled.get(74)) { - throw new IllegalStateException("hub.scenario/PRC_IDENTITY already set"); - } else { - filled.set(74); - } - - prcIdentityXorMxpFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcModexp(final Boolean b) { - if (filled.get(75)) { - throw new IllegalStateException("hub.scenario/PRC_MODEXP already set"); - } else { - filled.set(75); - } - - prcModexpXorOogx.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pScenarioPrcRac(final long b) { - if (filled.get(106)) { - throw new IllegalStateException("hub.scenario/PRC_RAC already set"); - } else { - filled.set(106); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAC has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pScenarioPrcRao(final long b) { - if (filled.get(107)) { - throw new IllegalStateException("hub.scenario/PRC_RAO already set"); - } else { - filled.set(107); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.scenario/PRC_RAO has invalid value (" + b + ")"); } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); - - - return this; - } - - public Trace pScenarioPrcReturnGas(final Bytes b) { - if (filled.get(126)) { - throw new IllegalStateException("hub.scenario/PRC_RETURN_GAS already set"); - } else { - filled.set(126); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("hub.scenario/PRC_RETURN_GAS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/HASH_INFO_KECCAK_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_1 has invalid value (" + b + ")"); } - callStackDepthXorStackItemHeight1.put((byte) (b >> 8)); - callStackDepthXorStackItemHeight1.put((byte) b); - - - return this; - } - - public Trace pStackStackItemHeight2(final long b) { - if (filled.get(99)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_2 already set"); - } else { - filled.set(99); - } - - if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_2 has invalid value (" + b + ")"); } - stackItemHeight2.put((byte) (b >> 8)); - stackItemHeight2.put((byte) b); - - - return this; - } - - public Trace pStackStackItemHeight3(final long b) { - if (filled.get(100)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_3 already set"); - } else { - filled.set(100); - } - - if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_3 has invalid value (" + b + ")"); } - stackItemHeight3.put((byte) (b >> 8)); - stackItemHeight3.put((byte) b); - - - return this; - } - - public Trace pStackStackItemHeight4(final long b) { - if (filled.get(101)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_HEIGHT_4 already set"); - } else { - filled.set(101); - } - - if(b >= 2048L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_HEIGHT_4 has invalid value (" + b + ")"); } - stackItemHeight4.put((byte) (b >> 8)); - stackItemHeight4.put((byte) b); - - - return this; - } - - public Trace pStackStackItemPop1(final Boolean b) { - if (filled.get(83)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_POP_1 already set"); - } else { - filled.set(83); - } - - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackStackItemPop2(final Boolean b) { - if (filled.get(84)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_POP_2 already set"); - } else { - filled.set(84); - } - - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackStackItemPop3(final Boolean b) { - if (filled.get(85)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_POP_3 already set"); - } else { - filled.set(85); - } - - returnFromMessageCallWillTouchRamXorStackItemPop3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackStackItemPop4(final Boolean b) { - if (filled.get(86)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_POP_4 already set"); - } else { - filled.set(86); - } - - returnFromMessageCallWontTouchRamXorStackItemPop4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackStackItemStamp1(final long b) { - if (filled.get(120)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_1 already set"); - } else { - filled.set(120); - } - - if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_1 has invalid value (" + b + ")"); } - stackItemStamp1.put((byte) (b >> 32)); - stackItemStamp1.put((byte) (b >> 24)); - stackItemStamp1.put((byte) (b >> 16)); - stackItemStamp1.put((byte) (b >> 8)); - stackItemStamp1.put((byte) b); - - - return this; - } - - public Trace pStackStackItemStamp2(final long b) { - if (filled.get(121)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_2 already set"); - } else { - filled.set(121); - } - - if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_2 has invalid value (" + b + ")"); } - stackItemStamp2.put((byte) (b >> 32)); - stackItemStamp2.put((byte) (b >> 24)); - stackItemStamp2.put((byte) (b >> 16)); - stackItemStamp2.put((byte) (b >> 8)); - stackItemStamp2.put((byte) b); - - - return this; - } - - public Trace pStackStackItemStamp3(final long b) { - if (filled.get(122)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_3 already set"); - } else { - filled.set(122); - } - - if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_3 has invalid value (" + b + ")"); } - stackItemStamp3.put((byte) (b >> 32)); - stackItemStamp3.put((byte) (b >> 24)); - stackItemStamp3.put((byte) (b >> 16)); - stackItemStamp3.put((byte) (b >> 8)); - stackItemStamp3.put((byte) b); - - - return this; - } - - public Trace pStackStackItemStamp4(final long b) { - if (filled.get(123)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_STAMP_4 already set"); - } else { - filled.set(123); - } - - if(b >= 68719476736L) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_STAMP_4 has invalid value (" + b + ")"); } - stackItemStamp4.put((byte) (b >> 32)); - stackItemStamp4.put((byte) (b >> 24)); - stackItemStamp4.put((byte) (b >> 16)); - stackItemStamp4.put((byte) (b >> 8)); - stackItemStamp4.put((byte) b); - - - return this; - } - - public Trace pStackStackItemValueHi1(final Bytes b) { - if (filled.get(137)) { - throw new IllegalStateException("hub.stack/STACK_ITEM_VALUE_HI_1 already set"); - } else { - filled.set(137); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_HI_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.stack/STACK_ITEM_VALUE_LO_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.stack/STATIC_GAS has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pStackStaticx(final Boolean b) { - if (filled.get(87)) { - throw new IllegalStateException("hub.stack/STATICX already set"); - } else { - filled.set(87); - } - - selfdestructExceptionXorStaticx.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackStoFlag(final Boolean b) { - if (filled.get(89)) { - throw new IllegalStateException("hub.stack/STO_FLAG already set"); - } else { - filled.set(89); - } - - selfdestructWontRevertAlreadyMarkedXorStoFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackSux(final Boolean b) { - if (filled.get(90)) { - throw new IllegalStateException("hub.stack/SUX already set"); - } else { - filled.set(90); - } - - selfdestructWontRevertNotYetMarkedXorSux.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackSwapFlag(final Boolean b) { - if (filled.get(91)) { - throw new IllegalStateException("hub.stack/SWAP_FLAG already set"); - } else { - filled.set(91); - } - - swapFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackTxnFlag(final Boolean b) { - if (filled.get(92)) { - throw new IllegalStateException("hub.stack/TXN_FLAG already set"); - } else { - filled.set(92); - } - - txnFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStackWcpFlag(final Boolean b) { - if (filled.get(93)) { - throw new IllegalStateException("hub.stack/WCP_FLAG already set"); - } else { - filled.set(93); - } - - wcpFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageAddressHi(final long b) { - if (filled.get(104)) { - throw new IllegalStateException("hub.storage/ADDRESS_HI already set"); - } else { - filled.set(104); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/ADDRESS_HI has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pStorageAddressLo(final Bytes b) { - if (filled.get(133)) { - throw new IllegalStateException("hub.storage/ADDRESS_LO already set"); - } else { - filled.set(133); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pStorageDeploymentNumberFinalInBlock(final long b) { - if (filled.get(102)) { - throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK already set"); - } else { - filled.set(102); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has invalid value (" + b + ")"); } - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) (b >> 8)); - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.put((byte) b); - - - return this; - } - - public Trace pStorageDeploymentNumberFirstInBlock(final long b) { - if (filled.get(103)) { - throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK already set"); - } else { - filled.set(103); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has invalid value (" + b + ")"); } - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) (b >> 8)); - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.put((byte) b); - - - return this; - } - - public Trace pStorageDeploymentNumberInfty(final long b) { - if (filled.get(106)) { - throw new IllegalStateException("hub.storage/DEPLOYMENT_NUMBER_INFTY already set"); - } else { - filled.set(106); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.storage/DEPLOYMENT_NUMBER_INFTY has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pStorageFinalInBlk(final Boolean b) { - if (filled.get(48)) { - throw new IllegalStateException("hub.storage/FINAL_IN_BLK already set"); - } else { - filled.set(48); - } - - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageFinalInCnf(final Boolean b) { - if (filled.get(49)) { - throw new IllegalStateException("hub.storage/FINAL_IN_CNF already set"); - } else { - filled.set(49); - } - - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageFinalInTxn(final Boolean b) { - if (filled.get(50)) { - throw new IllegalStateException("hub.storage/FINAL_IN_TXN already set"); - } else { - filled.set(50); - } - - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageFirstInBlk(final Boolean b) { - if (filled.get(51)) { - throw new IllegalStateException("hub.storage/FIRST_IN_BLK already set"); - } else { - filled.set(51); - } - - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageFirstInCnf(final Boolean b) { - if (filled.get(52)) { - throw new IllegalStateException("hub.storage/FIRST_IN_CNF already set"); - } else { - filled.set(52); - } - - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageFirstInTxn(final Boolean b) { - if (filled.get(53)) { - throw new IllegalStateException("hub.storage/FIRST_IN_TXN already set"); - } else { - filled.set(53); - } - - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pStorageStorageKeyHi(final Bytes b) { - if (filled.get(134)) { - throw new IllegalStateException("hub.storage/STORAGE_KEY_HI already set"); - } else { - filled.set(134); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/STORAGE_KEY_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_CURR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_NEXT_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.storage/VALUE_ORIG_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.transaction/CALL_DATA_SIZE has invalid value (" + b + ")"); } - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 24)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 16)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) (b >> 8)); - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.put((byte) b); - - - return this; - } - - public Trace pTransactionCoinbaseAddressHi(final long b) { - if (filled.get(105)) { - throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_HI already set"); - } else { - filled.set(105); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_HI has invalid value (" + b + ")"); } - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 24)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 16)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) (b >> 8)); - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.put((byte) b); - - - return this; - } - - public Trace pTransactionCoinbaseAddressLo(final Bytes b) { - if (filled.get(133)) { - throw new IllegalStateException("hub.transaction/COINBASE_ADDRESS_LO already set"); - } else { - filled.set(133); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/COINBASE_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_HI has invalid value (" + b + ")"); } - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 24)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 16)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) (b >> 8)); - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.put((byte) b); - - - return this; - } - - public Trace pTransactionFromAddressLo(final Bytes b) { - if (filled.get(134)) { - throw new IllegalStateException("hub.transaction/FROM_ADDRESS_LO already set"); - } else { - filled.set(134); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/FROM_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasLimit.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasPrice.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.transaction/INIT_CODE_SIZE has invalid value (" + b + ")"); } - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 24)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 16)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) (b >> 8)); - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.put((byte) b); - - - return this; - } - - public Trace pTransactionInitialBalance(final Bytes b) { - if (filled.get(135)) { - throw new IllegalStateException("hub.transaction/INITIAL_BALANCE already set"); - } else { - filled.set(135); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/NONCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { priorityFeePerGas.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/REFUND_COUNTER_INFINITY has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refundCounterInfinity.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("hub.transaction/REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refundEffective.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_HI has invalid value (" + b + ")"); } - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 24)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 16)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) (b >> 8)); - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.put((byte) b); - - - return this; - } - - public Trace pTransactionToAddressLo(final Bytes b) { - if (filled.get(136)) { - throw new IllegalStateException("hub.transaction/TO_ADDRESS_LO already set"); - } else { - filled.set(136); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("hub.transaction/TO_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("hub.transaction/VALUE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER has invalid value (" + b + ")"); } - programCounter.put((byte) (b >> 24)); - programCounter.put((byte) (b >> 16)); - programCounter.put((byte) (b >> 8)); - programCounter.put((byte) b); - - - return this; - } - - public Trace programCounterNew(final long b) { - if (filled.get(34)) { - throw new IllegalStateException("hub.PROGRAM_COUNTER_NEW already set"); - } else { - filled.set(34); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.PROGRAM_COUNTER_NEW has invalid value (" + b + ")"); } - programCounterNew.put((byte) (b >> 24)); - programCounterNew.put((byte) (b >> 16)); - programCounterNew.put((byte) (b >> 8)); - programCounterNew.put((byte) b); - - - return this; - } - - public Trace refundCounter(final long b) { - if (filled.get(35)) { - throw new IllegalStateException("hub.REFUND_COUNTER already set"); - } else { - filled.set(35); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER has invalid value (" + b + ")"); } - refundCounter.put((byte) (b >> 24)); - refundCounter.put((byte) (b >> 16)); - refundCounter.put((byte) (b >> 8)); - refundCounter.put((byte) b); - - - return this; - } - - public Trace refundCounterNew(final long b) { - if (filled.get(36)) { - throw new IllegalStateException("hub.REFUND_COUNTER_NEW already set"); - } else { - filled.set(36); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.REFUND_COUNTER_NEW has invalid value (" + b + ")"); } - refundCounterNew.put((byte) (b >> 24)); - refundCounterNew.put((byte) (b >> 16)); - refundCounterNew.put((byte) (b >> 8)); - refundCounterNew.put((byte) b); - - - return this; - } - - public Trace relativeBlockNumber(final long b) { - if (filled.get(37)) { - throw new IllegalStateException("hub.RELATIVE_BLOCK_NUMBER already set"); - } else { - filled.set(37); - } - - if(b >= 65536L) { throw new IllegalArgumentException("hub.RELATIVE_BLOCK_NUMBER has invalid value (" + b + ")"); } - relativeBlockNumber.put((byte) (b >> 8)); - relativeBlockNumber.put((byte) b); - - - return this; - } - - public Trace subStamp(final long b) { - if (filled.get(38)) { - throw new IllegalStateException("hub.SUB_STAMP already set"); - } else { - filled.set(38); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("hub.SUB_STAMP has invalid value (" + b + ")"); } - subStamp.put((byte) (b >> 24)); - subStamp.put((byte) (b >> 16)); - subStamp.put((byte) (b >> 8)); - subStamp.put((byte) b); - - - return this; - } - - public Trace twoLineInstruction(final Boolean b) { - if (filled.get(39)) { - throw new IllegalStateException("hub.TWO_LINE_INSTRUCTION already set"); - } else { - filled.set(39); - } - - twoLineInstruction.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace txExec(final Boolean b) { - if (filled.get(40)) { - throw new IllegalStateException("hub.TX_EXEC already set"); - } else { - filled.set(40); - } - - txExec.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace txFinl(final Boolean b) { - if (filled.get(41)) { - throw new IllegalStateException("hub.TX_FINL already set"); - } else { - filled.set(41); - } - - txFinl.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace txInit(final Boolean b) { - if (filled.get(42)) { - throw new IllegalStateException("hub.TX_INIT already set"); - } else { - filled.set(42); - } - - txInit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace txSkip(final Boolean b) { - if (filled.get(43)) { - throw new IllegalStateException("hub.TX_SKIP already set"); - } else { - filled.set(43); - } - - txSkip.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace txWarm(final Boolean b) { - if (filled.get(44)) { - throw new IllegalStateException("hub.TX_WARM already set"); - } else { - filled.set(44); - } - - txWarm.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("hub.ABSOLUTE_TRANSACTION_NUMBER has not been filled"); - } - - if (!filled.get(104)) { - throw new IllegalStateException("hub.ADDRESS_HI_xor_ACCOUNT_ADDRESS_HI_xor_CCRS_STAMP_xor_PRC_CDO_xor_STATIC_GAS_xor_ADDRESS_HI_xor_CALL_DATA_SIZE has not been filled"); - } - - if (!filled.get(133)) { - throw new IllegalStateException("hub.ADDRESS_LO_xor_ACCOUNT_ADDRESS_LO_xor_EXP_DATA_1_xor_HASH_INFO_KECCAK_HI_xor_ADDRESS_LO_xor_COINBASE_ADDRESS_LO has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("hub.AGAIN_IN_BLK_xor_IS_ROOT_xor_CCSR_FLAG_xor_CALL_ABORT_WILL_REVERT_xor_ACC_FLAG_xor_AGAIN_IN_BLK_xor_COPY_TXCD has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("hub.AGAIN_IN_CNF_xor_IS_STATIC_xor_EXP_FLAG_xor_CALL_ABORT_WONT_REVERT_xor_ADD_FLAG_xor_AGAIN_IN_CNF_xor_IS_DEPLOYMENT has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("hub.AGAIN_IN_TXN_xor_UPDATE_xor_MMU_FLAG_xor_CALL_EOA_SUCCESS_CALLER_WILL_REVERT_xor_BIN_FLAG_xor_AGAIN_IN_TXN_xor_IS_TYPE2 has not been filled"); - } - - if (!filled.get(94)) { - throw new IllegalStateException("hub.ALPHA has not been filled"); - } - - if (!filled.get(135)) { - throw new IllegalStateException("hub.BALANCE_NEW_xor_CALLER_ADDRESS_LO_xor_EXP_DATA_3_xor_PUSH_VALUE_HI_xor_STORAGE_KEY_LO_xor_INITIAL_BALANCE has not been filled"); - } - - if (!filled.get(134)) { - throw new IllegalStateException("hub.BALANCE_xor_BYTE_CODE_ADDRESS_LO_xor_EXP_DATA_2_xor_HASH_INFO_KECCAK_LO_xor_STORAGE_KEY_HI_xor_FROM_ADDRESS_LO has not been filled"); - } - - if (!filled.get(112)) { - throw new IllegalStateException("hub.CALL_DATA_OFFSET_xor_MMU_SIZE has not been filled"); - } - - if (!filled.get(113)) { - throw new IllegalStateException("hub.CALL_DATA_SIZE_xor_MMU_SRC_ID has not been filled"); - } - - if (!filled.get(98)) { - throw new IllegalStateException("hub.CALL_STACK_DEPTH_xor_STACK_ITEM_HEIGHT_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("hub.CALLER_CONTEXT_NUMBER has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX has not been filled"); - } - - if (!filled.get(105)) { - throw new IllegalStateException("hub.CODE_FRAGMENT_INDEX_xor_ACCOUNT_DEPLOYMENT_NUMBER_xor_EXP_INST_xor_PRC_CDS_xor_DEPLOYMENT_NUMBER_xor_COINBASE_ADDRESS_HI has not been filled"); - } - - if (!filled.get(137)) { - throw new IllegalStateException("hub.CODE_HASH_HI_NEW_xor_EXP_DATA_5_xor_STACK_ITEM_VALUE_HI_1_xor_VALUE_CURR_LO_xor_VALUE has not been filled"); - } - - if (!filled.get(136)) { - throw new IllegalStateException("hub.CODE_HASH_HI_xor_CALL_VALUE_xor_EXP_DATA_4_xor_PUSH_VALUE_LO_xor_VALUE_CURR_HI_xor_TO_ADDRESS_LO has not been filled"); - } - - if (!filled.get(139)) { - throw new IllegalStateException("hub.CODE_HASH_LO_NEW_xor_MMU_LIMB_2_xor_STACK_ITEM_VALUE_HI_3_xor_VALUE_NEXT_LO has not been filled"); - } - - if (!filled.get(138)) { - throw new IllegalStateException("hub.CODE_HASH_LO_xor_MMU_LIMB_1_xor_STACK_ITEM_VALUE_HI_2_xor_VALUE_NEXT_HI has not been filled"); - } - - if (!filled.get(107)) { - throw new IllegalStateException("hub.CODE_SIZE_NEW_xor_BYTE_CODE_CODE_FRAGMENT_INDEX_xor_MMU_EXO_SUM_xor_PRC_RAO_xor_INIT_CODE_SIZE has not been filled"); - } - - if (!filled.get(106)) { - throw new IllegalStateException("hub.CODE_SIZE_xor_BYTE_CODE_ADDRESS_HI_xor_MMU_AUX_ID_xor_PRC_RAC_xor_DEPLOYMENT_NUMBER_INFTY_xor_FROM_ADDRESS_HI has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("hub.CONTEXT_GETS_REVERTED has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("hub.CONTEXT_MAY_CHANGE has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("hub.CONTEXT_NUMBER has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("hub.CONTEXT_NUMBER_NEW has not been filled"); - } - - if (!filled.get(114)) { - throw new IllegalStateException("hub.CONTEXT_NUMBER_xor_MMU_TGT_ID has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("hub.CONTEXT_REVERT_STAMP has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("hub.CONTEXT_SELF_REVERTS has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("hub.CONTEXT_WILL_REVERT has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("hub.COUNTER_NSR has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("hub.COUNTER_TLI has not been filled"); - } - - if (!filled.get(95)) { - throw new IllegalStateException("hub.DELTA has not been filled"); - } - - if (!filled.get(102)) { - throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FINAL_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FINAL_IN_BLOCK has not been filled"); - } - - if (!filled.get(103)) { - throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_FIRST_IN_BLOCK_xor_DEPLOYMENT_NUMBER_FIRST_IN_BLOCK has not been filled"); - } - - if (!filled.get(109)) { - throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_INFTY_xor_BYTE_CODE_DEPLOYMENT_STATUS_xor_MMU_PHASE has not been filled"); - } - - if (!filled.get(110)) { - throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_NEW_xor_CALLER_ADDRESS_HI_xor_MMU_REF_OFFSET has not been filled"); - } - - if (!filled.get(108)) { - throw new IllegalStateException("hub.DEPLOYMENT_NUMBER_xor_BYTE_CODE_DEPLOYMENT_NUMBER_xor_MMU_INST_xor_TO_ADDRESS_HI has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("hub.DEPLOYMENT_STATUS_INFTY_xor_MXP_DEPLOYS_xor_CALL_EXCEPTION_xor_CALL_FLAG_xor_FINAL_IN_CNF_xor_STATUS_CODE has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("hub.DEPLOYMENT_STATUS_NEW_xor_MXP_FLAG_xor_CALL_PRC_FAILURE_xor_CON_FLAG_xor_FINAL_IN_TXN has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("hub.DEPLOYMENT_STATUS_xor_MMU_SUCCESS_BIT_xor_CALL_EOA_SUCCESS_CALLER_WONT_REVERT_xor_BTC_FLAG_xor_FINAL_IN_BLK_xor_REQUIRES_EVM_EXECUTION has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("hub.DOM_STAMP has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("hub.EXCEPTION_AHOY has not been filled"); - } - - if (!filled.get(52)) { - throw new IllegalStateException("hub.EXISTS_NEW_xor_MXP_MXPX_xor_CALL_PRC_SUCCESS_CALLER_WONT_REVERT_xor_CREATE_FLAG_xor_FIRST_IN_CNF has not been filled"); - } - - if (!filled.get(51)) { - throw new IllegalStateException("hub.EXISTS_xor_MXP_MTNTOP_xor_CALL_PRC_SUCCESS_CALLER_WILL_REVERT_xor_COPY_FLAG_xor_FIRST_IN_BLK has not been filled"); - } - - if (!filled.get(53)) { - throw new IllegalStateException("hub.FINAL_IN_BLK_xor_MXP_SIZE_1_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WILL_REVERT_xor_DEC_FLAG_1_xor_FIRST_IN_TXN has not been filled"); - } - - if (!filled.get(54)) { - throw new IllegalStateException("hub.FINAL_IN_CNF_xor_MXP_SIZE_2_NONZERO_NO_MXPX_xor_CALL_SMC_FAILURE_CALLER_WONT_REVERT_xor_DEC_FLAG_2_xor_VALUE_CURR_CHANGES has not been filled"); - } - - if (!filled.get(55)) { - throw new IllegalStateException("hub.FINAL_IN_TXN_xor_OOB_FLAG_xor_CALL_SMC_SUCCESS_CALLER_WILL_REVERT_xor_DEC_FLAG_3_xor_VALUE_CURR_IS_ORIG has not been filled"); - } - - if (!filled.get(56)) { - throw new IllegalStateException("hub.FIRST_IN_BLK_xor_STP_EXISTS_xor_CALL_SMC_SUCCESS_CALLER_WONT_REVERT_xor_DEC_FLAG_4_xor_VALUE_CURR_IS_ZERO has not been filled"); - } - - if (!filled.get(57)) { - throw new IllegalStateException("hub.FIRST_IN_CNF_xor_STP_FLAG_xor_CREATE_ABORT_xor_DUP_FLAG_xor_VALUE_NEXT_IS_CURR has not been filled"); - } - - if (!filled.get(58)) { - throw new IllegalStateException("hub.FIRST_IN_TXN_xor_STP_OOGX_xor_CREATE_EMPTY_INIT_CODE_WILL_REVERT_xor_EXT_FLAG_xor_VALUE_NEXT_IS_ORIG has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("hub.GAS_ACTUAL has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("hub.GAS_COST has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("hub.GAS_EXPECTED has not been filled"); - } - - if (!filled.get(127)) { - throw new IllegalStateException("hub.GAS_LIMIT has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("hub.GAS_NEXT has not been filled"); - } - - if (!filled.get(128)) { - throw new IllegalStateException("hub.GAS_PRICE has not been filled"); - } - - if (!filled.get(60)) { - throw new IllegalStateException("hub.HAS_CODE_NEW_xor_CREATE_EXCEPTION_xor_HASH_INFO_FLAG_xor_VALUE_ORIG_IS_ZERO has not been filled"); - } - - if (!filled.get(59)) { - throw new IllegalStateException("hub.HAS_CODE_xor_STP_WARMTH_xor_CREATE_EMPTY_INIT_CODE_WONT_REVERT_xor_HALT_FLAG_xor_VALUE_NEXT_IS_ZERO has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("hub.HEIGHT has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("hub.HEIGHT_NEW has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("hub.HUB_STAMP has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("hub.HUB_STAMP_TRANSACTION_END has not been filled"); - } - - if (!filled.get(96)) { - throw new IllegalStateException("hub.INSTRUCTION has not been filled"); - } - - if (!filled.get(61)) { - throw new IllegalStateException("hub.IS_PRECOMPILE_xor_CREATE_FAILURE_CONDITION_WILL_REVERT_xor_ICPX_xor_WARMTH has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("hub.LOG_INFO_STAMP has not been filled"); - } - - if (!filled.get(63)) { - throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_NEW_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WILL_REVERT_xor_JUMPX has not been filled"); - } - - if (!filled.get(62)) { - throw new IllegalStateException("hub.MARKED_FOR_SELFDESTRUCT_xor_CREATE_FAILURE_CONDITION_WONT_REVERT_xor_INVALID_FLAG_xor_WARMTH_NEW has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("hub.MMU_STAMP has not been filled"); - } - - if (!filled.get(146)) { - throw new IllegalStateException("hub.MXP_OFFSET_2_HI has not been filled"); - } - - if (!filled.get(147)) { - throw new IllegalStateException("hub.MXP_OFFSET_2_LO has not been filled"); - } - - if (!filled.get(148)) { - throw new IllegalStateException("hub.MXP_SIZE_1_HI has not been filled"); - } - - if (!filled.get(149)) { - throw new IllegalStateException("hub.MXP_SIZE_1_LO has not been filled"); - } - - if (!filled.get(150)) { - throw new IllegalStateException("hub.MXP_SIZE_2_HI has not been filled"); - } - - if (!filled.get(151)) { - throw new IllegalStateException("hub.MXP_SIZE_2_LO has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("hub.MXP_STAMP has not been filled"); - } - - if (!filled.get(152)) { - throw new IllegalStateException("hub.MXP_WORDS has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("hub.NON_STACK_ROWS has not been filled"); - } - - if (!filled.get(129)) { - throw new IllegalStateException("hub.NONCE has not been filled"); - } - - if (!filled.get(125)) { - throw new IllegalStateException("hub.NONCE_NEW_xor_STP_GAS_PAID_OUT_OF_POCKET_xor_PRC_CALLER_GAS_xor_GAS_INITIALLY_AVAILABLE has not been filled"); - } - - if (!filled.get(124)) { - throw new IllegalStateException("hub.NONCE_xor_STP_GAS_MXP_xor_PRC_CALLEE_GAS_xor_BASEFEE has not been filled"); - } - - if (!filled.get(153)) { - throw new IllegalStateException("hub.OOB_DATA_1 has not been filled"); - } - - if (!filled.get(154)) { - throw new IllegalStateException("hub.OOB_DATA_2 has not been filled"); - } - - if (!filled.get(155)) { - throw new IllegalStateException("hub.OOB_DATA_3 has not been filled"); - } - - if (!filled.get(156)) { - throw new IllegalStateException("hub.OOB_DATA_4 has not been filled"); - } - - if (!filled.get(157)) { - throw new IllegalStateException("hub.OOB_DATA_5 has not been filled"); - } - - if (!filled.get(158)) { - throw new IllegalStateException("hub.OOB_DATA_6 has not been filled"); - } - - if (!filled.get(159)) { - throw new IllegalStateException("hub.OOB_DATA_7 has not been filled"); - } - - if (!filled.get(160)) { - throw new IllegalStateException("hub.OOB_DATA_8 has not been filled"); - } - - if (!filled.get(161)) { - throw new IllegalStateException("hub.OOB_DATA_9 has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("hub.PEEK_AT_ACCOUNT has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("hub.PEEK_AT_CONTEXT has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("hub.PEEK_AT_MISCELLANEOUS has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("hub.PEEK_AT_SCENARIO has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("hub.PEEK_AT_STACK has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("hub.PEEK_AT_STORAGE has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("hub.PEEK_AT_TRANSACTION has not been filled"); - } - - if (!filled.get(69)) { - throw new IllegalStateException("hub.PRC_ECMUL_xor_MACHINE_STATE_FLAG has not been filled"); - } - - if (!filled.get(70)) { - throw new IllegalStateException("hub.PRC_ECPAIRING_xor_MAXCSX has not been filled"); - } - - if (!filled.get(71)) { - throw new IllegalStateException("hub.PRC_ECRECOVER_xor_MOD_FLAG has not been filled"); - } - - if (!filled.get(72)) { - throw new IllegalStateException("hub.PRC_FAILURE_KNOWN_TO_HUB_xor_MUL_FLAG has not been filled"); - } - - if (!filled.get(73)) { - throw new IllegalStateException("hub.PRC_FAILURE_KNOWN_TO_RAM_xor_MXPX has not been filled"); - } - - if (!filled.get(74)) { - throw new IllegalStateException("hub.PRC_IDENTITY_xor_MXP_FLAG has not been filled"); - } - - if (!filled.get(75)) { - throw new IllegalStateException("hub.PRC_MODEXP_xor_OOGX has not been filled"); - } - - if (!filled.get(76)) { - throw new IllegalStateException("hub.PRC_RIPEMD-160_xor_OPCX has not been filled"); - } - - if (!filled.get(77)) { - throw new IllegalStateException("hub.PRC_SHA2-256_xor_PUSHPOP_FLAG has not been filled"); - } - - if (!filled.get(78)) { - throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WILL_REVERT_xor_RDCX has not been filled"); - } - - if (!filled.get(79)) { - throw new IllegalStateException("hub.PRC_SUCCESS_CALLER_WONT_REVERT_xor_SHF_FLAG has not been filled"); - } - - if (!filled.get(130)) { - throw new IllegalStateException("hub.PRIORITY_FEE_PER_GAS has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("hub.PROGRAM_COUNTER has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("hub.PROGRAM_COUNTER_NEW has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("hub.REFUND_COUNTER has not been filled"); - } - - if (!filled.get(131)) { - throw new IllegalStateException("hub.REFUND_COUNTER_INFINITY has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("hub.REFUND_COUNTER_NEW has not been filled"); - } - - if (!filled.get(132)) { - throw new IllegalStateException("hub.REFUND_EFFECTIVE has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("hub.RELATIVE_BLOCK_NUMBER has not been filled"); - } - - if (!filled.get(115)) { - throw new IllegalStateException("hub.RETURN_AT_CAPACITY_xor_MXP_INST has not been filled"); - } - - if (!filled.get(116)) { - throw new IllegalStateException("hub.RETURN_AT_OFFSET_xor_OOB_INST has not been filled"); - } - - if (!filled.get(117)) { - throw new IllegalStateException("hub.RETURN_DATA_CONTEXT_NUMBER_xor_STP_GAS_STIPEND has not been filled"); - } - - if (!filled.get(118)) { - throw new IllegalStateException("hub.RETURN_DATA_OFFSET_xor_STP_INSTRUCTION has not been filled"); - } - - if (!filled.get(119)) { - throw new IllegalStateException("hub.RETURN_DATA_SIZE has not been filled"); - } - - if (!filled.get(80)) { - throw new IllegalStateException("hub.RETURN_EXCEPTION_xor_SOX has not been filled"); - } - - if (!filled.get(81)) { - throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WILL_REVERT_xor_SSTOREX has not been filled"); - } - - if (!filled.get(82)) { - throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_EMPTY_CODE_WONT_REVERT_xor_STACKRAM_FLAG has not been filled"); - } - - if (!filled.get(83)) { - throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WILL_REVERT_xor_STACK_ITEM_POP_1 has not been filled"); - } - - if (!filled.get(84)) { - throw new IllegalStateException("hub.RETURN_FROM_DEPLOYMENT_NONEMPTY_CODE_WONT_REVERT_xor_STACK_ITEM_POP_2 has not been filled"); - } - - if (!filled.get(85)) { - throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WILL_TOUCH_RAM_xor_STACK_ITEM_POP_3 has not been filled"); - } - - if (!filled.get(86)) { - throw new IllegalStateException("hub.RETURN_FROM_MESSAGE_CALL_WONT_TOUCH_RAM_xor_STACK_ITEM_POP_4 has not been filled"); - } - - if (!filled.get(111)) { - throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_HI_xor_CALL_DATA_CONTEXT_NUMBER_xor_MMU_REF_SIZE has not been filled"); - } - - if (!filled.get(140)) { - throw new IllegalStateException("hub.RLPADDR_DEP_ADDR_LO_xor_MMU_SRC_OFFSET_HI_xor_STACK_ITEM_VALUE_HI_4_xor_VALUE_ORIG_HI has not been filled"); - } - - if (!filled.get(64)) { - throw new IllegalStateException("hub.RLPADDR_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_FAILURE_WONT_REVERT_xor_JUMP_DESTINATION_VETTING_REQUIRED has not been filled"); - } - - if (!filled.get(141)) { - throw new IllegalStateException("hub.RLPADDR_KEC_HI_xor_MMU_SRC_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_1_xor_VALUE_ORIG_LO has not been filled"); - } - - if (!filled.get(142)) { - throw new IllegalStateException("hub.RLPADDR_KEC_LO_xor_MMU_TGT_OFFSET_LO_xor_STACK_ITEM_VALUE_LO_2 has not been filled"); - } - - if (!filled.get(97)) { - throw new IllegalStateException("hub.RLPADDR_RECIPE has not been filled"); - } - - if (!filled.get(143)) { - throw new IllegalStateException("hub.RLPADDR_SALT_HI_xor_MXP_GAS_MXP_xor_STACK_ITEM_VALUE_LO_3 has not been filled"); - } - - if (!filled.get(144)) { - throw new IllegalStateException("hub.RLPADDR_SALT_LO_xor_MXP_OFFSET_1_HI_xor_STACK_ITEM_VALUE_LO_4 has not been filled"); - } - - if (!filled.get(65)) { - throw new IllegalStateException("hub.ROMLEX_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WILL_REVERT_xor_JUMP_FLAG has not been filled"); - } - - if (!filled.get(87)) { - throw new IllegalStateException("hub.SELFDESTRUCT_EXCEPTION_xor_STATICX has not been filled"); - } - - if (!filled.get(88)) { - throw new IllegalStateException("hub.SELFDESTRUCT_WILL_REVERT_xor_STATIC_FLAG has not been filled"); - } - - if (!filled.get(89)) { - throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED_xor_STO_FLAG has not been filled"); - } - - if (!filled.get(90)) { - throw new IllegalStateException("hub.SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED_xor_SUX has not been filled"); - } - - if (!filled.get(99)) { - throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_2 has not been filled"); - } - - if (!filled.get(100)) { - throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_3 has not been filled"); - } - - if (!filled.get(101)) { - throw new IllegalStateException("hub.STACK_ITEM_HEIGHT_4 has not been filled"); - } - - if (!filled.get(120)) { - throw new IllegalStateException("hub.STACK_ITEM_STAMP_1 has not been filled"); - } - - if (!filled.get(121)) { - throw new IllegalStateException("hub.STACK_ITEM_STAMP_2 has not been filled"); - } - - if (!filled.get(122)) { - throw new IllegalStateException("hub.STACK_ITEM_STAMP_3 has not been filled"); - } - - if (!filled.get(123)) { - throw new IllegalStateException("hub.STACK_ITEM_STAMP_4 has not been filled"); - } - - if (!filled.get(162)) { - throw new IllegalStateException("hub.STP_GAS_HI has not been filled"); - } - - if (!filled.get(163)) { - throw new IllegalStateException("hub.STP_GAS_LO has not been filled"); - } - - if (!filled.get(126)) { - throw new IllegalStateException("hub.STP_GAS_UPFRONT_GAS_COST_xor_PRC_RETURN_GAS_xor_GAS_LEFTOVER has not been filled"); - } - - if (!filled.get(164)) { - throw new IllegalStateException("hub.STP_VALUE_HI has not been filled"); - } - - if (!filled.get(165)) { - throw new IllegalStateException("hub.STP_VALUE_LO has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("hub.SUB_STAMP has not been filled"); - } - - if (!filled.get(91)) { - throw new IllegalStateException("hub.SWAP_FLAG has not been filled"); - } - - if (!filled.get(66)) { - throw new IllegalStateException("hub.TRM_FLAG_xor_CREATE_NONEMPTY_INIT_CODE_SUCCESS_WONT_REVERT_xor_KEC_FLAG has not been filled"); - } - - if (!filled.get(145)) { - throw new IllegalStateException("hub.TRM_RAW_ADDRESS_HI_xor_MXP_OFFSET_1_LO has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("hub.TWO_LINE_INSTRUCTION has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("hub.TX_EXEC has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("hub.TX_FINL has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("hub.TX_INIT has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("hub.TX_SKIP has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("hub.TX_WARM has not been filled"); - } - - if (!filled.get(92)) { - throw new IllegalStateException("hub.TXN_FLAG has not been filled"); - } - - if (!filled.get(68)) { - throw new IllegalStateException("hub.WARMTH_NEW_xor_PRC_ECADD_xor_LOG_INFO_FLAG has not been filled"); - } - - if (!filled.get(67)) { - throw new IllegalStateException("hub.WARMTH_xor_PRC_BLAKE2f_xor_LOG_FLAG has not been filled"); - } - - if (!filled.get(93)) { - throw new IllegalStateException("hub.WCP_FLAG has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - absoluteTransactionNumber.position(absoluteTransactionNumber.position() + 2); - } - - if (!filled.get(104)) { - addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.position(addressHiXorAccountAddressHiXorCcrsStampXorPrcCdoXorStaticGasXorAddressHiXorCallDataSize.position() + 4); - } - - if (!filled.get(133)) { - addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position(addressLoXorAccountAddressLoXorExpData1XorHashInfoKeccakHiXorAddressLoXorCoinbaseAddressLo.position() + 16); - } - - if (!filled.get(45)) { - againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position(againInBlkXorIsRootXorCcsrFlagXorCallAbortWillRevertXorAccFlagXorAgainInBlkXorCopyTxcd.position() + 1); - } - - if (!filled.get(46)) { - againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position(againInCnfXorIsStaticXorExpFlagXorCallAbortWontRevertXorAddFlagXorAgainInCnfXorIsDeployment.position() + 1); - } - - if (!filled.get(47)) { - againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position(againInTxnXorUpdateXorMmuFlagXorCallEoaSuccessCallerWillRevertXorBinFlagXorAgainInTxnXorIsType2.position() + 1); - } - - if (!filled.get(94)) { - alpha.position(alpha.position() + 1); - } - - if (!filled.get(135)) { - balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position(balanceNewXorCallerAddressLoXorExpData3XorPushValueHiXorStorageKeyLoXorInitialBalance.position() + 16); - } - - if (!filled.get(134)) { - balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position(balanceXorByteCodeAddressLoXorExpData2XorHashInfoKeccakLoXorStorageKeyHiXorFromAddressLo.position() + 16); - } - - if (!filled.get(112)) { - callDataOffsetXorMmuSize.position(callDataOffsetXorMmuSize.position() + 4); - } - - if (!filled.get(113)) { - callDataSizeXorMmuSrcId.position(callDataSizeXorMmuSrcId.position() + 4); - } - - if (!filled.get(98)) { - callStackDepthXorStackItemHeight1.position(callStackDepthXorStackItemHeight1.position() + 2); - } - - if (!filled.get(1)) { - callerContextNumber.position(callerContextNumber.position() + 4); - } - - if (!filled.get(2)) { - codeFragmentIndex.position(codeFragmentIndex.position() + 4); - } - - if (!filled.get(105)) { - codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.position(codeFragmentIndexXorAccountDeploymentNumberXorExpInstXorPrcCdsXorDeploymentNumberXorCoinbaseAddressHi.position() + 4); - } - - if (!filled.get(137)) { - codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position(codeHashHiNewXorExpData5XorStackItemValueHi1XorValueCurrLoXorValue.position() + 16); - } - - if (!filled.get(136)) { - codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position(codeHashHiXorCallValueXorExpData4XorPushValueLoXorValueCurrHiXorToAddressLo.position() + 16); - } - - if (!filled.get(139)) { - codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position(codeHashLoNewXorMmuLimb2XorStackItemValueHi3XorValueNextLo.position() + 16); - } - - if (!filled.get(138)) { - codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position(codeHashLoXorMmuLimb1XorStackItemValueHi2XorValueNextHi.position() + 16); - } - - if (!filled.get(107)) { - codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position(codeSizeNewXorByteCodeCodeFragmentIndexXorMmuExoSumXorPrcRaoXorInitCodeSize.position() + 4); - } - - if (!filled.get(106)) { - codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.position(codeSizeXorByteCodeAddressHiXorMmuAuxIdXorPrcRacXorDeploymentNumberInftyXorFromAddressHi.position() + 4); - } - - if (!filled.get(3)) { - contextGetsReverted.position(contextGetsReverted.position() + 1); - } - - if (!filled.get(4)) { - contextMayChange.position(contextMayChange.position() + 1); - } - - if (!filled.get(5)) { - contextNumber.position(contextNumber.position() + 4); - } - - if (!filled.get(6)) { - contextNumberNew.position(contextNumberNew.position() + 4); - } - - if (!filled.get(114)) { - contextNumberXorMmuTgtId.position(contextNumberXorMmuTgtId.position() + 4); - } - - if (!filled.get(7)) { - contextRevertStamp.position(contextRevertStamp.position() + 4); - } - - if (!filled.get(8)) { - contextSelfReverts.position(contextSelfReverts.position() + 1); - } - - if (!filled.get(9)) { - contextWillRevert.position(contextWillRevert.position() + 1); - } - - if (!filled.get(10)) { - counterNsr.position(counterNsr.position() + 1); - } - - if (!filled.get(11)) { - counterTli.position(counterTli.position() + 1); - } - - if (!filled.get(95)) { - delta.position(delta.position() + 1); - } - - if (!filled.get(102)) { - deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position(deploymentNumberFinalInBlockXorDeploymentNumberFinalInBlock.position() + 2); - } - - if (!filled.get(103)) { - deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position(deploymentNumberFirstInBlockXorDeploymentNumberFirstInBlock.position() + 2); - } - - if (!filled.get(109)) { - deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position(deploymentNumberInftyXorByteCodeDeploymentStatusXorMmuPhase.position() + 4); - } - - if (!filled.get(110)) { - deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position(deploymentNumberNewXorCallerAddressHiXorMmuRefOffset.position() + 4); - } - - if (!filled.get(108)) { - deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position(deploymentNumberXorByteCodeDeploymentNumberXorMmuInstXorToAddressHi.position() + 4); - } - - if (!filled.get(49)) { - deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position(deploymentStatusInftyXorMxpDeploysXorCallExceptionXorCallFlagXorFinalInCnfXorStatusCode.position() + 1); - } - - if (!filled.get(50)) { - deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position(deploymentStatusNewXorMxpFlagXorCallPrcFailureXorConFlagXorFinalInTxn.position() + 1); - } - - if (!filled.get(48)) { - deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position(deploymentStatusXorMmuSuccessBitXorCallEoaSuccessCallerWontRevertXorBtcFlagXorFinalInBlkXorRequiresEvmExecution.position() + 1); - } - - if (!filled.get(12)) { - domStamp.position(domStamp.position() + 4); - } - - if (!filled.get(13)) { - exceptionAhoy.position(exceptionAhoy.position() + 1); - } - - if (!filled.get(52)) { - existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position(existsNewXorMxpMxpxXorCallPrcSuccessCallerWontRevertXorCreateFlagXorFirstInCnf.position() + 1); - } - - if (!filled.get(51)) { - existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position(existsXorMxpMtntopXorCallPrcSuccessCallerWillRevertXorCopyFlagXorFirstInBlk.position() + 1); - } - - if (!filled.get(53)) { - finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position(finalInBlkXorMxpSize1NonzeroNoMxpxXorCallSmcFailureCallerWillRevertXorDecFlag1XorFirstInTxn.position() + 1); - } - - if (!filled.get(54)) { - finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.position(finalInCnfXorMxpSize2NonzeroNoMxpxXorCallSmcFailureCallerWontRevertXorDecFlag2XorValueCurrChanges.position() + 1); - } - - if (!filled.get(55)) { - finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position(finalInTxnXorOobFlagXorCallSmcSuccessCallerWillRevertXorDecFlag3XorValueCurrIsOrig.position() + 1); - } - - if (!filled.get(56)) { - firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position(firstInBlkXorStpExistsXorCallSmcSuccessCallerWontRevertXorDecFlag4XorValueCurrIsZero.position() + 1); - } - - if (!filled.get(57)) { - firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position(firstInCnfXorStpFlagXorCreateAbortXorDupFlagXorValueNextIsCurr.position() + 1); - } - - if (!filled.get(58)) { - firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position(firstInTxnXorStpOogxXorCreateEmptyInitCodeWillRevertXorExtFlagXorValueNextIsOrig.position() + 1); - } - - if (!filled.get(14)) { - gasActual.position(gasActual.position() + 8); - } - - if (!filled.get(15)) { - gasCost.position(gasCost.position() + 8); - } - - if (!filled.get(16)) { - gasExpected.position(gasExpected.position() + 8); - } - - if (!filled.get(127)) { - gasLimit.position(gasLimit.position() + 8); - } - - if (!filled.get(17)) { - gasNext.position(gasNext.position() + 8); - } - - if (!filled.get(128)) { - gasPrice.position(gasPrice.position() + 8); - } - - if (!filled.get(60)) { - hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position(hasCodeNewXorCreateExceptionXorHashInfoFlagXorValueOrigIsZero.position() + 1); - } - - if (!filled.get(59)) { - hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position(hasCodeXorStpWarmthXorCreateEmptyInitCodeWontRevertXorHaltFlagXorValueNextIsZero.position() + 1); - } - - if (!filled.get(18)) { - height.position(height.position() + 2); - } - - if (!filled.get(19)) { - heightNew.position(heightNew.position() + 2); - } - - if (!filled.get(20)) { - hubStamp.position(hubStamp.position() + 4); - } - - if (!filled.get(21)) { - hubStampTransactionEnd.position(hubStampTransactionEnd.position() + 4); - } - - if (!filled.get(96)) { - instruction.position(instruction.position() + 1); - } - - if (!filled.get(61)) { - isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position(isPrecompileXorCreateFailureConditionWillRevertXorIcpxXorWarmth.position() + 1); - } - - if (!filled.get(22)) { - logInfoStamp.position(logInfoStamp.position() + 4); - } - - if (!filled.get(63)) { - markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position(markedForSelfdestructNewXorCreateNonemptyInitCodeFailureWillRevertXorJumpx.position() + 1); - } - - if (!filled.get(62)) { - markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position(markedForSelfdestructXorCreateFailureConditionWontRevertXorInvalidFlagXorWarmthNew.position() + 1); - } - - if (!filled.get(23)) { - mmuStamp.position(mmuStamp.position() + 4); - } - - if (!filled.get(146)) { - mxpOffset2Hi.position(mxpOffset2Hi.position() + 16); - } - - if (!filled.get(147)) { - mxpOffset2Lo.position(mxpOffset2Lo.position() + 16); - } - - if (!filled.get(148)) { - mxpSize1Hi.position(mxpSize1Hi.position() + 16); - } - - if (!filled.get(149)) { - mxpSize1Lo.position(mxpSize1Lo.position() + 16); - } - - if (!filled.get(150)) { - mxpSize2Hi.position(mxpSize2Hi.position() + 16); - } - - if (!filled.get(151)) { - mxpSize2Lo.position(mxpSize2Lo.position() + 16); - } - - if (!filled.get(24)) { - mxpStamp.position(mxpStamp.position() + 4); - } - - if (!filled.get(152)) { - mxpWords.position(mxpWords.position() + 16); - } - - if (!filled.get(25)) { - nonStackRows.position(nonStackRows.position() + 1); - } - - if (!filled.get(129)) { - nonce.position(nonce.position() + 8); - } - - if (!filled.get(125)) { - nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position(nonceNewXorStpGasPaidOutOfPocketXorPrcCallerGasXorGasInitiallyAvailable.position() + 8); - } - - if (!filled.get(124)) { - nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position(nonceXorStpGasMxpXorPrcCalleeGasXorBasefee.position() + 8); - } - - if (!filled.get(153)) { - oobData1.position(oobData1.position() + 16); - } - - if (!filled.get(154)) { - oobData2.position(oobData2.position() + 16); - } - - if (!filled.get(155)) { - oobData3.position(oobData3.position() + 16); - } - - if (!filled.get(156)) { - oobData4.position(oobData4.position() + 16); - } - - if (!filled.get(157)) { - oobData5.position(oobData5.position() + 16); - } - - if (!filled.get(158)) { - oobData6.position(oobData6.position() + 16); - } - - if (!filled.get(159)) { - oobData7.position(oobData7.position() + 16); - } - - if (!filled.get(160)) { - oobData8.position(oobData8.position() + 16); - } - - if (!filled.get(161)) { - oobData9.position(oobData9.position() + 16); - } - - if (!filled.get(26)) { - peekAtAccount.position(peekAtAccount.position() + 1); - } - - if (!filled.get(27)) { - peekAtContext.position(peekAtContext.position() + 1); - } - - if (!filled.get(28)) { - peekAtMiscellaneous.position(peekAtMiscellaneous.position() + 1); - } - - if (!filled.get(29)) { - peekAtScenario.position(peekAtScenario.position() + 1); - } - - if (!filled.get(30)) { - peekAtStack.position(peekAtStack.position() + 1); - } - - if (!filled.get(31)) { - peekAtStorage.position(peekAtStorage.position() + 1); - } - - if (!filled.get(32)) { - peekAtTransaction.position(peekAtTransaction.position() + 1); - } - - if (!filled.get(69)) { - prcEcmulXorMachineStateFlag.position(prcEcmulXorMachineStateFlag.position() + 1); - } - - if (!filled.get(70)) { - prcEcpairingXorMaxcsx.position(prcEcpairingXorMaxcsx.position() + 1); - } - - if (!filled.get(71)) { - prcEcrecoverXorModFlag.position(prcEcrecoverXorModFlag.position() + 1); - } - - if (!filled.get(72)) { - prcFailureKnownToHubXorMulFlag.position(prcFailureKnownToHubXorMulFlag.position() + 1); - } - - if (!filled.get(73)) { - prcFailureKnownToRamXorMxpx.position(prcFailureKnownToRamXorMxpx.position() + 1); - } - - if (!filled.get(74)) { - prcIdentityXorMxpFlag.position(prcIdentityXorMxpFlag.position() + 1); - } - - if (!filled.get(75)) { - prcModexpXorOogx.position(prcModexpXorOogx.position() + 1); - } - - if (!filled.get(76)) { - prcRipemd160XorOpcx.position(prcRipemd160XorOpcx.position() + 1); - } - - if (!filled.get(77)) { - prcSha2256XorPushpopFlag.position(prcSha2256XorPushpopFlag.position() + 1); - } - - if (!filled.get(78)) { - prcSuccessCallerWillRevertXorRdcx.position(prcSuccessCallerWillRevertXorRdcx.position() + 1); - } - - if (!filled.get(79)) { - prcSuccessCallerWontRevertXorShfFlag.position(prcSuccessCallerWontRevertXorShfFlag.position() + 1); - } - - if (!filled.get(130)) { - priorityFeePerGas.position(priorityFeePerGas.position() + 8); - } - - if (!filled.get(33)) { - programCounter.position(programCounter.position() + 4); - } - - if (!filled.get(34)) { - programCounterNew.position(programCounterNew.position() + 4); - } - - if (!filled.get(35)) { - refundCounter.position(refundCounter.position() + 4); - } - - if (!filled.get(131)) { - refundCounterInfinity.position(refundCounterInfinity.position() + 8); - } - - if (!filled.get(36)) { - refundCounterNew.position(refundCounterNew.position() + 4); - } - - if (!filled.get(132)) { - refundEffective.position(refundEffective.position() + 8); - } - - if (!filled.get(37)) { - relativeBlockNumber.position(relativeBlockNumber.position() + 2); - } - - if (!filled.get(115)) { - returnAtCapacityXorMxpInst.position(returnAtCapacityXorMxpInst.position() + 4); - } - - if (!filled.get(116)) { - returnAtOffsetXorOobInst.position(returnAtOffsetXorOobInst.position() + 4); - } - - if (!filled.get(117)) { - returnDataContextNumberXorStpGasStipend.position(returnDataContextNumberXorStpGasStipend.position() + 4); - } - - if (!filled.get(118)) { - returnDataOffsetXorStpInstruction.position(returnDataOffsetXorStpInstruction.position() + 4); - } - - if (!filled.get(119)) { - returnDataSize.position(returnDataSize.position() + 4); - } - - if (!filled.get(80)) { - returnExceptionXorSox.position(returnExceptionXorSox.position() + 1); - } - - if (!filled.get(81)) { - returnFromDeploymentEmptyCodeWillRevertXorSstorex.position(returnFromDeploymentEmptyCodeWillRevertXorSstorex.position() + 1); - } - - if (!filled.get(82)) { - returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position(returnFromDeploymentEmptyCodeWontRevertXorStackramFlag.position() + 1); - } - - if (!filled.get(83)) { - returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position(returnFromDeploymentNonemptyCodeWillRevertXorStackItemPop1.position() + 1); - } - - if (!filled.get(84)) { - returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position(returnFromDeploymentNonemptyCodeWontRevertXorStackItemPop2.position() + 1); - } - - if (!filled.get(85)) { - returnFromMessageCallWillTouchRamXorStackItemPop3.position(returnFromMessageCallWillTouchRamXorStackItemPop3.position() + 1); - } - - if (!filled.get(86)) { - returnFromMessageCallWontTouchRamXorStackItemPop4.position(returnFromMessageCallWontTouchRamXorStackItemPop4.position() + 1); - } - - if (!filled.get(111)) { - rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position(rlpaddrDepAddrHiXorCallDataContextNumberXorMmuRefSize.position() + 4); - } - - if (!filled.get(140)) { - rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position(rlpaddrDepAddrLoXorMmuSrcOffsetHiXorStackItemValueHi4XorValueOrigHi.position() + 16); - } - - if (!filled.get(64)) { - rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.position(rlpaddrFlagXorCreateNonemptyInitCodeFailureWontRevertXorJumpDestinationVettingRequired.position() + 1); - } - - if (!filled.get(141)) { - rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position(rlpaddrKecHiXorMmuSrcOffsetLoXorStackItemValueLo1XorValueOrigLo.position() + 16); - } - - if (!filled.get(142)) { - rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position(rlpaddrKecLoXorMmuTgtOffsetLoXorStackItemValueLo2.position() + 16); - } - - if (!filled.get(97)) { - rlpaddrRecipe.position(rlpaddrRecipe.position() + 1); - } - - if (!filled.get(143)) { - rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position(rlpaddrSaltHiXorMxpGasMxpXorStackItemValueLo3.position() + 16); - } - - if (!filled.get(144)) { - rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position(rlpaddrSaltLoXorMxpOffset1HiXorStackItemValueLo4.position() + 16); - } - - if (!filled.get(65)) { - romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position(romlexFlagXorCreateNonemptyInitCodeSuccessWillRevertXorJumpFlag.position() + 1); - } - - if (!filled.get(87)) { - selfdestructExceptionXorStaticx.position(selfdestructExceptionXorStaticx.position() + 1); - } - - if (!filled.get(88)) { - selfdestructWillRevertXorStaticFlag.position(selfdestructWillRevertXorStaticFlag.position() + 1); - } - - if (!filled.get(89)) { - selfdestructWontRevertAlreadyMarkedXorStoFlag.position(selfdestructWontRevertAlreadyMarkedXorStoFlag.position() + 1); - } - - if (!filled.get(90)) { - selfdestructWontRevertNotYetMarkedXorSux.position(selfdestructWontRevertNotYetMarkedXorSux.position() + 1); - } - - if (!filled.get(99)) { - stackItemHeight2.position(stackItemHeight2.position() + 2); - } - - if (!filled.get(100)) { - stackItemHeight3.position(stackItemHeight3.position() + 2); - } - - if (!filled.get(101)) { - stackItemHeight4.position(stackItemHeight4.position() + 2); - } - - if (!filled.get(120)) { - stackItemStamp1.position(stackItemStamp1.position() + 5); - } - - if (!filled.get(121)) { - stackItemStamp2.position(stackItemStamp2.position() + 5); - } - - if (!filled.get(122)) { - stackItemStamp3.position(stackItemStamp3.position() + 5); - } - - if (!filled.get(123)) { - stackItemStamp4.position(stackItemStamp4.position() + 5); - } - - if (!filled.get(162)) { - stpGasHi.position(stpGasHi.position() + 16); - } - - if (!filled.get(163)) { - stpGasLo.position(stpGasLo.position() + 16); - } - - if (!filled.get(126)) { - stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position(stpGasUpfrontGasCostXorPrcReturnGasXorGasLeftover.position() + 8); - } - - if (!filled.get(164)) { - stpValueHi.position(stpValueHi.position() + 16); - } - - if (!filled.get(165)) { - stpValueLo.position(stpValueLo.position() + 16); - } - - if (!filled.get(38)) { - subStamp.position(subStamp.position() + 4); - } - - if (!filled.get(91)) { - swapFlag.position(swapFlag.position() + 1); - } - - if (!filled.get(66)) { - trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position(trmFlagXorCreateNonemptyInitCodeSuccessWontRevertXorKecFlag.position() + 1); - } - - if (!filled.get(145)) { - trmRawAddressHiXorMxpOffset1Lo.position(trmRawAddressHiXorMxpOffset1Lo.position() + 16); - } - - if (!filled.get(39)) { - twoLineInstruction.position(twoLineInstruction.position() + 1); - } - - if (!filled.get(40)) { - txExec.position(txExec.position() + 1); - } - - if (!filled.get(41)) { - txFinl.position(txFinl.position() + 1); - } - - if (!filled.get(42)) { - txInit.position(txInit.position() + 1); - } - - if (!filled.get(43)) { - txSkip.position(txSkip.position() + 1); - } - - if (!filled.get(44)) { - txWarm.position(txWarm.position() + 1); - } - - if (!filled.get(92)) { - txnFlag.position(txnFlag.position() + 1); - } - - if (!filled.get(68)) { - warmthNewXorPrcEcaddXorLogInfoFlag.position(warmthNewXorPrcEcaddXorLogInfoFlag.position() + 1); - } - - if (!filled.get(67)) { - warmthXorPrcBlake2FXorLogFlag.position(warmthXorPrcBlake2FXorLogFlag.position() + 1); - } - - if (!filled.get(93)) { - wcpFlag.position(wcpFlag.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java deleted file mode 100644 index 68ef06395..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/logdata/Trace.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.logdata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absLogNum; - private final MappedByteBuffer absLogNumMax; - private final MappedByteBuffer index; - private final MappedByteBuffer limb; - private final MappedByteBuffer logsData; - private final MappedByteBuffer sizeAcc; - private final MappedByteBuffer sizeLimb; - private final MappedByteBuffer sizeTotal; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("logdata.ABS_LOG_NUM", 3, length)); - headers.add(new ColumnHeader("logdata.ABS_LOG_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("logdata.INDEX", 3, length)); - headers.add(new ColumnHeader("logdata.LIMB", 16, length)); - headers.add(new ColumnHeader("logdata.LOGS_DATA", 1, length)); - headers.add(new ColumnHeader("logdata.SIZE_ACC", 4, length)); - headers.add(new ColumnHeader("logdata.SIZE_LIMB", 1, length)); - headers.add(new ColumnHeader("logdata.SIZE_TOTAL", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.absLogNum = buffers.get(0); - this.absLogNumMax = buffers.get(1); - this.index = buffers.get(2); - this.limb = buffers.get(3); - this.logsData = buffers.get(4); - this.sizeAcc = buffers.get(5); - this.sizeLimb = buffers.get(6); - this.sizeTotal = buffers.get(7); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absLogNum(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("logdata.ABS_LOG_NUM already set"); - } else { - filled.set(0); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("logdata.ABS_LOG_NUM has invalid value (" + b + ")"); } - absLogNum.put((byte) (b >> 16)); - absLogNum.put((byte) (b >> 8)); - absLogNum.put((byte) b); - - - return this; - } - - public Trace absLogNumMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("logdata.ABS_LOG_NUM_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("logdata.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } - absLogNumMax.put((byte) (b >> 16)); - absLogNumMax.put((byte) (b >> 8)); - absLogNumMax.put((byte) b); - - - return this; - } - - public Trace index(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("logdata.INDEX already set"); - } else { - filled.set(2); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("logdata.INDEX has invalid value (" + b + ")"); } - index.put((byte) (b >> 16)); - index.put((byte) (b >> 8)); - index.put((byte) b); - - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("logdata.LIMB already set"); - } else { - filled.set(3); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("logdata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("logdata.SIZE_ACC has invalid value (" + b + ")"); } - sizeAcc.put((byte) (b >> 24)); - sizeAcc.put((byte) (b >> 16)); - sizeAcc.put((byte) (b >> 8)); - sizeAcc.put((byte) b); - - - return this; - } - - public Trace sizeLimb(final long b) { - if (filled.get(6)) { - throw new IllegalStateException("logdata.SIZE_LIMB already set"); - } else { - filled.set(6); - } - - if(b >= 32L) { throw new IllegalArgumentException("logdata.SIZE_LIMB has invalid value (" + b + ")"); } - sizeLimb.put((byte) b); - - - return this; - } - - public Trace sizeTotal(final long b) { - if (filled.get(7)) { - throw new IllegalStateException("logdata.SIZE_TOTAL already set"); - } else { - filled.set(7); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("logdata.SIZE_TOTAL has invalid value (" + b + ")"); } - sizeTotal.put((byte) (b >> 24)); - sizeTotal.put((byte) (b >> 16)); - sizeTotal.put((byte) (b >> 8)); - sizeTotal.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("logdata.ABS_LOG_NUM has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("logdata.ABS_LOG_NUM_MAX has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("logdata.INDEX has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("logdata.LIMB has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("logdata.LOGS_DATA has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("logdata.SIZE_ACC has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("logdata.SIZE_LIMB has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("logdata.SIZE_TOTAL has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - absLogNum.position(absLogNum.position() + 3); - } - - if (!filled.get(1)) { - absLogNumMax.position(absLogNumMax.position() + 3); - } - - if (!filled.get(2)) { - index.position(index.position() + 3); - } - - if (!filled.get(3)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(4)) { - logsData.position(logsData.position() + 1); - } - - if (!filled.get(5)) { - sizeAcc.position(sizeAcc.position() + 4); - } - - if (!filled.get(6)) { - sizeLimb.position(sizeLimb.position() + 1); - } - - if (!filled.get(7)) { - sizeTotal.position(sizeTotal.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java deleted file mode 100644 index bd8421645..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/loginfo/Trace.java +++ /dev/null @@ -1,802 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.loginfo; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absLogNum; - private final MappedByteBuffer absLogNumMax; - private final MappedByteBuffer absTxnNum; - private final MappedByteBuffer absTxnNumMax; - private final MappedByteBuffer addrHi; - private final MappedByteBuffer addrLo; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer dataHi; - private final MappedByteBuffer dataLo; - private final MappedByteBuffer dataSize; - private final MappedByteBuffer inst; - private final MappedByteBuffer isLogX0; - private final MappedByteBuffer isLogX1; - private final MappedByteBuffer isLogX2; - private final MappedByteBuffer isLogX3; - private final MappedByteBuffer isLogX4; - private final MappedByteBuffer phase; - private final MappedByteBuffer topicHi1; - private final MappedByteBuffer topicHi2; - private final MappedByteBuffer topicHi3; - private final MappedByteBuffer topicHi4; - private final MappedByteBuffer topicLo1; - private final MappedByteBuffer topicLo2; - private final MappedByteBuffer topicLo3; - private final MappedByteBuffer topicLo4; - private final MappedByteBuffer txnEmitsLogs; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_LOG_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM", 3, length)); - headers.add(new ColumnHeader("loginfo.ABS_TXN_NUM_MAX", 3, length)); - headers.add(new ColumnHeader("loginfo.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("loginfo.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("loginfo.CT", 1, length)); - headers.add(new ColumnHeader("loginfo.CT_MAX", 1, length)); - headers.add(new ColumnHeader("loginfo.DATA_HI", 16, length)); - headers.add(new ColumnHeader("loginfo.DATA_LO", 16, length)); - headers.add(new ColumnHeader("loginfo.DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("loginfo.INST", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_0", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_1", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_2", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_3", 1, length)); - headers.add(new ColumnHeader("loginfo.IS_LOG_X_4", 1, length)); - headers.add(new ColumnHeader("loginfo.PHASE", 2, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_1", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_2", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_3", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_HI_4", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_1", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_2", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_3", 32, length)); - headers.add(new ColumnHeader("loginfo.TOPIC_LO_4", 32, length)); - headers.add(new ColumnHeader("loginfo.TXN_EMITS_LOGS", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.absLogNum = buffers.get(0); - this.absLogNumMax = buffers.get(1); - this.absTxnNum = buffers.get(2); - this.absTxnNumMax = buffers.get(3); - this.addrHi = buffers.get(4); - this.addrLo = buffers.get(5); - this.ct = buffers.get(6); - this.ctMax = buffers.get(7); - this.dataHi = buffers.get(8); - this.dataLo = buffers.get(9); - this.dataSize = buffers.get(10); - this.inst = buffers.get(11); - this.isLogX0 = buffers.get(12); - this.isLogX1 = buffers.get(13); - this.isLogX2 = buffers.get(14); - this.isLogX3 = buffers.get(15); - this.isLogX4 = buffers.get(16); - this.phase = buffers.get(17); - this.topicHi1 = buffers.get(18); - this.topicHi2 = buffers.get(19); - this.topicHi3 = buffers.get(20); - this.topicHi4 = buffers.get(21); - this.topicLo1 = buffers.get(22); - this.topicLo2 = buffers.get(23); - this.topicLo3 = buffers.get(24); - this.topicLo4 = buffers.get(25); - this.txnEmitsLogs = buffers.get(26); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absLogNum(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("loginfo.ABS_LOG_NUM already set"); - } else { - filled.set(0); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_LOG_NUM has invalid value (" + b + ")"); } - absLogNum.put((byte) (b >> 16)); - absLogNum.put((byte) (b >> 8)); - absLogNum.put((byte) b); - - - return this; - } - - public Trace absLogNumMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("loginfo.ABS_LOG_NUM_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } - absLogNumMax.put((byte) (b >> 16)); - absLogNumMax.put((byte) (b >> 8)); - absLogNumMax.put((byte) b); - - - return this; - } - - public Trace absTxnNum(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("loginfo.ABS_TXN_NUM already set"); - } else { - filled.set(2); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_TXN_NUM has invalid value (" + b + ")"); } - absTxnNum.put((byte) (b >> 16)); - absTxnNum.put((byte) (b >> 8)); - absTxnNum.put((byte) b); - - - return this; - } - - public Trace absTxnNumMax(final long b) { - if (filled.get(3)) { - throw new IllegalStateException("loginfo.ABS_TXN_NUM_MAX already set"); - } else { - filled.set(3); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("loginfo.ABS_TXN_NUM_MAX has invalid value (" + b + ")"); } - absTxnNumMax.put((byte) (b >> 16)); - absTxnNumMax.put((byte) (b >> 8)); - absTxnNumMax.put((byte) b); - - - return this; - } - - public Trace addrHi(final long b) { - if (filled.get(4)) { - throw new IllegalStateException("loginfo.ADDR_HI already set"); - } else { - filled.set(4); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("loginfo.ADDR_HI has invalid value (" + b + ")"); } - addrHi.put((byte) (b >> 24)); - addrHi.put((byte) (b >> 16)); - addrHi.put((byte) (b >> 8)); - addrHi.put((byte) b); - - - return this; - } - - public Trace addrLo(final Bytes b) { - if (filled.get(5)) { - throw new IllegalStateException("loginfo.ADDR_LO already set"); - } else { - filled.set(5); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("loginfo.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("loginfo.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("loginfo.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("loginfo.DATA_SIZE has invalid value (" + b + ")"); } - dataSize.put((byte) (b >> 24)); - dataSize.put((byte) (b >> 16)); - dataSize.put((byte) (b >> 8)); - dataSize.put((byte) b); - - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(11)) { - throw new IllegalStateException("loginfo.INST already set"); - } else { - filled.set(11); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace isLogX0(final Boolean b) { - if (filled.get(12)) { - throw new IllegalStateException("loginfo.IS_LOG_X_0 already set"); - } else { - filled.set(12); - } - - isLogX0.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isLogX1(final Boolean b) { - if (filled.get(13)) { - throw new IllegalStateException("loginfo.IS_LOG_X_1 already set"); - } else { - filled.set(13); - } - - isLogX1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isLogX2(final Boolean b) { - if (filled.get(14)) { - throw new IllegalStateException("loginfo.IS_LOG_X_2 already set"); - } else { - filled.set(14); - } - - isLogX2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isLogX3(final Boolean b) { - if (filled.get(15)) { - throw new IllegalStateException("loginfo.IS_LOG_X_3 already set"); - } else { - filled.set(15); - } - - isLogX3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isLogX4(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("loginfo.IS_LOG_X_4 already set"); - } else { - filled.set(16); - } - - isLogX4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phase(final long b) { - if (filled.get(17)) { - throw new IllegalStateException("loginfo.PHASE already set"); - } else { - filled.set(17); - } - - if(b >= 65536L) { throw new IllegalArgumentException("loginfo.PHASE has invalid value (" + b + ")"); } - phase.put((byte) (b >> 8)); - phase.put((byte) b); - - - return this; - } - - public Trace topicHi1(final Bytes b) { - if (filled.get(18)) { - throw new IllegalStateException("loginfo.TOPIC_HI_1 already set"); - } else { - filled.set(18); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicHi1.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicHi2.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicHi3.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_HI_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicHi4.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicLo1.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicLo2.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicLo3.put((byte) 0); } - // Write bytes - for(int j=0; j 256) { throw new IllegalArgumentException("loginfo.TOPIC_LO_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { topicLo4.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer accA; - private final MappedByteBuffer accB; - private final MappedByteBuffer accC; - private final MappedByteBuffer accLimb; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bit2; - private final MappedByteBuffer bit3; - private final MappedByteBuffer bit4; - private final MappedByteBuffer bit5; - private final MappedByteBuffer byteA; - private final MappedByteBuffer byteB; - private final MappedByteBuffer byteC; - private final MappedByteBuffer byteLimb; - private final MappedByteBuffer cnA; - private final MappedByteBuffer cnB; - private final MappedByteBuffer cnC; - private final MappedByteBuffer contextSource; - private final MappedByteBuffer contextTarget; - private final MappedByteBuffer counter; - private final MappedByteBuffer exoId; - private final MappedByteBuffer exoIsBlakemodexp; - private final MappedByteBuffer exoIsEcdata; - private final MappedByteBuffer exoIsKec; - private final MappedByteBuffer exoIsLog; - private final MappedByteBuffer exoIsRipsha; - private final MappedByteBuffer exoIsRom; - private final MappedByteBuffer exoIsTxcd; - private final MappedByteBuffer exoSum; - private final MappedByteBuffer fast; - private final MappedByteBuffer indexA; - private final MappedByteBuffer indexB; - private final MappedByteBuffer indexC; - private final MappedByteBuffer indexX; - private final MappedByteBuffer isLimbToRamOneTarget; - private final MappedByteBuffer isLimbToRamTransplant; - private final MappedByteBuffer isLimbToRamTwoTarget; - private final MappedByteBuffer isLimbVanishes; - private final MappedByteBuffer isRamExcision; - private final MappedByteBuffer isRamToLimbOneSource; - private final MappedByteBuffer isRamToLimbTransplant; - private final MappedByteBuffer isRamToLimbTwoSource; - private final MappedByteBuffer isRamToRamPartial; - private final MappedByteBuffer isRamToRamTransplant; - private final MappedByteBuffer isRamToRamTwoSource; - private final MappedByteBuffer isRamToRamTwoTarget; - private final MappedByteBuffer isRamVanishes; - private final MappedByteBuffer kecId; - private final MappedByteBuffer limb; - private final MappedByteBuffer mmioInstruction; - private final MappedByteBuffer mmioStamp; - private final MappedByteBuffer phase; - private final MappedByteBuffer pow2561; - private final MappedByteBuffer pow2562; - private final MappedByteBuffer size; - private final MappedByteBuffer slow; - private final MappedByteBuffer sourceByteOffset; - private final MappedByteBuffer sourceLimbOffset; - private final MappedByteBuffer successBit; - private final MappedByteBuffer targetByteOffset; - private final MappedByteBuffer targetLimbOffset; - private final MappedByteBuffer totalSize; - private final MappedByteBuffer valA; - private final MappedByteBuffer valANew; - private final MappedByteBuffer valB; - private final MappedByteBuffer valBNew; - private final MappedByteBuffer valC; - private final MappedByteBuffer valCNew; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mmio.ACC_1", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_2", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_3", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_4", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_A", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_B", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_C", 16, length)); - headers.add(new ColumnHeader("mmio.ACC_LIMB", 16, length)); - headers.add(new ColumnHeader("mmio.BIT_1", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_2", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_3", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_4", 1, length)); - headers.add(new ColumnHeader("mmio.BIT_5", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_A", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_B", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_C", 1, length)); - headers.add(new ColumnHeader("mmio.BYTE_LIMB", 1, length)); - headers.add(new ColumnHeader("mmio.CN_A", 8, length)); - headers.add(new ColumnHeader("mmio.CN_B", 8, length)); - headers.add(new ColumnHeader("mmio.CN_C", 8, length)); - headers.add(new ColumnHeader("mmio.CONTEXT_SOURCE", 8, length)); - headers.add(new ColumnHeader("mmio.CONTEXT_TARGET", 8, length)); - headers.add(new ColumnHeader("mmio.COUNTER", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_ID", 4, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_BLAKEMODEXP", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_ECDATA", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_KEC", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_LOG", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_RIPSHA", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_ROM", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_IS_TXCD", 1, length)); - headers.add(new ColumnHeader("mmio.EXO_SUM", 4, length)); - headers.add(new ColumnHeader("mmio.FAST", 1, length)); - headers.add(new ColumnHeader("mmio.INDEX_A", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_B", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_C", 8, length)); - headers.add(new ColumnHeader("mmio.INDEX_X", 8, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_ONE_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_TO_RAM_TWO_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_LIMB_VANISHES", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_EXCISION", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_ONE_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_LIMB_TWO_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_PARTIAL", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TRANSPLANT", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_SOURCE", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_TO_RAM_TWO_TARGET", 1, length)); - headers.add(new ColumnHeader("mmio.IS_RAM_VANISHES", 1, length)); - headers.add(new ColumnHeader("mmio.KEC_ID", 4, length)); - headers.add(new ColumnHeader("mmio.LIMB", 16, length)); - headers.add(new ColumnHeader("mmio.MMIO_INSTRUCTION", 2, length)); - headers.add(new ColumnHeader("mmio.MMIO_STAMP", 4, length)); - headers.add(new ColumnHeader("mmio.PHASE", 4, length)); - headers.add(new ColumnHeader("mmio.POW_256_1", 16, length)); - headers.add(new ColumnHeader("mmio.POW_256_2", 16, length)); - headers.add(new ColumnHeader("mmio.SIZE", 8, length)); - headers.add(new ColumnHeader("mmio.SLOW", 1, length)); - headers.add(new ColumnHeader("mmio.SOURCE_BYTE_OFFSET", 1, length)); - headers.add(new ColumnHeader("mmio.SOURCE_LIMB_OFFSET", 8, length)); - headers.add(new ColumnHeader("mmio.SUCCESS_BIT", 1, length)); - headers.add(new ColumnHeader("mmio.TARGET_BYTE_OFFSET", 1, length)); - headers.add(new ColumnHeader("mmio.TARGET_LIMB_OFFSET", 8, length)); - headers.add(new ColumnHeader("mmio.TOTAL_SIZE", 8, length)); - headers.add(new ColumnHeader("mmio.VAL_A", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_A_NEW", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_B", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_B_NEW", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_C", 16, length)); - headers.add(new ColumnHeader("mmio.VAL_C_NEW", 16, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.acc3 = buffers.get(2); - this.acc4 = buffers.get(3); - this.accA = buffers.get(4); - this.accB = buffers.get(5); - this.accC = buffers.get(6); - this.accLimb = buffers.get(7); - this.bit1 = buffers.get(8); - this.bit2 = buffers.get(9); - this.bit3 = buffers.get(10); - this.bit4 = buffers.get(11); - this.bit5 = buffers.get(12); - this.byteA = buffers.get(13); - this.byteB = buffers.get(14); - this.byteC = buffers.get(15); - this.byteLimb = buffers.get(16); - this.cnA = buffers.get(17); - this.cnB = buffers.get(18); - this.cnC = buffers.get(19); - this.contextSource = buffers.get(20); - this.contextTarget = buffers.get(21); - this.counter = buffers.get(22); - this.exoId = buffers.get(23); - this.exoIsBlakemodexp = buffers.get(24); - this.exoIsEcdata = buffers.get(25); - this.exoIsKec = buffers.get(26); - this.exoIsLog = buffers.get(27); - this.exoIsRipsha = buffers.get(28); - this.exoIsRom = buffers.get(29); - this.exoIsTxcd = buffers.get(30); - this.exoSum = buffers.get(31); - this.fast = buffers.get(32); - this.indexA = buffers.get(33); - this.indexB = buffers.get(34); - this.indexC = buffers.get(35); - this.indexX = buffers.get(36); - this.isLimbToRamOneTarget = buffers.get(37); - this.isLimbToRamTransplant = buffers.get(38); - this.isLimbToRamTwoTarget = buffers.get(39); - this.isLimbVanishes = buffers.get(40); - this.isRamExcision = buffers.get(41); - this.isRamToLimbOneSource = buffers.get(42); - this.isRamToLimbTransplant = buffers.get(43); - this.isRamToLimbTwoSource = buffers.get(44); - this.isRamToRamPartial = buffers.get(45); - this.isRamToRamTransplant = buffers.get(46); - this.isRamToRamTwoSource = buffers.get(47); - this.isRamToRamTwoTarget = buffers.get(48); - this.isRamVanishes = buffers.get(49); - this.kecId = buffers.get(50); - this.limb = buffers.get(51); - this.mmioInstruction = buffers.get(52); - this.mmioStamp = buffers.get(53); - this.phase = buffers.get(54); - this.pow2561 = buffers.get(55); - this.pow2562 = buffers.get(56); - this.size = buffers.get(57); - this.slow = buffers.get(58); - this.sourceByteOffset = buffers.get(59); - this.sourceLimbOffset = buffers.get(60); - this.successBit = buffers.get(61); - this.targetByteOffset = buffers.get(62); - this.targetLimbOffset = buffers.get(63); - this.totalSize = buffers.get(64); - this.valA = buffers.get(65); - this.valANew = buffers.get(66); - this.valB = buffers.get(67); - this.valBNew = buffers.get(68); - this.valC = buffers.get(69); - this.valCNew = buffers.get(70); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("mmio.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accA.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_B has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accB.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_C has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accC.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.ACC_LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accLimb.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.CN_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cnA.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.CN_B has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cnB.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.CN_C has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cnC.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.CONTEXT_SOURCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { contextSource.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.CONTEXT_TARGET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { contextTarget.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("mmio.COUNTER has invalid value (" + b + ")"); } - counter.put((byte) b); - - - return this; - } - - public Trace exoId(final long b) { - if (filled.get(23)) { - throw new IllegalStateException("mmio.EXO_ID already set"); - } else { - filled.set(23); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.EXO_ID has invalid value (" + b + ")"); } - exoId.put((byte) (b >> 24)); - exoId.put((byte) (b >> 16)); - exoId.put((byte) (b >> 8)); - exoId.put((byte) b); - - - return this; - } - - public Trace exoIsBlakemodexp(final Boolean b) { - if (filled.get(24)) { - throw new IllegalStateException("mmio.EXO_IS_BLAKEMODEXP already set"); - } else { - filled.set(24); - } - - exoIsBlakemodexp.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsEcdata(final Boolean b) { - if (filled.get(25)) { - throw new IllegalStateException("mmio.EXO_IS_ECDATA already set"); - } else { - filled.set(25); - } - - exoIsEcdata.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsKec(final Boolean b) { - if (filled.get(26)) { - throw new IllegalStateException("mmio.EXO_IS_KEC already set"); - } else { - filled.set(26); - } - - exoIsKec.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsLog(final Boolean b) { - if (filled.get(27)) { - throw new IllegalStateException("mmio.EXO_IS_LOG already set"); - } else { - filled.set(27); - } - - exoIsLog.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsRipsha(final Boolean b) { - if (filled.get(28)) { - throw new IllegalStateException("mmio.EXO_IS_RIPSHA already set"); - } else { - filled.set(28); - } - - exoIsRipsha.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsRom(final Boolean b) { - if (filled.get(29)) { - throw new IllegalStateException("mmio.EXO_IS_ROM already set"); - } else { - filled.set(29); - } - - exoIsRom.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoIsTxcd(final Boolean b) { - if (filled.get(30)) { - throw new IllegalStateException("mmio.EXO_IS_TXCD already set"); - } else { - filled.set(30); - } - - exoIsTxcd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exoSum(final long b) { - if (filled.get(31)) { - throw new IllegalStateException("mmio.EXO_SUM already set"); - } else { - filled.set(31); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.EXO_SUM has invalid value (" + b + ")"); } - exoSum.put((byte) (b >> 24)); - exoSum.put((byte) (b >> 16)); - exoSum.put((byte) (b >> 8)); - exoSum.put((byte) b); - - - return this; - } - - public Trace fast(final Boolean b) { - if (filled.get(32)) { - throw new IllegalStateException("mmio.FAST already set"); - } else { - filled.set(32); - } - - fast.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace indexA(final Bytes b) { - if (filled.get(33)) { - throw new IllegalStateException("mmio.INDEX_A already set"); - } else { - filled.set(33); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.INDEX_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { indexA.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.INDEX_B has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { indexB.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.INDEX_C has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { indexC.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.INDEX_X has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { indexX.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmio.KEC_ID has invalid value (" + b + ")"); } - kecId.put((byte) (b >> 24)); - kecId.put((byte) (b >> 16)); - kecId.put((byte) (b >> 8)); - kecId.put((byte) b); - - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(51)) { - throw new IllegalStateException("mmio.LIMB already set"); - } else { - filled.set(51); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("mmio.MMIO_INSTRUCTION has invalid value (" + b + ")"); } - mmioInstruction.put((byte) (b >> 8)); - mmioInstruction.put((byte) b); - - - return this; - } - - public Trace mmioStamp(final long b) { - if (filled.get(53)) { - throw new IllegalStateException("mmio.MMIO_STAMP already set"); - } else { - filled.set(53); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.MMIO_STAMP has invalid value (" + b + ")"); } - mmioStamp.put((byte) (b >> 24)); - mmioStamp.put((byte) (b >> 16)); - mmioStamp.put((byte) (b >> 8)); - mmioStamp.put((byte) b); - - - return this; - } - - public Trace phase(final long b) { - if (filled.get(54)) { - throw new IllegalStateException("mmio.PHASE already set"); - } else { - filled.set(54); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmio.PHASE has invalid value (" + b + ")"); } - phase.put((byte) (b >> 24)); - phase.put((byte) (b >> 16)); - phase.put((byte) (b >> 8)); - phase.put((byte) b); - - - return this; - } - - public Trace pow2561(final Bytes b) { - if (filled.get(55)) { - throw new IllegalStateException("mmio.POW_256_1 already set"); - } else { - filled.set(55); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmio.POW_256_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { pow2561.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.POW_256_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { pow2562.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.SIZE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { size.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("mmio.SOURCE_BYTE_OFFSET has invalid value (" + b + ")"); } - sourceByteOffset.put((byte) b); - - - return this; - } - - public Trace sourceLimbOffset(final Bytes b) { - if (filled.get(60)) { - throw new IllegalStateException("mmio.SOURCE_LIMB_OFFSET already set"); - } else { - filled.set(60); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.SOURCE_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { sourceLimbOffset.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("mmio.TARGET_BYTE_OFFSET has invalid value (" + b + ")"); } - targetByteOffset.put((byte) b); - - - return this; - } - - public Trace targetLimbOffset(final Bytes b) { - if (filled.get(63)) { - throw new IllegalStateException("mmio.TARGET_LIMB_OFFSET already set"); - } else { - filled.set(63); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmio.TARGET_LIMB_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { targetLimbOffset.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmio.TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { totalSize.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valA.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_A_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valANew.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_B has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valB.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_B_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valBNew.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_C has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valC.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmio.VAL_C_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valCNew.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int NB_MICRO_ROWS_TOT_BLAKE = 0x2; - public static final int NB_MICRO_ROWS_TOT_INVALID_CODE_PREFIX = 0x1; - public static final int NB_MICRO_ROWS_TOT_MLOAD = 0x2; - public static final int NB_MICRO_ROWS_TOT_MODEXP_DATA = 0x20; - public static final int NB_MICRO_ROWS_TOT_MODEXP_ZERO = 0x20; - public static final int NB_MICRO_ROWS_TOT_MSTORE = 0x2; - public static final int NB_MICRO_ROWS_TOT_MSTORE_EIGHT = 0x1; - public static final int NB_MICRO_ROWS_TOT_RIGHT_PADDED_WORD_EXTRACTION = 0x2; - public static final int NB_PP_ROWS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING = 0x4; - public static final int NB_PP_ROWS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING_PO = 0x5; - public static final int NB_PP_ROWS_ANY_TO_RAM_WITH_PADDING_SOME_DATA = 0xa; - public static final int NB_PP_ROWS_ANY_TO_RAM_WITH_PADDING_SOME_DATA_PO = 0xb; - public static final int NB_PP_ROWS_BLAKE = 0x2; - public static final int NB_PP_ROWS_BLAKE_PO = 0x3; - public static final int NB_PP_ROWS_BLAKE_PT = 0x4; - public static final int NB_PP_ROWS_EXO_TO_RAM_TRANSPLANTS = 0x1; - public static final int NB_PP_ROWS_EXO_TO_RAM_TRANSPLANTS_PO = 0x2; - public static final int NB_PP_ROWS_INVALID_CODE_PREFIX = 0x1; - public static final int NB_PP_ROWS_INVALID_CODE_PREFIX_PO = 0x2; - public static final int NB_PP_ROWS_MLOAD = 0x1; - public static final int NB_PP_ROWS_MLOAD_PO = 0x2; - public static final int NB_PP_ROWS_MLOAD_PT = 0x3; - public static final int NB_PP_ROWS_MODEXP_DATA = 0x6; - public static final int NB_PP_ROWS_MODEXP_DATA_PO = 0x7; - public static final int NB_PP_ROWS_MODEXP_ZERO = 0x1; - public static final int NB_PP_ROWS_MODEXP_ZERO_PO = 0x2; - public static final int NB_PP_ROWS_MSTORE = 0x1; - public static final int NB_PP_ROWS_MSTORE8 = 0x1; - public static final int NB_PP_ROWS_MSTORE8_PO = 0x2; - public static final int NB_PP_ROWS_MSTORE_PO = 0x2; - public static final int NB_PP_ROWS_MSTORE_PT = 0x3; - public static final int NB_PP_ROWS_RAM_TO_EXO_WITH_PADDING = 0x4; - public static final int NB_PP_ROWS_RAM_TO_EXO_WITH_PADDING_PO = 0x5; - public static final int NB_PP_ROWS_RAM_TO_RAM_SANS_PADDING = 0x5; - public static final int NB_PP_ROWS_RAM_TO_RAM_SANS_PADDING_PO = 0x6; - public static final int NB_PP_ROWS_RIGHT_PADDED_WORD_EXTRACTION = 0x5; - public static final int NB_PP_ROWS_RIGHT_PADDED_WORD_EXTRACTION_PO = 0x6; - public static final int NB_PP_ROWS_RIGHT_PADDED_WORD_EXTRACTION_PT = 0x7; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer auxIdXorCnSXorEucA; - private final MappedByteBuffer bin1; - private final MappedByteBuffer bin2; - private final MappedByteBuffer bin3; - private final MappedByteBuffer bin4; - private final MappedByteBuffer bin5; - private final MappedByteBuffer exoSumXorExoId; - private final MappedByteBuffer instXorInstXorCt; - private final MappedByteBuffer isAnyToRamWithPaddingPurePadding; - private final MappedByteBuffer isAnyToRamWithPaddingSomeData; - private final MappedByteBuffer isBlake; - private final MappedByteBuffer isExoToRamTransplants; - private final MappedByteBuffer isInvalidCodePrefix; - private final MappedByteBuffer isMload; - private final MappedByteBuffer isModexpData; - private final MappedByteBuffer isModexpZero; - private final MappedByteBuffer isMstore; - private final MappedByteBuffer isMstore8; - private final MappedByteBuffer isRamToExoWithPadding; - private final MappedByteBuffer isRamToRamSansPadding; - private final MappedByteBuffer isRightPaddedWordExtraction; - private final MappedByteBuffer kecId; - private final MappedByteBuffer limb1XorLimbXorWcpArg1Hi; - private final MappedByteBuffer limb2XorWcpArg1Lo; - private final MappedByteBuffer lzro; - private final MappedByteBuffer macro; - private final MappedByteBuffer micro; - private final MappedByteBuffer mmioStamp; - private final MappedByteBuffer ntFirst; - private final MappedByteBuffer ntLast; - private final MappedByteBuffer ntMddl; - private final MappedByteBuffer ntOnly; - private final MappedByteBuffer out1; - private final MappedByteBuffer out2; - private final MappedByteBuffer out3; - private final MappedByteBuffer out4; - private final MappedByteBuffer out5; - private final MappedByteBuffer phase; - private final MappedByteBuffer phaseXorExoSum; - private final MappedByteBuffer prprc; - private final MappedByteBuffer refOffsetXorCnTXorEucB; - private final MappedByteBuffer refSizeXorSloXorEucCeil; - private final MappedByteBuffer rzFirst; - private final MappedByteBuffer rzLast; - private final MappedByteBuffer rzMddl; - private final MappedByteBuffer rzOnly; - private final MappedByteBuffer sboXorWcpInst; - private final MappedByteBuffer size; - private final MappedByteBuffer sizeXorTloXorEucQuot; - private final MappedByteBuffer srcIdXorTotalSizeXorEucRem; - private final MappedByteBuffer srcOffsetHiXorWcpArg2Lo; - private final MappedByteBuffer srcOffsetLo; - private final MappedByteBuffer stamp; - private final MappedByteBuffer successBitXorSuccessBitXorEucFlag; - private final MappedByteBuffer tbo; - private final MappedByteBuffer tgtId; - private final MappedByteBuffer tgtOffsetLo; - private final MappedByteBuffer tot; - private final MappedByteBuffer totlz; - private final MappedByteBuffer totnt; - private final MappedByteBuffer totrz; - private final MappedByteBuffer wcpFlag; - private final MappedByteBuffer wcpRes; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mmu.AUX_ID_xor_CN_S_xor_EUC_A", 8, length)); - headers.add(new ColumnHeader("mmu.BIN_1", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_2", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_3", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_4", 1, length)); - headers.add(new ColumnHeader("mmu.BIN_5", 1, length)); - headers.add(new ColumnHeader("mmu.EXO_SUM_xor_EXO_ID", 4, length)); - headers.add(new ColumnHeader("mmu.INST_xor_INST_xor_CT", 2, length)); - headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA", 1, length)); - headers.add(new ColumnHeader("mmu.IS_BLAKE", 1, length)); - headers.add(new ColumnHeader("mmu.IS_EXO_TO_RAM_TRANSPLANTS", 1, length)); - headers.add(new ColumnHeader("mmu.IS_INVALID_CODE_PREFIX", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MLOAD", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MODEXP_DATA", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MODEXP_ZERO", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MSTORE", 1, length)); - headers.add(new ColumnHeader("mmu.IS_MSTORE8", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RAM_TO_EXO_WITH_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RAM_TO_RAM_SANS_PADDING", 1, length)); - headers.add(new ColumnHeader("mmu.IS_RIGHT_PADDED_WORD_EXTRACTION", 1, length)); - headers.add(new ColumnHeader("mmu.KEC_ID", 4, length)); - headers.add(new ColumnHeader("mmu.LIMB_1_xor_LIMB_xor_WCP_ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mmu.LIMB_2_xor_WCP_ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mmu.LZRO", 1, length)); - headers.add(new ColumnHeader("mmu.MACRO", 1, length)); - headers.add(new ColumnHeader("mmu.MICRO", 1, length)); - headers.add(new ColumnHeader("mmu.MMIO_STAMP", 4, length)); - headers.add(new ColumnHeader("mmu.NT_FIRST", 1, length)); - headers.add(new ColumnHeader("mmu.NT_LAST", 1, length)); - headers.add(new ColumnHeader("mmu.NT_MDDL", 1, length)); - headers.add(new ColumnHeader("mmu.NT_ONLY", 1, length)); - headers.add(new ColumnHeader("mmu.OUT_1", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_2", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_3", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_4", 8, length)); - headers.add(new ColumnHeader("mmu.OUT_5", 8, length)); - headers.add(new ColumnHeader("mmu.PHASE", 4, length)); - headers.add(new ColumnHeader("mmu.PHASE_xor_EXO_SUM", 4, length)); - headers.add(new ColumnHeader("mmu.PRPRC", 1, length)); - headers.add(new ColumnHeader("mmu.REF_OFFSET_xor_CN_T_xor_EUC_B", 8, length)); - headers.add(new ColumnHeader("mmu.REF_SIZE_xor_SLO_xor_EUC_CEIL", 8, length)); - headers.add(new ColumnHeader("mmu.RZ_FIRST", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_LAST", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_MDDL", 1, length)); - headers.add(new ColumnHeader("mmu.RZ_ONLY", 1, length)); - headers.add(new ColumnHeader("mmu.SBO_xor_WCP_INST", 1, length)); - headers.add(new ColumnHeader("mmu.SIZE", 1, length)); - headers.add(new ColumnHeader("mmu.SIZE_xor_TLO_xor_EUC_QUOT", 8, length)); - headers.add(new ColumnHeader("mmu.SRC_ID_xor_TOTAL_SIZE_xor_EUC_REM", 8, length)); - headers.add(new ColumnHeader("mmu.SRC_OFFSET_HI_xor_WCP_ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mmu.SRC_OFFSET_LO", 16, length)); - headers.add(new ColumnHeader("mmu.STAMP", 4, length)); - headers.add(new ColumnHeader("mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("mmu.TBO", 1, length)); - headers.add(new ColumnHeader("mmu.TGT_ID", 8, length)); - headers.add(new ColumnHeader("mmu.TGT_OFFSET_LO", 8, length)); - headers.add(new ColumnHeader("mmu.TOT", 4, length)); - headers.add(new ColumnHeader("mmu.TOTLZ", 4, length)); - headers.add(new ColumnHeader("mmu.TOTNT", 4, length)); - headers.add(new ColumnHeader("mmu.TOTRZ", 4, length)); - headers.add(new ColumnHeader("mmu.WCP_FLAG", 1, length)); - headers.add(new ColumnHeader("mmu.WCP_RES", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.auxIdXorCnSXorEucA = buffers.get(0); - this.bin1 = buffers.get(1); - this.bin2 = buffers.get(2); - this.bin3 = buffers.get(3); - this.bin4 = buffers.get(4); - this.bin5 = buffers.get(5); - this.exoSumXorExoId = buffers.get(6); - this.instXorInstXorCt = buffers.get(7); - this.isAnyToRamWithPaddingPurePadding = buffers.get(8); - this.isAnyToRamWithPaddingSomeData = buffers.get(9); - this.isBlake = buffers.get(10); - this.isExoToRamTransplants = buffers.get(11); - this.isInvalidCodePrefix = buffers.get(12); - this.isMload = buffers.get(13); - this.isModexpData = buffers.get(14); - this.isModexpZero = buffers.get(15); - this.isMstore = buffers.get(16); - this.isMstore8 = buffers.get(17); - this.isRamToExoWithPadding = buffers.get(18); - this.isRamToRamSansPadding = buffers.get(19); - this.isRightPaddedWordExtraction = buffers.get(20); - this.kecId = buffers.get(21); - this.limb1XorLimbXorWcpArg1Hi = buffers.get(22); - this.limb2XorWcpArg1Lo = buffers.get(23); - this.lzro = buffers.get(24); - this.macro = buffers.get(25); - this.micro = buffers.get(26); - this.mmioStamp = buffers.get(27); - this.ntFirst = buffers.get(28); - this.ntLast = buffers.get(29); - this.ntMddl = buffers.get(30); - this.ntOnly = buffers.get(31); - this.out1 = buffers.get(32); - this.out2 = buffers.get(33); - this.out3 = buffers.get(34); - this.out4 = buffers.get(35); - this.out5 = buffers.get(36); - this.phase = buffers.get(37); - this.phaseXorExoSum = buffers.get(38); - this.prprc = buffers.get(39); - this.refOffsetXorCnTXorEucB = buffers.get(40); - this.refSizeXorSloXorEucCeil = buffers.get(41); - this.rzFirst = buffers.get(42); - this.rzLast = buffers.get(43); - this.rzMddl = buffers.get(44); - this.rzOnly = buffers.get(45); - this.sboXorWcpInst = buffers.get(46); - this.size = buffers.get(47); - this.sizeXorTloXorEucQuot = buffers.get(48); - this.srcIdXorTotalSizeXorEucRem = buffers.get(49); - this.srcOffsetHiXorWcpArg2Lo = buffers.get(50); - this.srcOffsetLo = buffers.get(51); - this.stamp = buffers.get(52); - this.successBitXorSuccessBitXorEucFlag = buffers.get(53); - this.tbo = buffers.get(54); - this.tgtId = buffers.get(55); - this.tgtOffsetLo = buffers.get(56); - this.tot = buffers.get(57); - this.totlz = buffers.get(58); - this.totnt = buffers.get(59); - this.totrz = buffers.get(60); - this.wcpFlag = buffers.get(61); - this.wcpRes = buffers.get(62); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace bin1(final Boolean b) { - if (filled.get(0)) { - throw new IllegalStateException("mmu.BIN_1 already set"); - } else { - filled.set(0); - } - - bin1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace bin2(final Boolean b) { - if (filled.get(1)) { - throw new IllegalStateException("mmu.BIN_2 already set"); - } else { - filled.set(1); - } - - bin2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace bin3(final Boolean b) { - if (filled.get(2)) { - throw new IllegalStateException("mmu.BIN_3 already set"); - } else { - filled.set(2); - } - - bin3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace bin4(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("mmu.BIN_4 already set"); - } else { - filled.set(3); - } - - bin4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace bin5(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("mmu.BIN_5 already set"); - } else { - filled.set(4); - } - - bin5.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isAnyToRamWithPaddingPurePadding(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING already set"); - } else { - filled.set(5); - } - - isAnyToRamWithPaddingPurePadding.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isAnyToRamWithPaddingSomeData(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA already set"); - } else { - filled.set(6); - } - - isAnyToRamWithPaddingSomeData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isBlake(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("mmu.IS_BLAKE already set"); - } else { - filled.set(7); - } - - isBlake.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isExoToRamTransplants(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("mmu.IS_EXO_TO_RAM_TRANSPLANTS already set"); - } else { - filled.set(8); - } - - isExoToRamTransplants.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isInvalidCodePrefix(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("mmu.IS_INVALID_CODE_PREFIX already set"); - } else { - filled.set(9); - } - - isInvalidCodePrefix.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isMload(final Boolean b) { - if (filled.get(10)) { - throw new IllegalStateException("mmu.IS_MLOAD already set"); - } else { - filled.set(10); - } - - isMload.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpData(final Boolean b) { - if (filled.get(11)) { - throw new IllegalStateException("mmu.IS_MODEXP_DATA already set"); - } else { - filled.set(11); - } - - isModexpData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isModexpZero(final Boolean b) { - if (filled.get(12)) { - throw new IllegalStateException("mmu.IS_MODEXP_ZERO already set"); - } else { - filled.set(12); - } - - isModexpZero.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isMstore(final Boolean b) { - if (filled.get(13)) { - throw new IllegalStateException("mmu.IS_MSTORE already set"); - } else { - filled.set(13); - } - - isMstore.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isMstore8(final Boolean b) { - if (filled.get(14)) { - throw new IllegalStateException("mmu.IS_MSTORE8 already set"); - } else { - filled.set(14); - } - - isMstore8.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isRamToExoWithPadding(final Boolean b) { - if (filled.get(15)) { - throw new IllegalStateException("mmu.IS_RAM_TO_EXO_WITH_PADDING already set"); - } else { - filled.set(15); - } - - isRamToExoWithPadding.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isRamToRamSansPadding(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("mmu.IS_RAM_TO_RAM_SANS_PADDING already set"); - } else { - filled.set(16); - } - - isRamToRamSansPadding.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isRightPaddedWordExtraction(final Boolean b) { - if (filled.get(17)) { - throw new IllegalStateException("mmu.IS_RIGHT_PADDED_WORD_EXTRACTION already set"); - } else { - filled.set(17); - } - - isRightPaddedWordExtraction.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace lzro(final Boolean b) { - if (filled.get(18)) { - throw new IllegalStateException("mmu.LZRO already set"); - } else { - filled.set(18); - } - - lzro.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace macro(final Boolean b) { - if (filled.get(19)) { - throw new IllegalStateException("mmu.MACRO already set"); - } else { - filled.set(19); - } - - macro.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace micro(final Boolean b) { - if (filled.get(20)) { - throw new IllegalStateException("mmu.MICRO already set"); - } else { - filled.set(20); - } - - micro.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mmioStamp(final long b) { - if (filled.get(21)) { - throw new IllegalStateException("mmu.MMIO_STAMP already set"); - } else { - filled.set(21); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.MMIO_STAMP has invalid value (" + b + ")"); } - mmioStamp.put((byte) (b >> 24)); - mmioStamp.put((byte) (b >> 16)); - mmioStamp.put((byte) (b >> 8)); - mmioStamp.put((byte) b); - - - return this; - } - - public Trace ntFirst(final Boolean b) { - if (filled.get(22)) { - throw new IllegalStateException("mmu.NT_FIRST already set"); - } else { - filled.set(22); - } - - ntFirst.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ntLast(final Boolean b) { - if (filled.get(23)) { - throw new IllegalStateException("mmu.NT_LAST already set"); - } else { - filled.set(23); - } - - ntLast.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ntMddl(final Boolean b) { - if (filled.get(24)) { - throw new IllegalStateException("mmu.NT_MDDL already set"); - } else { - filled.set(24); - } - - ntMddl.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ntOnly(final Boolean b) { - if (filled.get(25)) { - throw new IllegalStateException("mmu.NT_ONLY already set"); - } else { - filled.set(25); - } - - ntOnly.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace out1(final Bytes b) { - if (filled.get(26)) { - throw new IllegalStateException("mmu.OUT_1 already set"); - } else { - filled.set(26); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.OUT_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { out1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.OUT_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { out2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.OUT_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { out3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.OUT_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { out4.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.OUT_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { out5.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/AUX_ID has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmu.macro/EXO_SUM has invalid value (" + b + ")"); } - exoSumXorExoId.put((byte) (b >> 24)); - exoSumXorExoId.put((byte) (b >> 16)); - exoSumXorExoId.put((byte) (b >> 8)); - exoSumXorExoId.put((byte) b); - - - return this; - } - - public Trace pMacroInst(final long b) { - if (filled.get(47)) { - throw new IllegalStateException("mmu.macro/INST already set"); - } else { - filled.set(47); - } - - if(b >= 65536L) { throw new IllegalArgumentException("mmu.macro/INST has invalid value (" + b + ")"); } - instXorInstXorCt.put((byte) (b >> 8)); - instXorInstXorCt.put((byte) b); - - - return this; - } - - public Trace pMacroLimb1(final Bytes b) { - if (filled.get(59)) { - throw new IllegalStateException("mmu.macro/LIMB_1 already set"); - } else { - filled.set(59); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.macro/LIMB_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.macro/LIMB_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb2XorWcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmu.macro/PHASE has invalid value (" + b + ")"); } - phaseXorExoSum.put((byte) (b >> 24)); - phaseXorExoSum.put((byte) (b >> 16)); - phaseXorExoSum.put((byte) (b >> 8)); - phaseXorExoSum.put((byte) b); - - - return this; - } - - public Trace pMacroRefOffset(final Bytes b) { - if (filled.get(53)) { - throw new IllegalStateException("mmu.macro/REF_OFFSET already set"); - } else { - filled.set(53); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.macro/REF_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/REF_SIZE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/SIZE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/SRC_ID has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.macro/SRC_OFFSET_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { srcOffsetHiXorWcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.macro/SRC_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { srcOffsetLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/TGT_ID has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { tgtId.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.macro/TGT_OFFSET_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { tgtOffsetLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.micro/CN_S has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.micro/CN_T has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmu.micro/EXO_ID has invalid value (" + b + ")"); } - exoSumXorExoId.put((byte) (b >> 24)); - exoSumXorExoId.put((byte) (b >> 16)); - exoSumXorExoId.put((byte) (b >> 8)); - exoSumXorExoId.put((byte) b); - - - return this; - } - - public Trace pMicroExoSum(final long b) { - if (filled.get(49)) { - throw new IllegalStateException("mmu.micro/EXO_SUM already set"); - } else { - filled.set(49); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/EXO_SUM has invalid value (" + b + ")"); } - phaseXorExoSum.put((byte) (b >> 24)); - phaseXorExoSum.put((byte) (b >> 16)); - phaseXorExoSum.put((byte) (b >> 8)); - phaseXorExoSum.put((byte) b); - - - return this; - } - - public Trace pMicroInst(final long b) { - if (filled.get(47)) { - throw new IllegalStateException("mmu.micro/INST already set"); - } else { - filled.set(47); - } - - if(b >= 65536L) { throw new IllegalArgumentException("mmu.micro/INST has invalid value (" + b + ")"); } - instXorInstXorCt.put((byte) (b >> 8)); - instXorInstXorCt.put((byte) b); - - - return this; - } - - public Trace pMicroKecId(final long b) { - if (filled.get(50)) { - throw new IllegalStateException("mmu.micro/KEC_ID already set"); - } else { - filled.set(50); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.micro/KEC_ID has invalid value (" + b + ")"); } - kecId.put((byte) (b >> 24)); - kecId.put((byte) (b >> 16)); - kecId.put((byte) (b >> 8)); - kecId.put((byte) b); - - - return this; - } - - public Trace pMicroLimb(final Bytes b) { - if (filled.get(59)) { - throw new IllegalStateException("mmu.micro/LIMB already set"); - } else { - filled.set(59); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mmu.micro/LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmu.micro/PHASE has invalid value (" + b + ")"); } - phase.put((byte) (b >> 24)); - phase.put((byte) (b >> 16)); - phase.put((byte) (b >> 8)); - phase.put((byte) b); - - - return this; - } - - public Trace pMicroSbo(final UnsignedByte b) { - if (filled.get(44)) { - throw new IllegalStateException("mmu.micro/SBO already set"); - } else { - filled.set(44); - } - - sboXorWcpInst.put(b.toByte()); - - return this; - } - - public Trace pMicroSize(final UnsignedByte b) { - if (filled.get(45)) { - throw new IllegalStateException("mmu.micro/SIZE already set"); - } else { - filled.set(45); - } - - size.put(b.toByte()); - - return this; - } - - public Trace pMicroSlo(final Bytes b) { - if (filled.get(54)) { - throw new IllegalStateException("mmu.micro/SLO already set"); - } else { - filled.set(54); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.micro/SLO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.micro/TLO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.micro/TOTAL_SIZE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("mmu.prprc/CT has invalid value (" + b + ")"); } - instXorInstXorCt.put((byte) (b >> 8)); - instXorInstXorCt.put((byte) b); - - - return this; - } - - public Trace pPrprcEucA(final Bytes b) { - if (filled.get(52)) { - throw new IllegalStateException("mmu.prprc/EUC_A already set"); - } else { - filled.set(52); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mmu.prprc/EUC_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { auxIdXorCnSXorEucA.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.prprc/EUC_B has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refOffsetXorCnTXorEucB.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.prprc/EUC_CEIL has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { refSizeXorSloXorEucCeil.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.prprc/EUC_QUOT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { sizeXorTloXorEucQuot.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mmu.prprc/EUC_REM has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { srcIdXorTotalSizeXorEucRem.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb1XorLimbXorWcpArg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb2XorWcpArg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mmu.prprc/WCP_ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { srcOffsetHiXorWcpArg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mmu.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace tot(final long b) { - if (filled.get(37)) { - throw new IllegalStateException("mmu.TOT already set"); - } else { - filled.set(37); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOT has invalid value (" + b + ")"); } - tot.put((byte) (b >> 24)); - tot.put((byte) (b >> 16)); - tot.put((byte) (b >> 8)); - tot.put((byte) b); - - - return this; - } - - public Trace totlz(final long b) { - if (filled.get(38)) { - throw new IllegalStateException("mmu.TOTLZ already set"); - } else { - filled.set(38); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTLZ has invalid value (" + b + ")"); } - totlz.put((byte) (b >> 24)); - totlz.put((byte) (b >> 16)); - totlz.put((byte) (b >> 8)); - totlz.put((byte) b); - - - return this; - } - - public Trace totnt(final long b) { - if (filled.get(39)) { - throw new IllegalStateException("mmu.TOTNT already set"); - } else { - filled.set(39); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTNT has invalid value (" + b + ")"); } - totnt.put((byte) (b >> 24)); - totnt.put((byte) (b >> 16)); - totnt.put((byte) (b >> 8)); - totnt.put((byte) b); - - - return this; - } - - public Trace totrz(final long b) { - if (filled.get(40)) { - throw new IllegalStateException("mmu.TOTRZ already set"); - } else { - filled.set(40); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("mmu.TOTRZ has invalid value (" + b + ")"); } - totrz.put((byte) (b >> 24)); - totrz.put((byte) (b >> 16)); - totrz.put((byte) (b >> 8)); - totrz.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(52)) { - throw new IllegalStateException("mmu.AUX_ID_xor_CN_S_xor_EUC_A has not been filled"); - } - - if (!filled.get(0)) { - throw new IllegalStateException("mmu.BIN_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("mmu.BIN_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("mmu.BIN_3 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("mmu.BIN_4 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("mmu.BIN_5 has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("mmu.EXO_SUM_xor_EXO_ID has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("mmu.INST_xor_INST_xor_CT has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_PURE_PADDING has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("mmu.IS_ANY_TO_RAM_WITH_PADDING_SOME_DATA has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("mmu.IS_BLAKE has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("mmu.IS_EXO_TO_RAM_TRANSPLANTS has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("mmu.IS_INVALID_CODE_PREFIX has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("mmu.IS_MLOAD has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("mmu.IS_MODEXP_DATA has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("mmu.IS_MODEXP_ZERO has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("mmu.IS_MSTORE has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("mmu.IS_MSTORE8 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("mmu.IS_RAM_TO_EXO_WITH_PADDING has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("mmu.IS_RAM_TO_RAM_SANS_PADDING has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("mmu.IS_RIGHT_PADDED_WORD_EXTRACTION has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("mmu.KEC_ID has not been filled"); - } - - if (!filled.get(59)) { - throw new IllegalStateException("mmu.LIMB_1_xor_LIMB_xor_WCP_ARG_1_HI has not been filled"); - } - - if (!filled.get(60)) { - throw new IllegalStateException("mmu.LIMB_2_xor_WCP_ARG_1_LO has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("mmu.LZRO has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("mmu.MACRO has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("mmu.MICRO has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("mmu.MMIO_STAMP has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("mmu.NT_FIRST has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("mmu.NT_LAST has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("mmu.NT_MDDL has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("mmu.NT_ONLY has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("mmu.OUT_1 has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("mmu.OUT_2 has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("mmu.OUT_3 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("mmu.OUT_4 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("mmu.OUT_5 has not been filled"); - } - - if (!filled.get(51)) { - throw new IllegalStateException("mmu.PHASE has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("mmu.PHASE_xor_EXO_SUM has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("mmu.PRPRC has not been filled"); - } - - if (!filled.get(53)) { - throw new IllegalStateException("mmu.REF_OFFSET_xor_CN_T_xor_EUC_B has not been filled"); - } - - if (!filled.get(54)) { - throw new IllegalStateException("mmu.REF_SIZE_xor_SLO_xor_EUC_CEIL has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("mmu.RZ_FIRST has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("mmu.RZ_LAST has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("mmu.RZ_MDDL has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("mmu.RZ_ONLY has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("mmu.SBO_xor_WCP_INST has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("mmu.SIZE has not been filled"); - } - - if (!filled.get(55)) { - throw new IllegalStateException("mmu.SIZE_xor_TLO_xor_EUC_QUOT has not been filled"); - } - - if (!filled.get(56)) { - throw new IllegalStateException("mmu.SRC_ID_xor_TOTAL_SIZE_xor_EUC_REM has not been filled"); - } - - if (!filled.get(61)) { - throw new IllegalStateException("mmu.SRC_OFFSET_HI_xor_WCP_ARG_2_LO has not been filled"); - } - - if (!filled.get(62)) { - throw new IllegalStateException("mmu.SRC_OFFSET_LO has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("mmu.STAMP has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("mmu.SUCCESS_BIT_xor_SUCCESS_BIT_xor_EUC_FLAG has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("mmu.TBO has not been filled"); - } - - if (!filled.get(57)) { - throw new IllegalStateException("mmu.TGT_ID has not been filled"); - } - - if (!filled.get(58)) { - throw new IllegalStateException("mmu.TGT_OFFSET_LO has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("mmu.TOT has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("mmu.TOTLZ has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("mmu.TOTNT has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("mmu.TOTRZ has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("mmu.WCP_FLAG has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("mmu.WCP_RES has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(52)) { - auxIdXorCnSXorEucA.position(auxIdXorCnSXorEucA.position() + 8); - } - - if (!filled.get(0)) { - bin1.position(bin1.position() + 1); - } - - if (!filled.get(1)) { - bin2.position(bin2.position() + 1); - } - - if (!filled.get(2)) { - bin3.position(bin3.position() + 1); - } - - if (!filled.get(3)) { - bin4.position(bin4.position() + 1); - } - - if (!filled.get(4)) { - bin5.position(bin5.position() + 1); - } - - if (!filled.get(48)) { - exoSumXorExoId.position(exoSumXorExoId.position() + 4); - } - - if (!filled.get(47)) { - instXorInstXorCt.position(instXorInstXorCt.position() + 2); - } - - if (!filled.get(5)) { - isAnyToRamWithPaddingPurePadding.position(isAnyToRamWithPaddingPurePadding.position() + 1); - } - - if (!filled.get(6)) { - isAnyToRamWithPaddingSomeData.position(isAnyToRamWithPaddingSomeData.position() + 1); - } - - if (!filled.get(7)) { - isBlake.position(isBlake.position() + 1); - } - - if (!filled.get(8)) { - isExoToRamTransplants.position(isExoToRamTransplants.position() + 1); - } - - if (!filled.get(9)) { - isInvalidCodePrefix.position(isInvalidCodePrefix.position() + 1); - } - - if (!filled.get(10)) { - isMload.position(isMload.position() + 1); - } - - if (!filled.get(11)) { - isModexpData.position(isModexpData.position() + 1); - } - - if (!filled.get(12)) { - isModexpZero.position(isModexpZero.position() + 1); - } - - if (!filled.get(13)) { - isMstore.position(isMstore.position() + 1); - } - - if (!filled.get(14)) { - isMstore8.position(isMstore8.position() + 1); - } - - if (!filled.get(15)) { - isRamToExoWithPadding.position(isRamToExoWithPadding.position() + 1); - } - - if (!filled.get(16)) { - isRamToRamSansPadding.position(isRamToRamSansPadding.position() + 1); - } - - if (!filled.get(17)) { - isRightPaddedWordExtraction.position(isRightPaddedWordExtraction.position() + 1); - } - - if (!filled.get(50)) { - kecId.position(kecId.position() + 4); - } - - if (!filled.get(59)) { - limb1XorLimbXorWcpArg1Hi.position(limb1XorLimbXorWcpArg1Hi.position() + 16); - } - - if (!filled.get(60)) { - limb2XorWcpArg1Lo.position(limb2XorWcpArg1Lo.position() + 16); - } - - if (!filled.get(18)) { - lzro.position(lzro.position() + 1); - } - - if (!filled.get(19)) { - macro.position(macro.position() + 1); - } - - if (!filled.get(20)) { - micro.position(micro.position() + 1); - } - - if (!filled.get(21)) { - mmioStamp.position(mmioStamp.position() + 4); - } - - if (!filled.get(22)) { - ntFirst.position(ntFirst.position() + 1); - } - - if (!filled.get(23)) { - ntLast.position(ntLast.position() + 1); - } - - if (!filled.get(24)) { - ntMddl.position(ntMddl.position() + 1); - } - - if (!filled.get(25)) { - ntOnly.position(ntOnly.position() + 1); - } - - if (!filled.get(26)) { - out1.position(out1.position() + 8); - } - - if (!filled.get(27)) { - out2.position(out2.position() + 8); - } - - if (!filled.get(28)) { - out3.position(out3.position() + 8); - } - - if (!filled.get(29)) { - out4.position(out4.position() + 8); - } - - if (!filled.get(30)) { - out5.position(out5.position() + 8); - } - - if (!filled.get(51)) { - phase.position(phase.position() + 4); - } - - if (!filled.get(49)) { - phaseXorExoSum.position(phaseXorExoSum.position() + 4); - } - - if (!filled.get(31)) { - prprc.position(prprc.position() + 1); - } - - if (!filled.get(53)) { - refOffsetXorCnTXorEucB.position(refOffsetXorCnTXorEucB.position() + 8); - } - - if (!filled.get(54)) { - refSizeXorSloXorEucCeil.position(refSizeXorSloXorEucCeil.position() + 8); - } - - if (!filled.get(32)) { - rzFirst.position(rzFirst.position() + 1); - } - - if (!filled.get(33)) { - rzLast.position(rzLast.position() + 1); - } - - if (!filled.get(34)) { - rzMddl.position(rzMddl.position() + 1); - } - - if (!filled.get(35)) { - rzOnly.position(rzOnly.position() + 1); - } - - if (!filled.get(44)) { - sboXorWcpInst.position(sboXorWcpInst.position() + 1); - } - - if (!filled.get(45)) { - size.position(size.position() + 1); - } - - if (!filled.get(55)) { - sizeXorTloXorEucQuot.position(sizeXorTloXorEucQuot.position() + 8); - } - - if (!filled.get(56)) { - srcIdXorTotalSizeXorEucRem.position(srcIdXorTotalSizeXorEucRem.position() + 8); - } - - if (!filled.get(61)) { - srcOffsetHiXorWcpArg2Lo.position(srcOffsetHiXorWcpArg2Lo.position() + 16); - } - - if (!filled.get(62)) { - srcOffsetLo.position(srcOffsetLo.position() + 16); - } - - if (!filled.get(36)) { - stamp.position(stamp.position() + 4); - } - - if (!filled.get(41)) { - successBitXorSuccessBitXorEucFlag.position(successBitXorSuccessBitXorEucFlag.position() + 1); - } - - if (!filled.get(46)) { - tbo.position(tbo.position() + 1); - } - - if (!filled.get(57)) { - tgtId.position(tgtId.position() + 8); - } - - if (!filled.get(58)) { - tgtOffsetLo.position(tgtOffsetLo.position() + 8); - } - - if (!filled.get(37)) { - tot.position(tot.position() + 4); - } - - if (!filled.get(38)) { - totlz.position(totlz.position() + 4); - } - - if (!filled.get(39)) { - totnt.position(totnt.position() + 4); - } - - if (!filled.get(40)) { - totrz.position(totrz.position() + 4); - } - - if (!filled.get(42)) { - wcpFlag.position(wcpFlag.position() + 1); - } - - if (!filled.get(43)) { - wcpRes.position(wcpRes.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java deleted file mode 100644 index 22717e0f0..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mod/Trace.java +++ /dev/null @@ -1,1803 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.mod; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc12; - private final MappedByteBuffer acc13; - private final MappedByteBuffer acc22; - private final MappedByteBuffer acc23; - private final MappedByteBuffer accB0; - private final MappedByteBuffer accB1; - private final MappedByteBuffer accB2; - private final MappedByteBuffer accB3; - private final MappedByteBuffer accDelta0; - private final MappedByteBuffer accDelta1; - private final MappedByteBuffer accDelta2; - private final MappedByteBuffer accDelta3; - private final MappedByteBuffer accH0; - private final MappedByteBuffer accH1; - private final MappedByteBuffer accH2; - private final MappedByteBuffer accQ0; - private final MappedByteBuffer accQ1; - private final MappedByteBuffer accQ2; - private final MappedByteBuffer accQ3; - private final MappedByteBuffer accR0; - private final MappedByteBuffer accR1; - private final MappedByteBuffer accR2; - private final MappedByteBuffer accR3; - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer byte12; - private final MappedByteBuffer byte13; - private final MappedByteBuffer byte22; - private final MappedByteBuffer byte23; - private final MappedByteBuffer byteB0; - private final MappedByteBuffer byteB1; - private final MappedByteBuffer byteB2; - private final MappedByteBuffer byteB3; - private final MappedByteBuffer byteDelta0; - private final MappedByteBuffer byteDelta1; - private final MappedByteBuffer byteDelta2; - private final MappedByteBuffer byteDelta3; - private final MappedByteBuffer byteH0; - private final MappedByteBuffer byteH1; - private final MappedByteBuffer byteH2; - private final MappedByteBuffer byteQ0; - private final MappedByteBuffer byteQ1; - private final MappedByteBuffer byteQ2; - private final MappedByteBuffer byteQ3; - private final MappedByteBuffer byteR0; - private final MappedByteBuffer byteR1; - private final MappedByteBuffer byteR2; - private final MappedByteBuffer byteR3; - private final MappedByteBuffer cmp1; - private final MappedByteBuffer cmp2; - private final MappedByteBuffer ct; - private final MappedByteBuffer inst; - private final MappedByteBuffer isDiv; - private final MappedByteBuffer isMod; - private final MappedByteBuffer isSdiv; - private final MappedByteBuffer isSmod; - private final MappedByteBuffer mli; - private final MappedByteBuffer msb1; - private final MappedByteBuffer msb2; - private final MappedByteBuffer oli; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer signed; - private final MappedByteBuffer stamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mod.ACC_1_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_1_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_2_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_2_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_DELTA_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_Q_3", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_0", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_1", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_2", 8, length)); - headers.add(new ColumnHeader("mod.ACC_R_3", 8, length)); - headers.add(new ColumnHeader("mod.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mod.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mod.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("mod.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mod.BYTE_1_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_1_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_2_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_2_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_DELTA_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_Q_3", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_0", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_1", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_2", 1, length)); - headers.add(new ColumnHeader("mod.BYTE_R_3", 1, length)); - headers.add(new ColumnHeader("mod.CMP_1", 1, length)); - headers.add(new ColumnHeader("mod.CMP_2", 1, length)); - headers.add(new ColumnHeader("mod.CT", 1, length)); - headers.add(new ColumnHeader("mod.INST", 1, length)); - headers.add(new ColumnHeader("mod.IS_DIV", 1, length)); - headers.add(new ColumnHeader("mod.IS_MOD", 1, length)); - headers.add(new ColumnHeader("mod.IS_SDIV", 1, length)); - headers.add(new ColumnHeader("mod.IS_SMOD", 1, length)); - headers.add(new ColumnHeader("mod.MLI", 1, length)); - headers.add(new ColumnHeader("mod.MSB_1", 1, length)); - headers.add(new ColumnHeader("mod.MSB_2", 1, length)); - headers.add(new ColumnHeader("mod.OLI", 1, length)); - headers.add(new ColumnHeader("mod.RES_HI", 16, length)); - headers.add(new ColumnHeader("mod.RES_LO", 16, length)); - headers.add(new ColumnHeader("mod.SIGNED", 1, length)); - headers.add(new ColumnHeader("mod.STAMP", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.acc12 = buffers.get(0); - this.acc13 = buffers.get(1); - this.acc22 = buffers.get(2); - this.acc23 = buffers.get(3); - this.accB0 = buffers.get(4); - this.accB1 = buffers.get(5); - this.accB2 = buffers.get(6); - this.accB3 = buffers.get(7); - this.accDelta0 = buffers.get(8); - this.accDelta1 = buffers.get(9); - this.accDelta2 = buffers.get(10); - this.accDelta3 = buffers.get(11); - this.accH0 = buffers.get(12); - this.accH1 = buffers.get(13); - this.accH2 = buffers.get(14); - this.accQ0 = buffers.get(15); - this.accQ1 = buffers.get(16); - this.accQ2 = buffers.get(17); - this.accQ3 = buffers.get(18); - this.accR0 = buffers.get(19); - this.accR1 = buffers.get(20); - this.accR2 = buffers.get(21); - this.accR3 = buffers.get(22); - this.arg1Hi = buffers.get(23); - this.arg1Lo = buffers.get(24); - this.arg2Hi = buffers.get(25); - this.arg2Lo = buffers.get(26); - this.byte12 = buffers.get(27); - this.byte13 = buffers.get(28); - this.byte22 = buffers.get(29); - this.byte23 = buffers.get(30); - this.byteB0 = buffers.get(31); - this.byteB1 = buffers.get(32); - this.byteB2 = buffers.get(33); - this.byteB3 = buffers.get(34); - this.byteDelta0 = buffers.get(35); - this.byteDelta1 = buffers.get(36); - this.byteDelta2 = buffers.get(37); - this.byteDelta3 = buffers.get(38); - this.byteH0 = buffers.get(39); - this.byteH1 = buffers.get(40); - this.byteH2 = buffers.get(41); - this.byteQ0 = buffers.get(42); - this.byteQ1 = buffers.get(43); - this.byteQ2 = buffers.get(44); - this.byteQ3 = buffers.get(45); - this.byteR0 = buffers.get(46); - this.byteR1 = buffers.get(47); - this.byteR2 = buffers.get(48); - this.byteR3 = buffers.get(49); - this.cmp1 = buffers.get(50); - this.cmp2 = buffers.get(51); - this.ct = buffers.get(52); - this.inst = buffers.get(53); - this.isDiv = buffers.get(54); - this.isMod = buffers.get(55); - this.isSdiv = buffers.get(56); - this.isSmod = buffers.get(57); - this.mli = buffers.get(58); - this.msb1 = buffers.get(59); - this.msb2 = buffers.get(60); - this.oli = buffers.get(61); - this.resHi = buffers.get(62); - this.resLo = buffers.get(63); - this.signed = buffers.get(64); - this.stamp = buffers.get(65); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc12(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("mod.ACC_1_2 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mod.ACC_1_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { acc12.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_1_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { acc13.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_2_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { acc22.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_2_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { acc23.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_DELTA_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_DELTA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_DELTA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_DELTA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accDelta3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_Q_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_Q_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_Q_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_Q_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accQ3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_R_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_R_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_R_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mod.ACC_R_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accR3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mod.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mod.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mod.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mod.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 16L) { throw new IllegalArgumentException("mod.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(53)) { - throw new IllegalStateException("mod.INST already set"); - } else { - filled.set(53); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace isDiv(final Boolean b) { - if (filled.get(54)) { - throw new IllegalStateException("mod.IS_DIV already set"); - } else { - filled.set(54); - } - - isDiv.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isMod(final Boolean b) { - if (filled.get(55)) { - throw new IllegalStateException("mod.IS_MOD already set"); - } else { - filled.set(55); - } - - isMod.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isSdiv(final Boolean b) { - if (filled.get(56)) { - throw new IllegalStateException("mod.IS_SDIV already set"); - } else { - filled.set(56); - } - - isSdiv.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isSmod(final Boolean b) { - if (filled.get(57)) { - throw new IllegalStateException("mod.IS_SMOD already set"); - } else { - filled.set(57); - } - - isSmod.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mli(final Boolean b) { - if (filled.get(58)) { - throw new IllegalStateException("mod.MLI already set"); - } else { - filled.set(58); - } - - mli.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace msb1(final Boolean b) { - if (filled.get(59)) { - throw new IllegalStateException("mod.MSB_1 already set"); - } else { - filled.set(59); - } - - msb1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace msb2(final Boolean b) { - if (filled.get(60)) { - throw new IllegalStateException("mod.MSB_2 already set"); - } else { - filled.set(60); - } - - msb2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace oli(final Boolean b) { - if (filled.get(61)) { - throw new IllegalStateException("mod.OLI already set"); - } else { - filled.set(61); - } - - oli.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace resHi(final Bytes b) { - if (filled.get(62)) { - throw new IllegalStateException("mod.RES_HI already set"); - } else { - filled.set(62); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mod.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mod.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mod.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("mod.ACC_1_2 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("mod.ACC_1_3 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("mod.ACC_2_2 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("mod.ACC_2_3 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("mod.ACC_B_0 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("mod.ACC_B_1 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("mod.ACC_B_2 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("mod.ACC_B_3 has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("mod.ACC_DELTA_0 has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("mod.ACC_DELTA_1 has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("mod.ACC_DELTA_2 has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("mod.ACC_DELTA_3 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("mod.ACC_H_0 has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("mod.ACC_H_1 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("mod.ACC_H_2 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("mod.ACC_Q_0 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("mod.ACC_Q_1 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("mod.ACC_Q_2 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("mod.ACC_Q_3 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("mod.ACC_R_0 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("mod.ACC_R_1 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("mod.ACC_R_2 has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("mod.ACC_R_3 has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("mod.ARG_1_HI has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("mod.ARG_1_LO has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("mod.ARG_2_HI has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("mod.ARG_2_LO has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("mod.BYTE_1_2 has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("mod.BYTE_1_3 has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("mod.BYTE_2_2 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("mod.BYTE_2_3 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("mod.BYTE_B_0 has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("mod.BYTE_B_1 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("mod.BYTE_B_2 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("mod.BYTE_B_3 has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("mod.BYTE_DELTA_0 has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("mod.BYTE_DELTA_1 has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("mod.BYTE_DELTA_2 has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("mod.BYTE_DELTA_3 has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("mod.BYTE_H_0 has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("mod.BYTE_H_1 has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("mod.BYTE_H_2 has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("mod.BYTE_Q_0 has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("mod.BYTE_Q_1 has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("mod.BYTE_Q_2 has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("mod.BYTE_Q_3 has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("mod.BYTE_R_0 has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("mod.BYTE_R_1 has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("mod.BYTE_R_2 has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("mod.BYTE_R_3 has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("mod.CMP_1 has not been filled"); - } - - if (!filled.get(51)) { - throw new IllegalStateException("mod.CMP_2 has not been filled"); - } - - if (!filled.get(52)) { - throw new IllegalStateException("mod.CT has not been filled"); - } - - if (!filled.get(53)) { - throw new IllegalStateException("mod.INST has not been filled"); - } - - if (!filled.get(54)) { - throw new IllegalStateException("mod.IS_DIV has not been filled"); - } - - if (!filled.get(55)) { - throw new IllegalStateException("mod.IS_MOD has not been filled"); - } - - if (!filled.get(56)) { - throw new IllegalStateException("mod.IS_SDIV has not been filled"); - } - - if (!filled.get(57)) { - throw new IllegalStateException("mod.IS_SMOD has not been filled"); - } - - if (!filled.get(58)) { - throw new IllegalStateException("mod.MLI has not been filled"); - } - - if (!filled.get(59)) { - throw new IllegalStateException("mod.MSB_1 has not been filled"); - } - - if (!filled.get(60)) { - throw new IllegalStateException("mod.MSB_2 has not been filled"); - } - - if (!filled.get(61)) { - throw new IllegalStateException("mod.OLI has not been filled"); - } - - if (!filled.get(62)) { - throw new IllegalStateException("mod.RES_HI has not been filled"); - } - - if (!filled.get(63)) { - throw new IllegalStateException("mod.RES_LO has not been filled"); - } - - if (!filled.get(64)) { - throw new IllegalStateException("mod.SIGNED has not been filled"); - } - - if (!filled.get(65)) { - throw new IllegalStateException("mod.STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc12.position(acc12.position() + 8); - } - - if (!filled.get(1)) { - acc13.position(acc13.position() + 8); - } - - if (!filled.get(2)) { - acc22.position(acc22.position() + 8); - } - - if (!filled.get(3)) { - acc23.position(acc23.position() + 8); - } - - if (!filled.get(4)) { - accB0.position(accB0.position() + 8); - } - - if (!filled.get(5)) { - accB1.position(accB1.position() + 8); - } - - if (!filled.get(6)) { - accB2.position(accB2.position() + 8); - } - - if (!filled.get(7)) { - accB3.position(accB3.position() + 8); - } - - if (!filled.get(8)) { - accDelta0.position(accDelta0.position() + 8); - } - - if (!filled.get(9)) { - accDelta1.position(accDelta1.position() + 8); - } - - if (!filled.get(10)) { - accDelta2.position(accDelta2.position() + 8); - } - - if (!filled.get(11)) { - accDelta3.position(accDelta3.position() + 8); - } - - if (!filled.get(12)) { - accH0.position(accH0.position() + 8); - } - - if (!filled.get(13)) { - accH1.position(accH1.position() + 8); - } - - if (!filled.get(14)) { - accH2.position(accH2.position() + 8); - } - - if (!filled.get(15)) { - accQ0.position(accQ0.position() + 8); - } - - if (!filled.get(16)) { - accQ1.position(accQ1.position() + 8); - } - - if (!filled.get(17)) { - accQ2.position(accQ2.position() + 8); - } - - if (!filled.get(18)) { - accQ3.position(accQ3.position() + 8); - } - - if (!filled.get(19)) { - accR0.position(accR0.position() + 8); - } - - if (!filled.get(20)) { - accR1.position(accR1.position() + 8); - } - - if (!filled.get(21)) { - accR2.position(accR2.position() + 8); - } - - if (!filled.get(22)) { - accR3.position(accR3.position() + 8); - } - - if (!filled.get(23)) { - arg1Hi.position(arg1Hi.position() + 16); - } - - if (!filled.get(24)) { - arg1Lo.position(arg1Lo.position() + 16); - } - - if (!filled.get(25)) { - arg2Hi.position(arg2Hi.position() + 16); - } - - if (!filled.get(26)) { - arg2Lo.position(arg2Lo.position() + 16); - } - - if (!filled.get(27)) { - byte12.position(byte12.position() + 1); - } - - if (!filled.get(28)) { - byte13.position(byte13.position() + 1); - } - - if (!filled.get(29)) { - byte22.position(byte22.position() + 1); - } - - if (!filled.get(30)) { - byte23.position(byte23.position() + 1); - } - - if (!filled.get(31)) { - byteB0.position(byteB0.position() + 1); - } - - if (!filled.get(32)) { - byteB1.position(byteB1.position() + 1); - } - - if (!filled.get(33)) { - byteB2.position(byteB2.position() + 1); - } - - if (!filled.get(34)) { - byteB3.position(byteB3.position() + 1); - } - - if (!filled.get(35)) { - byteDelta0.position(byteDelta0.position() + 1); - } - - if (!filled.get(36)) { - byteDelta1.position(byteDelta1.position() + 1); - } - - if (!filled.get(37)) { - byteDelta2.position(byteDelta2.position() + 1); - } - - if (!filled.get(38)) { - byteDelta3.position(byteDelta3.position() + 1); - } - - if (!filled.get(39)) { - byteH0.position(byteH0.position() + 1); - } - - if (!filled.get(40)) { - byteH1.position(byteH1.position() + 1); - } - - if (!filled.get(41)) { - byteH2.position(byteH2.position() + 1); - } - - if (!filled.get(42)) { - byteQ0.position(byteQ0.position() + 1); - } - - if (!filled.get(43)) { - byteQ1.position(byteQ1.position() + 1); - } - - if (!filled.get(44)) { - byteQ2.position(byteQ2.position() + 1); - } - - if (!filled.get(45)) { - byteQ3.position(byteQ3.position() + 1); - } - - if (!filled.get(46)) { - byteR0.position(byteR0.position() + 1); - } - - if (!filled.get(47)) { - byteR1.position(byteR1.position() + 1); - } - - if (!filled.get(48)) { - byteR2.position(byteR2.position() + 1); - } - - if (!filled.get(49)) { - byteR3.position(byteR3.position() + 1); - } - - if (!filled.get(50)) { - cmp1.position(cmp1.position() + 1); - } - - if (!filled.get(51)) { - cmp2.position(cmp2.position() + 1); - } - - if (!filled.get(52)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(53)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(54)) { - isDiv.position(isDiv.position() + 1); - } - - if (!filled.get(55)) { - isMod.position(isMod.position() + 1); - } - - if (!filled.get(56)) { - isSdiv.position(isSdiv.position() + 1); - } - - if (!filled.get(57)) { - isSmod.position(isSmod.position() + 1); - } - - if (!filled.get(58)) { - mli.position(mli.position() + 1); - } - - if (!filled.get(59)) { - msb1.position(msb1.position() + 1); - } - - if (!filled.get(60)) { - msb2.position(msb2.position() + 1); - } - - if (!filled.get(61)) { - oli.position(oli.position() + 1); - } - - if (!filled.get(62)) { - resHi.position(resHi.position() + 16); - } - - if (!filled.get(63)) { - resLo.position(resLo.position() + 16); - } - - if (!filled.get(64)) { - signed.position(signed.position() + 1); - } - - if (!filled.get(65)) { - stamp.position(stamp.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java deleted file mode 100644 index 9acc1d8b9..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/mul/Trace.java +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.mul; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer accA0; - private final MappedByteBuffer accA1; - private final MappedByteBuffer accA2; - private final MappedByteBuffer accA3; - private final MappedByteBuffer accB0; - private final MappedByteBuffer accB1; - private final MappedByteBuffer accB2; - private final MappedByteBuffer accB3; - private final MappedByteBuffer accC0; - private final MappedByteBuffer accC1; - private final MappedByteBuffer accC2; - private final MappedByteBuffer accC3; - private final MappedByteBuffer accH0; - private final MappedByteBuffer accH1; - private final MappedByteBuffer accH2; - private final MappedByteBuffer accH3; - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer bitNum; - private final MappedByteBuffer bits; - private final MappedByteBuffer byteA0; - private final MappedByteBuffer byteA1; - private final MappedByteBuffer byteA2; - private final MappedByteBuffer byteA3; - private final MappedByteBuffer byteB0; - private final MappedByteBuffer byteB1; - private final MappedByteBuffer byteB2; - private final MappedByteBuffer byteB3; - private final MappedByteBuffer byteC0; - private final MappedByteBuffer byteC1; - private final MappedByteBuffer byteC2; - private final MappedByteBuffer byteC3; - private final MappedByteBuffer byteH0; - private final MappedByteBuffer byteH1; - private final MappedByteBuffer byteH2; - private final MappedByteBuffer byteH3; - private final MappedByteBuffer counter; - private final MappedByteBuffer exponentBit; - private final MappedByteBuffer exponentBitAccumulator; - private final MappedByteBuffer exponentBitSource; - private final MappedByteBuffer instruction; - private final MappedByteBuffer mulStamp; - private final MappedByteBuffer oli; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer resultVanishes; - private final MappedByteBuffer squareAndMultiply; - private final MappedByteBuffer tinyBase; - private final MappedByteBuffer tinyExponent; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mul.ACC_A_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_A_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_B_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_C_3", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_0", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_1", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_2", 8, length)); - headers.add(new ColumnHeader("mul.ACC_H_3", 8, length)); - headers.add(new ColumnHeader("mul.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("mul.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("mul.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("mul.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("mul.BIT_NUM", 1, length)); - headers.add(new ColumnHeader("mul.BITS", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_A_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_B_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_C_3", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_0", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_1", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_2", 1, length)); - headers.add(new ColumnHeader("mul.BYTE_H_3", 1, length)); - headers.add(new ColumnHeader("mul.COUNTER", 1, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT", 1, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT_ACCUMULATOR", 16, length)); - headers.add(new ColumnHeader("mul.EXPONENT_BIT_SOURCE", 1, length)); - headers.add(new ColumnHeader("mul.INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("mul.MUL_STAMP", 4, length)); - headers.add(new ColumnHeader("mul.OLI", 1, length)); - headers.add(new ColumnHeader("mul.RES_HI", 16, length)); - headers.add(new ColumnHeader("mul.RES_LO", 16, length)); - headers.add(new ColumnHeader("mul.RESULT_VANISHES", 1, length)); - headers.add(new ColumnHeader("mul.SQUARE_AND_MULTIPLY", 1, length)); - headers.add(new ColumnHeader("mul.TINY_BASE", 1, length)); - headers.add(new ColumnHeader("mul.TINY_EXPONENT", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.accA0 = buffers.get(0); - this.accA1 = buffers.get(1); - this.accA2 = buffers.get(2); - this.accA3 = buffers.get(3); - this.accB0 = buffers.get(4); - this.accB1 = buffers.get(5); - this.accB2 = buffers.get(6); - this.accB3 = buffers.get(7); - this.accC0 = buffers.get(8); - this.accC1 = buffers.get(9); - this.accC2 = buffers.get(10); - this.accC3 = buffers.get(11); - this.accH0 = buffers.get(12); - this.accH1 = buffers.get(13); - this.accH2 = buffers.get(14); - this.accH3 = buffers.get(15); - this.arg1Hi = buffers.get(16); - this.arg1Lo = buffers.get(17); - this.arg2Hi = buffers.get(18); - this.arg2Lo = buffers.get(19); - this.bitNum = buffers.get(20); - this.bits = buffers.get(21); - this.byteA0 = buffers.get(22); - this.byteA1 = buffers.get(23); - this.byteA2 = buffers.get(24); - this.byteA3 = buffers.get(25); - this.byteB0 = buffers.get(26); - this.byteB1 = buffers.get(27); - this.byteB2 = buffers.get(28); - this.byteB3 = buffers.get(29); - this.byteC0 = buffers.get(30); - this.byteC1 = buffers.get(31); - this.byteC2 = buffers.get(32); - this.byteC3 = buffers.get(33); - this.byteH0 = buffers.get(34); - this.byteH1 = buffers.get(35); - this.byteH2 = buffers.get(36); - this.byteH3 = buffers.get(37); - this.counter = buffers.get(38); - this.exponentBit = buffers.get(39); - this.exponentBitAccumulator = buffers.get(40); - this.exponentBitSource = buffers.get(41); - this.instruction = buffers.get(42); - this.mulStamp = buffers.get(43); - this.oli = buffers.get(44); - this.resHi = buffers.get(45); - this.resLo = buffers.get(46); - this.resultVanishes = buffers.get(47); - this.squareAndMultiply = buffers.get(48); - this.tinyBase = buffers.get(49); - this.tinyExponent = buffers.get(50); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace accA0(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("mul.ACC_A_0 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mul.ACC_A_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_A_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_A_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_A_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accA3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_B_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_B_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_B_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_B_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accB3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_C_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_C_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_C_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_C_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accC3.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_H_0 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH0.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_H_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH1.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_H_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH2.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mul.ACC_H_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { accH3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mul.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mul.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mul.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mul.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 128L) { throw new IllegalArgumentException("mul.BIT_NUM has invalid value (" + b + ")"); } - bitNum.put((byte) b); - - - return this; - } - - public Trace bits(final Boolean b) { - if (filled.get(20)) { - throw new IllegalStateException("mul.BITS already set"); - } else { - filled.set(20); - } - - bits.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace byteA0(final UnsignedByte b) { - if (filled.get(22)) { - throw new IllegalStateException("mul.BYTE_A_0 already set"); - } else { - filled.set(22); - } - - byteA0.put(b.toByte()); - - return this; - } - - public Trace byteA1(final UnsignedByte b) { - if (filled.get(23)) { - throw new IllegalStateException("mul.BYTE_A_1 already set"); - } else { - filled.set(23); - } - - byteA1.put(b.toByte()); - - return this; - } - - public Trace byteA2(final UnsignedByte b) { - if (filled.get(24)) { - throw new IllegalStateException("mul.BYTE_A_2 already set"); - } else { - filled.set(24); - } - - byteA2.put(b.toByte()); - - return this; - } - - public Trace byteA3(final UnsignedByte b) { - if (filled.get(25)) { - throw new IllegalStateException("mul.BYTE_A_3 already set"); - } else { - filled.set(25); - } - - byteA3.put(b.toByte()); - - return this; - } - - public Trace byteB0(final UnsignedByte b) { - if (filled.get(26)) { - throw new IllegalStateException("mul.BYTE_B_0 already set"); - } else { - filled.set(26); - } - - byteB0.put(b.toByte()); - - return this; - } - - public Trace byteB1(final UnsignedByte b) { - if (filled.get(27)) { - throw new IllegalStateException("mul.BYTE_B_1 already set"); - } else { - filled.set(27); - } - - byteB1.put(b.toByte()); - - return this; - } - - public Trace byteB2(final UnsignedByte b) { - if (filled.get(28)) { - throw new IllegalStateException("mul.BYTE_B_2 already set"); - } else { - filled.set(28); - } - - byteB2.put(b.toByte()); - - return this; - } - - public Trace byteB3(final UnsignedByte b) { - if (filled.get(29)) { - throw new IllegalStateException("mul.BYTE_B_3 already set"); - } else { - filled.set(29); - } - - byteB3.put(b.toByte()); - - return this; - } - - public Trace byteC0(final UnsignedByte b) { - if (filled.get(30)) { - throw new IllegalStateException("mul.BYTE_C_0 already set"); - } else { - filled.set(30); - } - - byteC0.put(b.toByte()); - - return this; - } - - public Trace byteC1(final UnsignedByte b) { - if (filled.get(31)) { - throw new IllegalStateException("mul.BYTE_C_1 already set"); - } else { - filled.set(31); - } - - byteC1.put(b.toByte()); - - return this; - } - - public Trace byteC2(final UnsignedByte b) { - if (filled.get(32)) { - throw new IllegalStateException("mul.BYTE_C_2 already set"); - } else { - filled.set(32); - } - - byteC2.put(b.toByte()); - - return this; - } - - public Trace byteC3(final UnsignedByte b) { - if (filled.get(33)) { - throw new IllegalStateException("mul.BYTE_C_3 already set"); - } else { - filled.set(33); - } - - byteC3.put(b.toByte()); - - return this; - } - - public Trace byteH0(final UnsignedByte b) { - if (filled.get(34)) { - throw new IllegalStateException("mul.BYTE_H_0 already set"); - } else { - filled.set(34); - } - - byteH0.put(b.toByte()); - - return this; - } - - public Trace byteH1(final UnsignedByte b) { - if (filled.get(35)) { - throw new IllegalStateException("mul.BYTE_H_1 already set"); - } else { - filled.set(35); - } - - byteH1.put(b.toByte()); - - return this; - } - - public Trace byteH2(final UnsignedByte b) { - if (filled.get(36)) { - throw new IllegalStateException("mul.BYTE_H_2 already set"); - } else { - filled.set(36); - } - - byteH2.put(b.toByte()); - - return this; - } - - public Trace byteH3(final UnsignedByte b) { - if (filled.get(37)) { - throw new IllegalStateException("mul.BYTE_H_3 already set"); - } else { - filled.set(37); - } - - byteH3.put(b.toByte()); - - return this; - } - - public Trace counter(final UnsignedByte b) { - if (filled.get(38)) { - throw new IllegalStateException("mul.COUNTER already set"); - } else { - filled.set(38); - } - - counter.put(b.toByte()); - - return this; - } - - public Trace exponentBit(final Boolean b) { - if (filled.get(39)) { - throw new IllegalStateException("mul.EXPONENT_BIT already set"); - } else { - filled.set(39); - } - - exponentBit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace exponentBitAccumulator(final Bytes b) { - if (filled.get(40)) { - throw new IllegalStateException("mul.EXPONENT_BIT_ACCUMULATOR already set"); - } else { - filled.set(40); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.EXPONENT_BIT_ACCUMULATOR has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { exponentBitAccumulator.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mul.MUL_STAMP has invalid value (" + b + ")"); } - mulStamp.put((byte) (b >> 24)); - mulStamp.put((byte) (b >> 16)); - mulStamp.put((byte) (b >> 8)); - mulStamp.put((byte) b); - - - return this; - } - - public Trace oli(final Boolean b) { - if (filled.get(44)) { - throw new IllegalStateException("mul.OLI already set"); - } else { - filled.set(44); - } - - oli.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace resHi(final Bytes b) { - if (filled.get(46)) { - throw new IllegalStateException("mul.RES_HI already set"); - } else { - filled.set(46); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("mul.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mul.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int CT_MAX_NON_TRIVIAL = 0x3; - public static final int CT_MAX_NON_TRIVIAL_BUT_MXPX = 0x10; - public static final int CT_MAX_TRIVIAL = 0x0; - public static final long TWO_POW_32 = 0x100000000L; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer accA; - private final MappedByteBuffer accQ; - private final MappedByteBuffer accW; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer byte3; - private final MappedByteBuffer byte4; - private final MappedByteBuffer byteA; - private final MappedByteBuffer byteQ; - private final MappedByteBuffer byteQq; - private final MappedByteBuffer byteR; - private final MappedByteBuffer byteW; - private final MappedByteBuffer cMem; - private final MappedByteBuffer cMemNew; - private final MappedByteBuffer cn; - private final MappedByteBuffer comp; - private final MappedByteBuffer ct; - private final MappedByteBuffer deploys; - private final MappedByteBuffer expands; - private final MappedByteBuffer gasMxp; - private final MappedByteBuffer gbyte; - private final MappedByteBuffer gword; - private final MappedByteBuffer inst; - private final MappedByteBuffer linCost; - private final MappedByteBuffer maxOffset; - private final MappedByteBuffer maxOffset1; - private final MappedByteBuffer maxOffset2; - private final MappedByteBuffer mtntop; - private final MappedByteBuffer mxpType1; - private final MappedByteBuffer mxpType2; - private final MappedByteBuffer mxpType3; - private final MappedByteBuffer mxpType4; - private final MappedByteBuffer mxpType5; - private final MappedByteBuffer mxpx; - private final MappedByteBuffer noop; - private final MappedByteBuffer offset1Hi; - private final MappedByteBuffer offset1Lo; - private final MappedByteBuffer offset2Hi; - private final MappedByteBuffer offset2Lo; - private final MappedByteBuffer quadCost; - private final MappedByteBuffer roob; - private final MappedByteBuffer size1Hi; - private final MappedByteBuffer size1Lo; - private final MappedByteBuffer size1NonzeroNoMxpx; - private final MappedByteBuffer size2Hi; - private final MappedByteBuffer size2Lo; - private final MappedByteBuffer size2NonzeroNoMxpx; - private final MappedByteBuffer stamp; - private final MappedByteBuffer words; - private final MappedByteBuffer wordsNew; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("mxp.ACC_1", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_2", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_3", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_4", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_A", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_Q", 17, length)); - headers.add(new ColumnHeader("mxp.ACC_W", 17, length)); - headers.add(new ColumnHeader("mxp.BYTE_1", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_2", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_3", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_4", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_A", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_Q", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_QQ", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_R", 1, length)); - headers.add(new ColumnHeader("mxp.BYTE_W", 1, length)); - headers.add(new ColumnHeader("mxp.C_MEM", 8, length)); - headers.add(new ColumnHeader("mxp.C_MEM_NEW", 8, length)); - headers.add(new ColumnHeader("mxp.CN", 8, length)); - headers.add(new ColumnHeader("mxp.COMP", 1, length)); - headers.add(new ColumnHeader("mxp.CT", 1, length)); - headers.add(new ColumnHeader("mxp.DEPLOYS", 1, length)); - headers.add(new ColumnHeader("mxp.EXPANDS", 1, length)); - headers.add(new ColumnHeader("mxp.GAS_MXP", 8, length)); - headers.add(new ColumnHeader("mxp.GBYTE", 8, length)); - headers.add(new ColumnHeader("mxp.GWORD", 8, length)); - headers.add(new ColumnHeader("mxp.INST", 1, length)); - headers.add(new ColumnHeader("mxp.LIN_COST", 8, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET", 16, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET_1", 16, length)); - headers.add(new ColumnHeader("mxp.MAX_OFFSET_2", 16, length)); - headers.add(new ColumnHeader("mxp.MTNTOP", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_1", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_2", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_3", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_4", 1, length)); - headers.add(new ColumnHeader("mxp.MXP_TYPE_5", 1, length)); - headers.add(new ColumnHeader("mxp.MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.NOOP", 1, length)); - headers.add(new ColumnHeader("mxp.OFFSET_1_HI", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_1_LO", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_2_HI", 16, length)); - headers.add(new ColumnHeader("mxp.OFFSET_2_LO", 16, length)); - headers.add(new ColumnHeader("mxp.QUAD_COST", 8, length)); - headers.add(new ColumnHeader("mxp.ROOB", 1, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_HI", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_LO", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_1_NONZERO_NO_MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_HI", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_LO", 16, length)); - headers.add(new ColumnHeader("mxp.SIZE_2_NONZERO_NO_MXPX", 1, length)); - headers.add(new ColumnHeader("mxp.STAMP", 4, length)); - headers.add(new ColumnHeader("mxp.WORDS", 8, length)); - headers.add(new ColumnHeader("mxp.WORDS_NEW", 8, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.acc3 = buffers.get(2); - this.acc4 = buffers.get(3); - this.accA = buffers.get(4); - this.accQ = buffers.get(5); - this.accW = buffers.get(6); - this.byte1 = buffers.get(7); - this.byte2 = buffers.get(8); - this.byte3 = buffers.get(9); - this.byte4 = buffers.get(10); - this.byteA = buffers.get(11); - this.byteQ = buffers.get(12); - this.byteQq = buffers.get(13); - this.byteR = buffers.get(14); - this.byteW = buffers.get(15); - this.cMem = buffers.get(16); - this.cMemNew = buffers.get(17); - this.cn = buffers.get(18); - this.comp = buffers.get(19); - this.ct = buffers.get(20); - this.deploys = buffers.get(21); - this.expands = buffers.get(22); - this.gasMxp = buffers.get(23); - this.gbyte = buffers.get(24); - this.gword = buffers.get(25); - this.inst = buffers.get(26); - this.linCost = buffers.get(27); - this.maxOffset = buffers.get(28); - this.maxOffset1 = buffers.get(29); - this.maxOffset2 = buffers.get(30); - this.mtntop = buffers.get(31); - this.mxpType1 = buffers.get(32); - this.mxpType2 = buffers.get(33); - this.mxpType3 = buffers.get(34); - this.mxpType4 = buffers.get(35); - this.mxpType5 = buffers.get(36); - this.mxpx = buffers.get(37); - this.noop = buffers.get(38); - this.offset1Hi = buffers.get(39); - this.offset1Lo = buffers.get(40); - this.offset2Hi = buffers.get(41); - this.offset2Lo = buffers.get(42); - this.quadCost = buffers.get(43); - this.roob = buffers.get(44); - this.size1Hi = buffers.get(45); - this.size1Lo = buffers.get(46); - this.size1NonzeroNoMxpx = buffers.get(47); - this.size2Hi = buffers.get(48); - this.size2Lo = buffers.get(49); - this.size2NonzeroNoMxpx = buffers.get(50); - this.stamp = buffers.get(51); - this.words = buffers.get(52); - this.wordsNew = buffers.get(53); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("mxp.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 136) { throw new IllegalArgumentException("mxp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_A has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { accA.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_Q has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { accQ.put((byte) 0); } - // Write bytes - for(int j=0; j 136) { throw new IllegalArgumentException("mxp.ACC_W has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<17; i++) { accW.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.C_MEM has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cMem.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.C_MEM_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cMemNew.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.CN has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { cn.put((byte) 0); } - // Write bytes - for(int j=0; j= 32L) { throw new IllegalArgumentException("mxp.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace deploys(final Boolean b) { - if (filled.get(21)) { - throw new IllegalStateException("mxp.DEPLOYS already set"); - } else { - filled.set(21); - } - - deploys.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace expands(final Boolean b) { - if (filled.get(22)) { - throw new IllegalStateException("mxp.EXPANDS already set"); - } else { - filled.set(22); - } - - expands.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace gasMxp(final Bytes b) { - if (filled.get(23)) { - throw new IllegalStateException("mxp.GAS_MXP already set"); - } else { - filled.set(23); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasMxp.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.GBYTE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gbyte.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.GWORD has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gword.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.LIN_COST has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { linCost.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { maxOffset.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { maxOffset1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.MAX_OFFSET_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { maxOffset2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.OFFSET_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { offset1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.OFFSET_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { offset1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.OFFSET_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { offset2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.OFFSET_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { offset2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.QUAD_COST has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { quadCost.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.SIZE_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { size1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.SIZE_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { size1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.SIZE_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { size2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("mxp.SIZE_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { size2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("mxp.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace words(final Bytes b) { - if (filled.get(52)) { - throw new IllegalStateException("mxp.WORDS already set"); - } else { - filled.set(52); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("mxp.WORDS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { words.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("mxp.WORDS_NEW has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { wordsNew.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int CT_MAX_BLAKE2F_CDS = 0x1; - public static final int CT_MAX_BLAKE2F_PARAMS = 0x1; - public static final int CT_MAX_CALL = 0x2; - public static final int CT_MAX_CDL = 0x0; - public static final int CT_MAX_CREATE = 0x3; - public static final int CT_MAX_DEPLOYMENT = 0x0; - public static final int CT_MAX_ECADD = 0x2; - public static final int CT_MAX_ECMUL = 0x2; - public static final int CT_MAX_ECPAIRING = 0x4; - public static final int CT_MAX_ECRECOVER = 0x2; - public static final int CT_MAX_IDENTITY = 0x3; - public static final int CT_MAX_JUMP = 0x0; - public static final int CT_MAX_JUMPI = 0x1; - public static final int CT_MAX_MODEXP_CDS = 0x2; - public static final int CT_MAX_MODEXP_EXTRACT = 0x3; - public static final int CT_MAX_MODEXP_LEAD = 0x3; - public static final int CT_MAX_MODEXP_PRICING = 0x5; - public static final int CT_MAX_MODEXP_XBS = 0x2; - public static final int CT_MAX_RDC = 0x2; - public static final int CT_MAX_RIPEMD = 0x3; - public static final int CT_MAX_SHA2 = 0x3; - public static final int CT_MAX_SSTORE = 0x0; - public static final int CT_MAX_XCALL = 0x0; - public static final int G_QUADDIVISOR = 0x3; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer addFlag; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer data1; - private final MappedByteBuffer data2; - private final MappedByteBuffer data3; - private final MappedByteBuffer data4; - private final MappedByteBuffer data5; - private final MappedByteBuffer data6; - private final MappedByteBuffer data7; - private final MappedByteBuffer data8; - private final MappedByteBuffer data9; - private final MappedByteBuffer isBlake2FCds; - private final MappedByteBuffer isBlake2FParams; - private final MappedByteBuffer isCall; - private final MappedByteBuffer isCdl; - private final MappedByteBuffer isCreate; - private final MappedByteBuffer isDeployment; - private final MappedByteBuffer isEcadd; - private final MappedByteBuffer isEcmul; - private final MappedByteBuffer isEcpairing; - private final MappedByteBuffer isEcrecover; - private final MappedByteBuffer isIdentity; - private final MappedByteBuffer isJump; - private final MappedByteBuffer isJumpi; - private final MappedByteBuffer isModexpCds; - private final MappedByteBuffer isModexpExtract; - private final MappedByteBuffer isModexpLead; - private final MappedByteBuffer isModexpPricing; - private final MappedByteBuffer isModexpXbs; - private final MappedByteBuffer isRdc; - private final MappedByteBuffer isRipemd; - private final MappedByteBuffer isSha2; - private final MappedByteBuffer isSstore; - private final MappedByteBuffer isXcall; - private final MappedByteBuffer modFlag; - private final MappedByteBuffer oobInst; - private final MappedByteBuffer outgoingData1; - private final MappedByteBuffer outgoingData2; - private final MappedByteBuffer outgoingData3; - private final MappedByteBuffer outgoingData4; - private final MappedByteBuffer outgoingInst; - private final MappedByteBuffer outgoingResLo; - private final MappedByteBuffer stamp; - private final MappedByteBuffer wcpFlag; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("oob.ADD_FLAG", 1, length)); - headers.add(new ColumnHeader("oob.CT", 1, length)); - headers.add(new ColumnHeader("oob.CT_MAX", 1, length)); - headers.add(new ColumnHeader("oob.DATA_1", 16, length)); - headers.add(new ColumnHeader("oob.DATA_2", 16, length)); - headers.add(new ColumnHeader("oob.DATA_3", 16, length)); - headers.add(new ColumnHeader("oob.DATA_4", 16, length)); - headers.add(new ColumnHeader("oob.DATA_5", 16, length)); - headers.add(new ColumnHeader("oob.DATA_6", 16, length)); - headers.add(new ColumnHeader("oob.DATA_7", 16, length)); - headers.add(new ColumnHeader("oob.DATA_8", 16, length)); - headers.add(new ColumnHeader("oob.DATA_9", 16, length)); - headers.add(new ColumnHeader("oob.IS_BLAKE2F_CDS", 1, length)); - headers.add(new ColumnHeader("oob.IS_BLAKE2F_PARAMS", 1, length)); - headers.add(new ColumnHeader("oob.IS_CALL", 1, length)); - headers.add(new ColumnHeader("oob.IS_CDL", 1, length)); - headers.add(new ColumnHeader("oob.IS_CREATE", 1, length)); - headers.add(new ColumnHeader("oob.IS_DEPLOYMENT", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECADD", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECMUL", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECPAIRING", 1, length)); - headers.add(new ColumnHeader("oob.IS_ECRECOVER", 1, length)); - headers.add(new ColumnHeader("oob.IS_IDENTITY", 1, length)); - headers.add(new ColumnHeader("oob.IS_JUMP", 1, length)); - headers.add(new ColumnHeader("oob.IS_JUMPI", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_CDS", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_EXTRACT", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_LEAD", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_PRICING", 1, length)); - headers.add(new ColumnHeader("oob.IS_MODEXP_XBS", 1, length)); - headers.add(new ColumnHeader("oob.IS_RDC", 1, length)); - headers.add(new ColumnHeader("oob.IS_RIPEMD", 1, length)); - headers.add(new ColumnHeader("oob.IS_SHA2", 1, length)); - headers.add(new ColumnHeader("oob.IS_SSTORE", 1, length)); - headers.add(new ColumnHeader("oob.IS_XCALL", 1, length)); - headers.add(new ColumnHeader("oob.MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("oob.OOB_INST", 2, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_1", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_2", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_3", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_DATA_4", 16, length)); - headers.add(new ColumnHeader("oob.OUTGOING_INST", 1, length)); - headers.add(new ColumnHeader("oob.OUTGOING_RES_LO", 16, length)); - headers.add(new ColumnHeader("oob.STAMP", 4, length)); - headers.add(new ColumnHeader("oob.WCP_FLAG", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.addFlag = buffers.get(0); - this.ct = buffers.get(1); - this.ctMax = buffers.get(2); - this.data1 = buffers.get(3); - this.data2 = buffers.get(4); - this.data3 = buffers.get(5); - this.data4 = buffers.get(6); - this.data5 = buffers.get(7); - this.data6 = buffers.get(8); - this.data7 = buffers.get(9); - this.data8 = buffers.get(10); - this.data9 = buffers.get(11); - this.isBlake2FCds = buffers.get(12); - this.isBlake2FParams = buffers.get(13); - this.isCall = buffers.get(14); - this.isCdl = buffers.get(15); - this.isCreate = buffers.get(16); - this.isDeployment = buffers.get(17); - this.isEcadd = buffers.get(18); - this.isEcmul = buffers.get(19); - this.isEcpairing = buffers.get(20); - this.isEcrecover = buffers.get(21); - this.isIdentity = buffers.get(22); - this.isJump = buffers.get(23); - this.isJumpi = buffers.get(24); - this.isModexpCds = buffers.get(25); - this.isModexpExtract = buffers.get(26); - this.isModexpLead = buffers.get(27); - this.isModexpPricing = buffers.get(28); - this.isModexpXbs = buffers.get(29); - this.isRdc = buffers.get(30); - this.isRipemd = buffers.get(31); - this.isSha2 = buffers.get(32); - this.isSstore = buffers.get(33); - this.isXcall = buffers.get(34); - this.modFlag = buffers.get(35); - this.oobInst = buffers.get(36); - this.outgoingData1 = buffers.get(37); - this.outgoingData2 = buffers.get(38); - this.outgoingData3 = buffers.get(39); - this.outgoingData4 = buffers.get(40); - this.outgoingInst = buffers.get(41); - this.outgoingResLo = buffers.get(42); - this.stamp = buffers.get(43); - this.wcpFlag = buffers.get(44); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace addFlag(final Boolean b) { - if (filled.get(0)) { - throw new IllegalStateException("oob.ADD_FLAG already set"); - } else { - filled.set(0); - } - - addFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ct(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("oob.CT already set"); - } else { - filled.set(1); - } - - if(b >= 8L) { throw new IllegalArgumentException("oob.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace ctMax(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("oob.CT_MAX already set"); - } else { - filled.set(2); - } - - if(b >= 8L) { throw new IllegalArgumentException("oob.CT_MAX has invalid value (" + b + ")"); } - ctMax.put((byte) b); - - - return this; - } - - public Trace data1(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("oob.DATA_1 already set"); - } else { - filled.set(3); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data5.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data6.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_7 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data7.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_8 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data8.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.DATA_9 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { data9.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("oob.OOB_INST has invalid value (" + b + ")"); } - oobInst.put((byte) (b >> 8)); - oobInst.put((byte) b); - - - return this; - } - - public Trace outgoingData1(final Bytes b) { - if (filled.get(37)) { - throw new IllegalStateException("oob.OUTGOING_DATA_1 already set"); - } else { - filled.set(37); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingData1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingData2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingData3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.OUTGOING_DATA_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingData4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("oob.OUTGOING_RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingResLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("oob.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 24)); - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace wcpFlag(final Boolean b) { - if (filled.get(44)) { - throw new IllegalStateException("oob.WCP_FLAG already set"); - } else { - filled.set(44); - } - - wcpFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("oob.ADD_FLAG has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("oob.CT has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("oob.CT_MAX has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("oob.DATA_1 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("oob.DATA_2 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("oob.DATA_3 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("oob.DATA_4 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("oob.DATA_5 has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("oob.DATA_6 has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("oob.DATA_7 has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("oob.DATA_8 has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("oob.DATA_9 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("oob.IS_BLAKE2F_CDS has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("oob.IS_BLAKE2F_PARAMS has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("oob.IS_CALL has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("oob.IS_CDL has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("oob.IS_CREATE has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("oob.IS_DEPLOYMENT has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("oob.IS_ECADD has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("oob.IS_ECMUL has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("oob.IS_ECPAIRING has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("oob.IS_ECRECOVER has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("oob.IS_IDENTITY has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("oob.IS_JUMP has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("oob.IS_JUMPI has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("oob.IS_MODEXP_CDS has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("oob.IS_MODEXP_EXTRACT has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("oob.IS_MODEXP_LEAD has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("oob.IS_MODEXP_PRICING has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("oob.IS_MODEXP_XBS has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("oob.IS_RDC has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("oob.IS_RIPEMD has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("oob.IS_SHA2 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("oob.IS_SSTORE has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("oob.IS_XCALL has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("oob.MOD_FLAG has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("oob.OOB_INST has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("oob.OUTGOING_DATA_1 has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("oob.OUTGOING_DATA_2 has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("oob.OUTGOING_DATA_3 has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("oob.OUTGOING_DATA_4 has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("oob.OUTGOING_INST has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("oob.OUTGOING_RES_LO has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("oob.STAMP has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("oob.WCP_FLAG has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - addFlag.position(addFlag.position() + 1); - } - - if (!filled.get(1)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(2)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(3)) { - data1.position(data1.position() + 16); - } - - if (!filled.get(4)) { - data2.position(data2.position() + 16); - } - - if (!filled.get(5)) { - data3.position(data3.position() + 16); - } - - if (!filled.get(6)) { - data4.position(data4.position() + 16); - } - - if (!filled.get(7)) { - data5.position(data5.position() + 16); - } - - if (!filled.get(8)) { - data6.position(data6.position() + 16); - } - - if (!filled.get(9)) { - data7.position(data7.position() + 16); - } - - if (!filled.get(10)) { - data8.position(data8.position() + 16); - } - - if (!filled.get(11)) { - data9.position(data9.position() + 16); - } - - if (!filled.get(12)) { - isBlake2FCds.position(isBlake2FCds.position() + 1); - } - - if (!filled.get(13)) { - isBlake2FParams.position(isBlake2FParams.position() + 1); - } - - if (!filled.get(14)) { - isCall.position(isCall.position() + 1); - } - - if (!filled.get(15)) { - isCdl.position(isCdl.position() + 1); - } - - if (!filled.get(16)) { - isCreate.position(isCreate.position() + 1); - } - - if (!filled.get(17)) { - isDeployment.position(isDeployment.position() + 1); - } - - if (!filled.get(18)) { - isEcadd.position(isEcadd.position() + 1); - } - - if (!filled.get(19)) { - isEcmul.position(isEcmul.position() + 1); - } - - if (!filled.get(20)) { - isEcpairing.position(isEcpairing.position() + 1); - } - - if (!filled.get(21)) { - isEcrecover.position(isEcrecover.position() + 1); - } - - if (!filled.get(22)) { - isIdentity.position(isIdentity.position() + 1); - } - - if (!filled.get(23)) { - isJump.position(isJump.position() + 1); - } - - if (!filled.get(24)) { - isJumpi.position(isJumpi.position() + 1); - } - - if (!filled.get(25)) { - isModexpCds.position(isModexpCds.position() + 1); - } - - if (!filled.get(26)) { - isModexpExtract.position(isModexpExtract.position() + 1); - } - - if (!filled.get(27)) { - isModexpLead.position(isModexpLead.position() + 1); - } - - if (!filled.get(28)) { - isModexpPricing.position(isModexpPricing.position() + 1); - } - - if (!filled.get(29)) { - isModexpXbs.position(isModexpXbs.position() + 1); - } - - if (!filled.get(30)) { - isRdc.position(isRdc.position() + 1); - } - - if (!filled.get(31)) { - isRipemd.position(isRipemd.position() + 1); - } - - if (!filled.get(32)) { - isSha2.position(isSha2.position() + 1); - } - - if (!filled.get(33)) { - isSstore.position(isSstore.position() + 1); - } - - if (!filled.get(34)) { - isXcall.position(isXcall.position() + 1); - } - - if (!filled.get(35)) { - modFlag.position(modFlag.position() + 1); - } - - if (!filled.get(36)) { - oobInst.position(oobInst.position() + 2); - } - - if (!filled.get(37)) { - outgoingData1.position(outgoingData1.position() + 16); - } - - if (!filled.get(38)) { - outgoingData2.position(outgoingData2.position() + 16); - } - - if (!filled.get(39)) { - outgoingData3.position(outgoingData3.position() + 16); - } - - if (!filled.get(40)) { - outgoingData4.position(outgoingData4.position() + 16); - } - - if (!filled.get(41)) { - outgoingInst.position(outgoingInst.position() + 1); - } - - if (!filled.get(42)) { - outgoingResLo.position(outgoingResLo.position() + 16); - } - - if (!filled.get(43)) { - stamp.position(stamp.position() + 4); - } - - if (!filled.get(44)) { - wcpFlag.position(wcpFlag.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java deleted file mode 100644 index b776e5f99..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlpaddr/Trace.java +++ /dev/null @@ -1,789 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.rlpaddr; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int MAX_CT_CREATE = 0x7; - public static final int MAX_CT_CREATE2 = 0x5; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc; - private final MappedByteBuffer accBytesize; - private final MappedByteBuffer addrHi; - private final MappedByteBuffer addrLo; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bitAcc; - private final MappedByteBuffer byte1; - private final MappedByteBuffer counter; - private final MappedByteBuffer depAddrHi; - private final MappedByteBuffer depAddrLo; - private final MappedByteBuffer index; - private final MappedByteBuffer kecHi; - private final MappedByteBuffer kecLo; - private final MappedByteBuffer lc; - private final MappedByteBuffer limb; - private final MappedByteBuffer nBytes; - private final MappedByteBuffer nonce; - private final MappedByteBuffer power; - private final MappedByteBuffer rawAddrHi; - private final MappedByteBuffer recipe; - private final MappedByteBuffer recipe1; - private final MappedByteBuffer recipe2; - private final MappedByteBuffer saltHi; - private final MappedByteBuffer saltLo; - private final MappedByteBuffer selectorKeccakRes; - private final MappedByteBuffer stamp; - private final MappedByteBuffer tinyNonZeroNonce; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlpaddr.ACC", 8, length)); - headers.add(new ColumnHeader("rlpaddr.ACC_BYTESIZE", 1, length)); - headers.add(new ColumnHeader("rlpaddr.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlpaddr.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.BIT1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlpaddr.BYTE1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.COUNTER", 1, length)); - headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlpaddr.DEP_ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.INDEX", 1, length)); - headers.add(new ColumnHeader("rlpaddr.KEC_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.KEC_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.LC", 1, length)); - headers.add(new ColumnHeader("rlpaddr.LIMB", 16, length)); - headers.add(new ColumnHeader("rlpaddr.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlpaddr.NONCE", 8, length)); - headers.add(new ColumnHeader("rlpaddr.POWER", 16, length)); - headers.add(new ColumnHeader("rlpaddr.RAW_ADDR_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE", 1, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE_1", 1, length)); - headers.add(new ColumnHeader("rlpaddr.RECIPE_2", 1, length)); - headers.add(new ColumnHeader("rlpaddr.SALT_HI", 16, length)); - headers.add(new ColumnHeader("rlpaddr.SALT_LO", 16, length)); - headers.add(new ColumnHeader("rlpaddr.SELECTOR_KECCAK_RES", 1, length)); - headers.add(new ColumnHeader("rlpaddr.STAMP", 3, length)); - headers.add(new ColumnHeader("rlpaddr.TINY_NON_ZERO_NONCE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.acc = buffers.get(0); - this.accBytesize = buffers.get(1); - this.addrHi = buffers.get(2); - this.addrLo = buffers.get(3); - this.bit1 = buffers.get(4); - this.bitAcc = buffers.get(5); - this.byte1 = buffers.get(6); - this.counter = buffers.get(7); - this.depAddrHi = buffers.get(8); - this.depAddrLo = buffers.get(9); - this.index = buffers.get(10); - this.kecHi = buffers.get(11); - this.kecLo = buffers.get(12); - this.lc = buffers.get(13); - this.limb = buffers.get(14); - this.nBytes = buffers.get(15); - this.nonce = buffers.get(16); - this.power = buffers.get(17); - this.rawAddrHi = buffers.get(18); - this.recipe = buffers.get(19); - this.recipe1 = buffers.get(20); - this.recipe2 = buffers.get(21); - this.saltHi = buffers.get(22); - this.saltLo = buffers.get(23); - this.selectorKeccakRes = buffers.get(24); - this.stamp = buffers.get(25); - this.tinyNonZeroNonce = buffers.get(26); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("rlpaddr.ACC already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("rlpaddr.ACC has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { acc.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlpaddr.ADDR_HI has invalid value (" + b + ")"); } - addrHi.put((byte) (b >> 24)); - addrHi.put((byte) (b >> 16)); - addrHi.put((byte) (b >> 8)); - addrHi.put((byte) b); - - - return this; - } - - public Trace addrLo(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("rlpaddr.ADDR_LO already set"); - } else { - filled.set(3); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlpaddr.DEP_ADDR_HI has invalid value (" + b + ")"); } - depAddrHi.put((byte) (b >> 24)); - depAddrHi.put((byte) (b >> 16)); - depAddrHi.put((byte) (b >> 8)); - depAddrHi.put((byte) b); - - - return this; - } - - public Trace depAddrLo(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("rlpaddr.DEP_ADDR_LO already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlpaddr.DEP_ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { depAddrLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.KEC_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { kecHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.KEC_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { kecLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("rlpaddr.NONCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.POWER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.RAW_ADDR_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAddrHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.SALT_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { saltHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlpaddr.SALT_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { saltLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 16777216L) { throw new IllegalArgumentException("rlpaddr.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace tinyNonZeroNonce(final Boolean b) { - if (filled.get(25)) { - throw new IllegalStateException("rlpaddr.TINY_NON_ZERO_NONCE already set"); - } else { - filled.set(25); - } - - tinyNonZeroNonce.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("rlpaddr.ACC has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("rlpaddr.ACC_BYTESIZE has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("rlpaddr.ADDR_HI has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("rlpaddr.ADDR_LO has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("rlpaddr.BIT1 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("rlpaddr.BIT_ACC has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("rlpaddr.BYTE1 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("rlpaddr.COUNTER has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("rlpaddr.DEP_ADDR_HI has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("rlpaddr.DEP_ADDR_LO has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("rlpaddr.INDEX has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("rlpaddr.KEC_HI has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("rlpaddr.KEC_LO has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("rlpaddr.LC has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("rlpaddr.LIMB has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("rlpaddr.nBYTES has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("rlpaddr.NONCE has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("rlpaddr.POWER has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("rlpaddr.RAW_ADDR_HI has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("rlpaddr.RECIPE has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("rlpaddr.RECIPE_1 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("rlpaddr.RECIPE_2 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("rlpaddr.SALT_HI has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("rlpaddr.SALT_LO has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("rlpaddr.SELECTOR_KECCAK_RES has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("rlpaddr.STAMP has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("rlpaddr.TINY_NON_ZERO_NONCE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc.position(acc.position() + 8); - } - - if (!filled.get(1)) { - accBytesize.position(accBytesize.position() + 1); - } - - if (!filled.get(2)) { - addrHi.position(addrHi.position() + 4); - } - - if (!filled.get(3)) { - addrLo.position(addrLo.position() + 16); - } - - if (!filled.get(4)) { - bit1.position(bit1.position() + 1); - } - - if (!filled.get(5)) { - bitAcc.position(bitAcc.position() + 1); - } - - if (!filled.get(6)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(7)) { - counter.position(counter.position() + 1); - } - - if (!filled.get(8)) { - depAddrHi.position(depAddrHi.position() + 4); - } - - if (!filled.get(9)) { - depAddrLo.position(depAddrLo.position() + 16); - } - - if (!filled.get(10)) { - index.position(index.position() + 1); - } - - if (!filled.get(11)) { - kecHi.position(kecHi.position() + 16); - } - - if (!filled.get(12)) { - kecLo.position(kecLo.position() + 16); - } - - if (!filled.get(13)) { - lc.position(lc.position() + 1); - } - - if (!filled.get(14)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(26)) { - nBytes.position(nBytes.position() + 1); - } - - if (!filled.get(15)) { - nonce.position(nonce.position() + 8); - } - - if (!filled.get(16)) { - power.position(power.position() + 16); - } - - if (!filled.get(17)) { - rawAddrHi.position(rawAddrHi.position() + 16); - } - - if (!filled.get(18)) { - recipe.position(recipe.position() + 1); - } - - if (!filled.get(19)) { - recipe1.position(recipe1.position() + 1); - } - - if (!filled.get(20)) { - recipe2.position(recipe2.position() + 1); - } - - if (!filled.get(21)) { - saltHi.position(saltHi.position() + 16); - } - - if (!filled.get(22)) { - saltLo.position(saltLo.position() + 16); - } - - if (!filled.get(23)) { - selectorKeccakRes.position(selectorKeccakRes.position() + 1); - } - - if (!filled.get(24)) { - stamp.position(stamp.position() + 3); - } - - if (!filled.get(25)) { - tinyNonZeroNonce.position(tinyNonZeroNonce.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java deleted file mode 100644 index 721126814..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxn/Trace.java +++ /dev/null @@ -1,1592 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.rlptxn; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absTxNum; - private final MappedByteBuffer absTxNumInfiny; - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer accBytesize; - private final MappedByteBuffer accessTupleBytesize; - private final MappedByteBuffer addrHi; - private final MappedByteBuffer addrLo; - private final MappedByteBuffer bit; - private final MappedByteBuffer bitAcc; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer counter; - private final MappedByteBuffer dataGasCost; - private final MappedByteBuffer dataHi; - private final MappedByteBuffer dataLo; - private final MappedByteBuffer depth1; - private final MappedByteBuffer depth2; - private final MappedByteBuffer done; - private final MappedByteBuffer indexData; - private final MappedByteBuffer indexLt; - private final MappedByteBuffer indexLx; - private final MappedByteBuffer input1; - private final MappedByteBuffer input2; - private final MappedByteBuffer isPhaseAccessList; - private final MappedByteBuffer isPhaseBeta; - private final MappedByteBuffer isPhaseChainId; - private final MappedByteBuffer isPhaseData; - private final MappedByteBuffer isPhaseGasLimit; - private final MappedByteBuffer isPhaseGasPrice; - private final MappedByteBuffer isPhaseMaxFeePerGas; - private final MappedByteBuffer isPhaseMaxPriorityFeePerGas; - private final MappedByteBuffer isPhaseNonce; - private final MappedByteBuffer isPhaseR; - private final MappedByteBuffer isPhaseRlpPrefix; - private final MappedByteBuffer isPhaseS; - private final MappedByteBuffer isPhaseTo; - private final MappedByteBuffer isPhaseValue; - private final MappedByteBuffer isPhaseY; - private final MappedByteBuffer isPrefix; - private final MappedByteBuffer lcCorrection; - private final MappedByteBuffer limb; - private final MappedByteBuffer limbConstructed; - private final MappedByteBuffer lt; - private final MappedByteBuffer lx; - private final MappedByteBuffer nAddr; - private final MappedByteBuffer nBytes; - private final MappedByteBuffer nKeys; - private final MappedByteBuffer nKeysPerAddr; - private final MappedByteBuffer nStep; - private final MappedByteBuffer phase; - private final MappedByteBuffer phaseEnd; - private final MappedByteBuffer phaseSize; - private final MappedByteBuffer power; - private final MappedByteBuffer requiresEvmExecution; - private final MappedByteBuffer rlpLtBytesize; - private final MappedByteBuffer rlpLxBytesize; - private final MappedByteBuffer toHashByProver; - private final MappedByteBuffer type; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM", 2, length)); - headers.add(new ColumnHeader("rlptxn.ABS_TX_NUM_INFINY", 2, length)); - headers.add(new ColumnHeader("rlptxn.ACC_1", 16, length)); - headers.add(new ColumnHeader("rlptxn.ACC_2", 16, length)); - headers.add(new ColumnHeader("rlptxn.ACC_BYTESIZE", 1, length)); - headers.add(new ColumnHeader("rlptxn.ACCESS_TUPLE_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.ADDR_HI", 4, length)); - headers.add(new ColumnHeader("rlptxn.ADDR_LO", 16, length)); - headers.add(new ColumnHeader("rlptxn.BIT", 1, length)); - headers.add(new ColumnHeader("rlptxn.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlptxn.BYTE_1", 1, length)); - headers.add(new ColumnHeader("rlptxn.BYTE_2", 1, length)); - headers.add(new ColumnHeader("rlptxn.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("rlptxn.COUNTER", 1, length)); - headers.add(new ColumnHeader("rlptxn.DATA_GAS_COST", 4, length)); - headers.add(new ColumnHeader("rlptxn.DATA_HI", 16, length)); - headers.add(new ColumnHeader("rlptxn.DATA_LO", 16, length)); - headers.add(new ColumnHeader("rlptxn.DEPTH_1", 1, length)); - headers.add(new ColumnHeader("rlptxn.DEPTH_2", 1, length)); - headers.add(new ColumnHeader("rlptxn.DONE", 1, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_DATA", 4, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_LT", 4, length)); - headers.add(new ColumnHeader("rlptxn.INDEX_LX", 4, length)); - headers.add(new ColumnHeader("rlptxn.INPUT_1", 16, length)); - headers.add(new ColumnHeader("rlptxn.INPUT_2", 16, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_ACCESS_LIST", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_BETA", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_CHAIN_ID", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_DATA", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_LIMIT", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_GAS_PRICE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_FEE_PER_GAS", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_NONCE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_R", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_RLP_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_S", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_TO", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_VALUE", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PHASE_Y", 1, length)); - headers.add(new ColumnHeader("rlptxn.IS_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxn.LC_CORRECTION", 1, length)); - headers.add(new ColumnHeader("rlptxn.LIMB", 16, length)); - headers.add(new ColumnHeader("rlptxn.LIMB_CONSTRUCTED", 1, length)); - headers.add(new ColumnHeader("rlptxn.LT", 1, length)); - headers.add(new ColumnHeader("rlptxn.LX", 1, length)); - headers.add(new ColumnHeader("rlptxn.nADDR", 2, length)); - headers.add(new ColumnHeader("rlptxn.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlptxn.nKEYS", 2, length)); - headers.add(new ColumnHeader("rlptxn.nKEYS_PER_ADDR", 2, length)); - headers.add(new ColumnHeader("rlptxn.nSTEP", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE_END", 1, length)); - headers.add(new ColumnHeader("rlptxn.PHASE_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxn.POWER", 16, length)); - headers.add(new ColumnHeader("rlptxn.REQUIRES_EVM_EXECUTION", 1, length)); - headers.add(new ColumnHeader("rlptxn.RLP_LT_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.RLP_LX_BYTESIZE", 3, length)); - headers.add(new ColumnHeader("rlptxn.TO_HASH_BY_PROVER", 1, length)); - headers.add(new ColumnHeader("rlptxn.TYPE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.absTxNum = buffers.get(0); - this.absTxNumInfiny = buffers.get(1); - this.acc1 = buffers.get(2); - this.acc2 = buffers.get(3); - this.accBytesize = buffers.get(4); - this.accessTupleBytesize = buffers.get(5); - this.addrHi = buffers.get(6); - this.addrLo = buffers.get(7); - this.bit = buffers.get(8); - this.bitAcc = buffers.get(9); - this.byte1 = buffers.get(10); - this.byte2 = buffers.get(11); - this.codeFragmentIndex = buffers.get(12); - this.counter = buffers.get(13); - this.dataGasCost = buffers.get(14); - this.dataHi = buffers.get(15); - this.dataLo = buffers.get(16); - this.depth1 = buffers.get(17); - this.depth2 = buffers.get(18); - this.done = buffers.get(19); - this.indexData = buffers.get(20); - this.indexLt = buffers.get(21); - this.indexLx = buffers.get(22); - this.input1 = buffers.get(23); - this.input2 = buffers.get(24); - this.isPhaseAccessList = buffers.get(25); - this.isPhaseBeta = buffers.get(26); - this.isPhaseChainId = buffers.get(27); - this.isPhaseData = buffers.get(28); - this.isPhaseGasLimit = buffers.get(29); - this.isPhaseGasPrice = buffers.get(30); - this.isPhaseMaxFeePerGas = buffers.get(31); - this.isPhaseMaxPriorityFeePerGas = buffers.get(32); - this.isPhaseNonce = buffers.get(33); - this.isPhaseR = buffers.get(34); - this.isPhaseRlpPrefix = buffers.get(35); - this.isPhaseS = buffers.get(36); - this.isPhaseTo = buffers.get(37); - this.isPhaseValue = buffers.get(38); - this.isPhaseY = buffers.get(39); - this.isPrefix = buffers.get(40); - this.lcCorrection = buffers.get(41); - this.limb = buffers.get(42); - this.limbConstructed = buffers.get(43); - this.lt = buffers.get(44); - this.lx = buffers.get(45); - this.nAddr = buffers.get(46); - this.nBytes = buffers.get(47); - this.nKeys = buffers.get(48); - this.nKeysPerAddr = buffers.get(49); - this.nStep = buffers.get(50); - this.phase = buffers.get(51); - this.phaseEnd = buffers.get(52); - this.phaseSize = buffers.get(53); - this.power = buffers.get(54); - this.requiresEvmExecution = buffers.get(55); - this.rlpLtBytesize = buffers.get(56); - this.rlpLxBytesize = buffers.get(57); - this.toHashByProver = buffers.get(58); - this.type = buffers.get(59); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absTxNum(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("rlptxn.ABS_TX_NUM already set"); - } else { - filled.set(0); - } - - if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.ABS_TX_NUM has invalid value (" + b + ")"); } - absTxNum.put((byte) (b >> 8)); - absTxNum.put((byte) b); - - - return this; - } - - public Trace absTxNumInfiny(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("rlptxn.ABS_TX_NUM_INFINY already set"); - } else { - filled.set(1); - } - - if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.ABS_TX_NUM_INFINY has invalid value (" + b + ")"); } - absTxNumInfiny.put((byte) (b >> 8)); - absTxNumInfiny.put((byte) b); - - - return this; - } - - public Trace acc1(final Bytes b) { - if (filled.get(3)) { - throw new IllegalStateException("rlptxn.ACC_1 already set"); - } else { - filled.set(3); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxn.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j= 32L) { throw new IllegalArgumentException("rlptxn.ACC_BYTESIZE has invalid value (" + b + ")"); } - accBytesize.put((byte) b); - - - return this; - } - - public Trace accessTupleBytesize(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("rlptxn.ACCESS_TUPLE_BYTESIZE already set"); - } else { - filled.set(2); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("rlptxn.ACCESS_TUPLE_BYTESIZE has invalid value (" + b + ")"); } - accessTupleBytesize.put((byte) (b >> 16)); - accessTupleBytesize.put((byte) (b >> 8)); - accessTupleBytesize.put((byte) b); - - - return this; - } - - public Trace addrHi(final long b) { - if (filled.get(6)) { - throw new IllegalStateException("rlptxn.ADDR_HI already set"); - } else { - filled.set(6); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.ADDR_HI has invalid value (" + b + ")"); } - addrHi.put((byte) (b >> 24)); - addrHi.put((byte) (b >> 16)); - addrHi.put((byte) (b >> 8)); - addrHi.put((byte) b); - - - return this; - } - - public Trace addrLo(final Bytes b) { - if (filled.get(7)) { - throw new IllegalStateException("rlptxn.ADDR_LO already set"); - } else { - filled.set(7); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.ADDR_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addrLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlptxn.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndex.put((byte) (b >> 24)); - codeFragmentIndex.put((byte) (b >> 16)); - codeFragmentIndex.put((byte) (b >> 8)); - codeFragmentIndex.put((byte) b); - - - return this; - } - - public Trace counter(final long b) { - if (filled.get(13)) { - throw new IllegalStateException("rlptxn.COUNTER already set"); - } else { - filled.set(13); - } - - if(b >= 32L) { throw new IllegalArgumentException("rlptxn.COUNTER has invalid value (" + b + ")"); } - counter.put((byte) b); - - - return this; - } - - public Trace dataGasCost(final long b) { - if (filled.get(14)) { - throw new IllegalStateException("rlptxn.DATA_GAS_COST already set"); - } else { - filled.set(14); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.DATA_GAS_COST has invalid value (" + b + ")"); } - dataGasCost.put((byte) (b >> 24)); - dataGasCost.put((byte) (b >> 16)); - dataGasCost.put((byte) (b >> 8)); - dataGasCost.put((byte) b); - - - return this; - } - - public Trace dataHi(final Bytes b) { - if (filled.get(15)) { - throw new IllegalStateException("rlptxn.DATA_HI already set"); - } else { - filled.set(15); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.DATA_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxn.DATA_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { dataLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_DATA has invalid value (" + b + ")"); } - indexData.put((byte) (b >> 24)); - indexData.put((byte) (b >> 16)); - indexData.put((byte) (b >> 8)); - indexData.put((byte) b); - - - return this; - } - - public Trace indexLt(final long b) { - if (filled.get(21)) { - throw new IllegalStateException("rlptxn.INDEX_LT already set"); - } else { - filled.set(21); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_LT has invalid value (" + b + ")"); } - indexLt.put((byte) (b >> 24)); - indexLt.put((byte) (b >> 16)); - indexLt.put((byte) (b >> 8)); - indexLt.put((byte) b); - - - return this; - } - - public Trace indexLx(final long b) { - if (filled.get(22)) { - throw new IllegalStateException("rlptxn.INDEX_LX already set"); - } else { - filled.set(22); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.INDEX_LX has invalid value (" + b + ")"); } - indexLx.put((byte) (b >> 24)); - indexLx.put((byte) (b >> 16)); - indexLx.put((byte) (b >> 8)); - indexLx.put((byte) b); - - - return this; - } - - public Trace input1(final Bytes b) { - if (filled.get(23)) { - throw new IllegalStateException("rlptxn.INPUT_1 already set"); - } else { - filled.set(23); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxn.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxn.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("rlptxn.nADDR has invalid value (" + b + ")"); } - nAddr.put((byte) (b >> 8)); - nAddr.put((byte) b); - - - return this; - } - - public Trace nBytes(final long b) { - if (filled.get(56)) { - throw new IllegalStateException("rlptxn.nBYTES already set"); - } else { - filled.set(56); - } - - if(b >= 32L) { throw new IllegalArgumentException("rlptxn.nBYTES has invalid value (" + b + ")"); } - nBytes.put((byte) b); - - - return this; - } - - public Trace nKeys(final long b) { - if (filled.get(57)) { - throw new IllegalStateException("rlptxn.nKEYS already set"); - } else { - filled.set(57); - } - - if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.nKEYS has invalid value (" + b + ")"); } - nKeys.put((byte) (b >> 8)); - nKeys.put((byte) b); - - - return this; - } - - public Trace nKeysPerAddr(final long b) { - if (filled.get(58)) { - throw new IllegalStateException("rlptxn.nKEYS_PER_ADDR already set"); - } else { - filled.set(58); - } - - if(b >= 65536L) { throw new IllegalArgumentException("rlptxn.nKEYS_PER_ADDR has invalid value (" + b + ")"); } - nKeysPerAddr.put((byte) (b >> 8)); - nKeysPerAddr.put((byte) b); - - - return this; - } - - public Trace nStep(final long b) { - if (filled.get(59)) { - throw new IllegalStateException("rlptxn.nSTEP already set"); - } else { - filled.set(59); - } - - if(b >= 32L) { throw new IllegalArgumentException("rlptxn.nSTEP has invalid value (" + b + ")"); } - nStep.put((byte) b); - - - return this; - } - - public Trace phase(final long b) { - if (filled.get(46)) { - throw new IllegalStateException("rlptxn.PHASE already set"); - } else { - filled.set(46); - } - - if(b >= 32L) { throw new IllegalArgumentException("rlptxn.PHASE has invalid value (" + b + ")"); } - phase.put((byte) b); - - - return this; - } - - public Trace phaseEnd(final Boolean b) { - if (filled.get(47)) { - throw new IllegalStateException("rlptxn.PHASE_END already set"); - } else { - filled.set(47); - } - - phaseEnd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phaseSize(final long b) { - if (filled.get(48)) { - throw new IllegalStateException("rlptxn.PHASE_SIZE already set"); - } else { - filled.set(48); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxn.PHASE_SIZE has invalid value (" + b + ")"); } - phaseSize.put((byte) (b >> 24)); - phaseSize.put((byte) (b >> 16)); - phaseSize.put((byte) (b >> 8)); - phaseSize.put((byte) b); - - - return this; - } - - public Trace power(final Bytes b) { - if (filled.get(49)) { - throw new IllegalStateException("rlptxn.POWER already set"); - } else { - filled.set(49); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxn.POWER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } - // Write bytes - for(int j=0; j= 16777216L) { throw new IllegalArgumentException("rlptxn.RLP_LT_BYTESIZE has invalid value (" + b + ")"); } - rlpLtBytesize.put((byte) (b >> 16)); - rlpLtBytesize.put((byte) (b >> 8)); - rlpLtBytesize.put((byte) b); - - - return this; - } - - public Trace rlpLxBytesize(final long b) { - if (filled.get(52)) { - throw new IllegalStateException("rlptxn.RLP_LX_BYTESIZE already set"); - } else { - filled.set(52); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("rlptxn.RLP_LX_BYTESIZE has invalid value (" + b + ")"); } - rlpLxBytesize.put((byte) (b >> 16)); - rlpLxBytesize.put((byte) (b >> 8)); - rlpLxBytesize.put((byte) b); - - - return this; - } - - public Trace toHashByProver(final Boolean b) { - if (filled.get(53)) { - throw new IllegalStateException("rlptxn.TO_HASH_BY_PROVER already set"); - } else { - filled.set(53); - } - - toHashByProver.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace type(final long b) { - if (filled.get(54)) { - throw new IllegalStateException("rlptxn.TYPE already set"); - } else { - filled.set(54); - } - - if(b >= 8L) { throw new IllegalArgumentException("rlptxn.TYPE has invalid value (" + b + ")"); } - type.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("rlptxn.ABS_TX_NUM has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("rlptxn.ABS_TX_NUM_INFINY has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("rlptxn.ACC_1 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("rlptxn.ACC_2 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("rlptxn.ACC_BYTESIZE has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("rlptxn.ACCESS_TUPLE_BYTESIZE has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("rlptxn.ADDR_HI has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("rlptxn.ADDR_LO has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("rlptxn.BIT has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("rlptxn.BIT_ACC has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("rlptxn.BYTE_1 has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("rlptxn.BYTE_2 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("rlptxn.CODE_FRAGMENT_INDEX has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("rlptxn.COUNTER has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("rlptxn.DATA_GAS_COST has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("rlptxn.DATA_HI has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("rlptxn.DATA_LO has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("rlptxn.DEPTH_1 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("rlptxn.DEPTH_2 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("rlptxn.DONE has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("rlptxn.INDEX_DATA has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("rlptxn.INDEX_LT has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("rlptxn.INDEX_LX has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("rlptxn.INPUT_1 has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("rlptxn.INPUT_2 has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("rlptxn.IS_PHASE_ACCESS_LIST has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("rlptxn.IS_PHASE_BETA has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("rlptxn.IS_PHASE_CHAIN_ID has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("rlptxn.IS_PHASE_DATA has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("rlptxn.IS_PHASE_GAS_LIMIT has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("rlptxn.IS_PHASE_GAS_PRICE has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("rlptxn.IS_PHASE_MAX_FEE_PER_GAS has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("rlptxn.IS_PHASE_MAX_PRIORITY_FEE_PER_GAS has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("rlptxn.IS_PHASE_NONCE has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("rlptxn.IS_PHASE_R has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("rlptxn.IS_PHASE_RLP_PREFIX has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("rlptxn.IS_PHASE_S has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("rlptxn.IS_PHASE_TO has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("rlptxn.IS_PHASE_VALUE has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("rlptxn.IS_PHASE_Y has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("rlptxn.IS_PREFIX has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("rlptxn.LC_CORRECTION has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("rlptxn.LIMB has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("rlptxn.LIMB_CONSTRUCTED has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("rlptxn.LT has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("rlptxn.LX has not been filled"); - } - - if (!filled.get(55)) { - throw new IllegalStateException("rlptxn.nADDR has not been filled"); - } - - if (!filled.get(56)) { - throw new IllegalStateException("rlptxn.nBYTES has not been filled"); - } - - if (!filled.get(57)) { - throw new IllegalStateException("rlptxn.nKEYS has not been filled"); - } - - if (!filled.get(58)) { - throw new IllegalStateException("rlptxn.nKEYS_PER_ADDR has not been filled"); - } - - if (!filled.get(59)) { - throw new IllegalStateException("rlptxn.nSTEP has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("rlptxn.PHASE has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("rlptxn.PHASE_END has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("rlptxn.PHASE_SIZE has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("rlptxn.POWER has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("rlptxn.REQUIRES_EVM_EXECUTION has not been filled"); - } - - if (!filled.get(51)) { - throw new IllegalStateException("rlptxn.RLP_LT_BYTESIZE has not been filled"); - } - - if (!filled.get(52)) { - throw new IllegalStateException("rlptxn.RLP_LX_BYTESIZE has not been filled"); - } - - if (!filled.get(53)) { - throw new IllegalStateException("rlptxn.TO_HASH_BY_PROVER has not been filled"); - } - - if (!filled.get(54)) { - throw new IllegalStateException("rlptxn.TYPE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - absTxNum.position(absTxNum.position() + 2); - } - - if (!filled.get(1)) { - absTxNumInfiny.position(absTxNumInfiny.position() + 2); - } - - if (!filled.get(3)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(4)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(5)) { - accBytesize.position(accBytesize.position() + 1); - } - - if (!filled.get(2)) { - accessTupleBytesize.position(accessTupleBytesize.position() + 3); - } - - if (!filled.get(6)) { - addrHi.position(addrHi.position() + 4); - } - - if (!filled.get(7)) { - addrLo.position(addrLo.position() + 16); - } - - if (!filled.get(8)) { - bit.position(bit.position() + 1); - } - - if (!filled.get(9)) { - bitAcc.position(bitAcc.position() + 1); - } - - if (!filled.get(10)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(11)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(12)) { - codeFragmentIndex.position(codeFragmentIndex.position() + 4); - } - - if (!filled.get(13)) { - counter.position(counter.position() + 1); - } - - if (!filled.get(14)) { - dataGasCost.position(dataGasCost.position() + 4); - } - - if (!filled.get(15)) { - dataHi.position(dataHi.position() + 16); - } - - if (!filled.get(16)) { - dataLo.position(dataLo.position() + 16); - } - - if (!filled.get(17)) { - depth1.position(depth1.position() + 1); - } - - if (!filled.get(18)) { - depth2.position(depth2.position() + 1); - } - - if (!filled.get(19)) { - done.position(done.position() + 1); - } - - if (!filled.get(20)) { - indexData.position(indexData.position() + 4); - } - - if (!filled.get(21)) { - indexLt.position(indexLt.position() + 4); - } - - if (!filled.get(22)) { - indexLx.position(indexLx.position() + 4); - } - - if (!filled.get(23)) { - input1.position(input1.position() + 16); - } - - if (!filled.get(24)) { - input2.position(input2.position() + 16); - } - - if (!filled.get(25)) { - isPhaseAccessList.position(isPhaseAccessList.position() + 1); - } - - if (!filled.get(26)) { - isPhaseBeta.position(isPhaseBeta.position() + 1); - } - - if (!filled.get(27)) { - isPhaseChainId.position(isPhaseChainId.position() + 1); - } - - if (!filled.get(28)) { - isPhaseData.position(isPhaseData.position() + 1); - } - - if (!filled.get(29)) { - isPhaseGasLimit.position(isPhaseGasLimit.position() + 1); - } - - if (!filled.get(30)) { - isPhaseGasPrice.position(isPhaseGasPrice.position() + 1); - } - - if (!filled.get(31)) { - isPhaseMaxFeePerGas.position(isPhaseMaxFeePerGas.position() + 1); - } - - if (!filled.get(32)) { - isPhaseMaxPriorityFeePerGas.position(isPhaseMaxPriorityFeePerGas.position() + 1); - } - - if (!filled.get(33)) { - isPhaseNonce.position(isPhaseNonce.position() + 1); - } - - if (!filled.get(34)) { - isPhaseR.position(isPhaseR.position() + 1); - } - - if (!filled.get(35)) { - isPhaseRlpPrefix.position(isPhaseRlpPrefix.position() + 1); - } - - if (!filled.get(36)) { - isPhaseS.position(isPhaseS.position() + 1); - } - - if (!filled.get(37)) { - isPhaseTo.position(isPhaseTo.position() + 1); - } - - if (!filled.get(38)) { - isPhaseValue.position(isPhaseValue.position() + 1); - } - - if (!filled.get(39)) { - isPhaseY.position(isPhaseY.position() + 1); - } - - if (!filled.get(40)) { - isPrefix.position(isPrefix.position() + 1); - } - - if (!filled.get(41)) { - lcCorrection.position(lcCorrection.position() + 1); - } - - if (!filled.get(42)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(43)) { - limbConstructed.position(limbConstructed.position() + 1); - } - - if (!filled.get(44)) { - lt.position(lt.position() + 1); - } - - if (!filled.get(45)) { - lx.position(lx.position() + 1); - } - - if (!filled.get(55)) { - nAddr.position(nAddr.position() + 2); - } - - if (!filled.get(56)) { - nBytes.position(nBytes.position() + 1); - } - - if (!filled.get(57)) { - nKeys.position(nKeys.position() + 2); - } - - if (!filled.get(58)) { - nKeysPerAddr.position(nKeysPerAddr.position() + 2); - } - - if (!filled.get(59)) { - nStep.position(nStep.position() + 1); - } - - if (!filled.get(46)) { - phase.position(phase.position() + 1); - } - - if (!filled.get(47)) { - phaseEnd.position(phaseEnd.position() + 1); - } - - if (!filled.get(48)) { - phaseSize.position(phaseSize.position() + 4); - } - - if (!filled.get(49)) { - power.position(power.position() + 16); - } - - if (!filled.get(50)) { - requiresEvmExecution.position(requiresEvmExecution.position() + 1); - } - - if (!filled.get(51)) { - rlpLtBytesize.position(rlpLtBytesize.position() + 3); - } - - if (!filled.get(52)) { - rlpLxBytesize.position(rlpLxBytesize.position() + 3); - } - - if (!filled.get(53)) { - toHashByProver.position(toHashByProver.position() + 1); - } - - if (!filled.get(54)) { - type.position(type.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java deleted file mode 100644 index 500b75734..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rlptxrcpt/Trace.java +++ /dev/null @@ -1,1227 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.rlptxrcpt; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int SUBPHASE_ID_WEIGHT_DEPTH = 0x30; - public static final int SUBPHASE_ID_WEIGHT_INDEX_LOCAL = 0x60; - public static final int SUBPHASE_ID_WEIGHT_IS_OD = 0x18; - public static final int SUBPHASE_ID_WEIGHT_IS_OT = 0xc; - public static final int SUBPHASE_ID_WEIGHT_IS_PREFIX = 0x6; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absLogNum; - private final MappedByteBuffer absLogNumMax; - private final MappedByteBuffer absTxNum; - private final MappedByteBuffer absTxNumMax; - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer accSize; - private final MappedByteBuffer bit; - private final MappedByteBuffer bitAcc; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer byte3; - private final MappedByteBuffer byte4; - private final MappedByteBuffer counter; - private final MappedByteBuffer depth1; - private final MappedByteBuffer done; - private final MappedByteBuffer index; - private final MappedByteBuffer indexLocal; - private final MappedByteBuffer input1; - private final MappedByteBuffer input2; - private final MappedByteBuffer input3; - private final MappedByteBuffer input4; - private final MappedByteBuffer isData; - private final MappedByteBuffer isPrefix; - private final MappedByteBuffer isTopic; - private final MappedByteBuffer lcCorrection; - private final MappedByteBuffer limb; - private final MappedByteBuffer limbConstructed; - private final MappedByteBuffer localSize; - private final MappedByteBuffer logEntrySize; - private final MappedByteBuffer nBytes; - private final MappedByteBuffer nStep; - private final MappedByteBuffer phase1; - private final MappedByteBuffer phase2; - private final MappedByteBuffer phase3; - private final MappedByteBuffer phase4; - private final MappedByteBuffer phase5; - private final MappedByteBuffer phaseEnd; - private final MappedByteBuffer phaseId; - private final MappedByteBuffer phaseSize; - private final MappedByteBuffer power; - private final MappedByteBuffer txrcptSize; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_LOG_NUM_MAX", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ABS_TX_NUM_MAX", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_1", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_2", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_3", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_4", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.ACC_SIZE", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BIT", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BIT_ACC", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_2", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_3", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.BYTE_4", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.COUNTER", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.DEPTH_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.DONE", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.INDEX", 3, length)); - headers.add(new ColumnHeader("rlptxrcpt.INDEX_LOCAL", 3, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_1", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_2", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_3", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.INPUT_4", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_DATA", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_PREFIX", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.IS_TOPIC", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LC_CORRECTION", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LIMB", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.LIMB_CONSTRUCTED", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.LOCAL_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.LOG_ENTRY_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.nBYTES", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.nSTEP", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_1", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_2", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_3", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_4", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_5", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_END", 1, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_ID", 2, length)); - headers.add(new ColumnHeader("rlptxrcpt.PHASE_SIZE", 4, length)); - headers.add(new ColumnHeader("rlptxrcpt.POWER", 16, length)); - headers.add(new ColumnHeader("rlptxrcpt.TXRCPT_SIZE", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.absLogNum = buffers.get(0); - this.absLogNumMax = buffers.get(1); - this.absTxNum = buffers.get(2); - this.absTxNumMax = buffers.get(3); - this.acc1 = buffers.get(4); - this.acc2 = buffers.get(5); - this.acc3 = buffers.get(6); - this.acc4 = buffers.get(7); - this.accSize = buffers.get(8); - this.bit = buffers.get(9); - this.bitAcc = buffers.get(10); - this.byte1 = buffers.get(11); - this.byte2 = buffers.get(12); - this.byte3 = buffers.get(13); - this.byte4 = buffers.get(14); - this.counter = buffers.get(15); - this.depth1 = buffers.get(16); - this.done = buffers.get(17); - this.index = buffers.get(18); - this.indexLocal = buffers.get(19); - this.input1 = buffers.get(20); - this.input2 = buffers.get(21); - this.input3 = buffers.get(22); - this.input4 = buffers.get(23); - this.isData = buffers.get(24); - this.isPrefix = buffers.get(25); - this.isTopic = buffers.get(26); - this.lcCorrection = buffers.get(27); - this.limb = buffers.get(28); - this.limbConstructed = buffers.get(29); - this.localSize = buffers.get(30); - this.logEntrySize = buffers.get(31); - this.nBytes = buffers.get(32); - this.nStep = buffers.get(33); - this.phase1 = buffers.get(34); - this.phase2 = buffers.get(35); - this.phase3 = buffers.get(36); - this.phase4 = buffers.get(37); - this.phase5 = buffers.get(38); - this.phaseEnd = buffers.get(39); - this.phaseId = buffers.get(40); - this.phaseSize = buffers.get(41); - this.power = buffers.get(42); - this.txrcptSize = buffers.get(43); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absLogNum(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("rlptxrcpt.ABS_LOG_NUM already set"); - } else { - filled.set(0); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM has invalid value (" + b + ")"); } - absLogNum.put((byte) (b >> 24)); - absLogNum.put((byte) (b >> 16)); - absLogNum.put((byte) (b >> 8)); - absLogNum.put((byte) b); - - - return this; - } - - public Trace absLogNumMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("rlptxrcpt.ABS_LOG_NUM_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_LOG_NUM_MAX has invalid value (" + b + ")"); } - absLogNumMax.put((byte) (b >> 24)); - absLogNumMax.put((byte) (b >> 16)); - absLogNumMax.put((byte) (b >> 8)); - absLogNumMax.put((byte) b); - - - return this; - } - - public Trace absTxNum(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("rlptxrcpt.ABS_TX_NUM already set"); - } else { - filled.set(2); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM has invalid value (" + b + ")"); } - absTxNum.put((byte) (b >> 24)); - absTxNum.put((byte) (b >> 16)); - absTxNum.put((byte) (b >> 8)); - absTxNum.put((byte) b); - - - return this; - } - - public Trace absTxNumMax(final long b) { - if (filled.get(3)) { - throw new IllegalStateException("rlptxrcpt.ABS_TX_NUM_MAX already set"); - } else { - filled.set(3); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.ABS_TX_NUM_MAX has invalid value (" + b + ")"); } - absTxNumMax.put((byte) (b >> 24)); - absTxNumMax.put((byte) (b >> 16)); - absTxNumMax.put((byte) (b >> 8)); - absTxNumMax.put((byte) b); - - - return this; - } - - public Trace acc1(final Bytes b) { - if (filled.get(4)) { - throw new IllegalStateException("rlptxrcpt.ACC_1 already set"); - } else { - filled.set(4); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j= 32L) { throw new IllegalArgumentException("rlptxrcpt.ACC_SIZE has invalid value (" + b + ")"); } - accSize.put((byte) b); - - - return this; - } - - public Trace bit(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("rlptxrcpt.BIT already set"); - } else { - filled.set(9); - } - - bit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace bitAcc(final UnsignedByte b) { - if (filled.get(10)) { - throw new IllegalStateException("rlptxrcpt.BIT_ACC already set"); - } else { - filled.set(10); - } - - bitAcc.put(b.toByte()); - - return this; - } - - public Trace byte1(final UnsignedByte b) { - if (filled.get(11)) { - throw new IllegalStateException("rlptxrcpt.BYTE_1 already set"); - } else { - filled.set(11); - } - - byte1.put(b.toByte()); - - return this; - } - - public Trace byte2(final UnsignedByte b) { - if (filled.get(12)) { - throw new IllegalStateException("rlptxrcpt.BYTE_2 already set"); - } else { - filled.set(12); - } - - byte2.put(b.toByte()); - - return this; - } - - public Trace byte3(final UnsignedByte b) { - if (filled.get(13)) { - throw new IllegalStateException("rlptxrcpt.BYTE_3 already set"); - } else { - filled.set(13); - } - - byte3.put(b.toByte()); - - return this; - } - - public Trace byte4(final UnsignedByte b) { - if (filled.get(14)) { - throw new IllegalStateException("rlptxrcpt.BYTE_4 already set"); - } else { - filled.set(14); - } - - byte4.put(b.toByte()); - - return this; - } - - public Trace counter(final long b) { - if (filled.get(15)) { - throw new IllegalStateException("rlptxrcpt.COUNTER already set"); - } else { - filled.set(15); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.COUNTER has invalid value (" + b + ")"); } - counter.put((byte) (b >> 24)); - counter.put((byte) (b >> 16)); - counter.put((byte) (b >> 8)); - counter.put((byte) b); - - - return this; - } - - public Trace depth1(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("rlptxrcpt.DEPTH_1 already set"); - } else { - filled.set(16); - } - - depth1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace done(final Boolean b) { - if (filled.get(17)) { - throw new IllegalStateException("rlptxrcpt.DONE already set"); - } else { - filled.set(17); - } - - done.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace index(final long b) { - if (filled.get(18)) { - throw new IllegalStateException("rlptxrcpt.INDEX already set"); - } else { - filled.set(18); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("rlptxrcpt.INDEX has invalid value (" + b + ")"); } - index.put((byte) (b >> 16)); - index.put((byte) (b >> 8)); - index.put((byte) b); - - - return this; - } - - public Trace indexLocal(final long b) { - if (filled.get(19)) { - throw new IllegalStateException("rlptxrcpt.INDEX_LOCAL already set"); - } else { - filled.set(19); - } - - if(b >= 16777216L) { throw new IllegalArgumentException("rlptxrcpt.INDEX_LOCAL has invalid value (" + b + ")"); } - indexLocal.put((byte) (b >> 16)); - indexLocal.put((byte) (b >> 8)); - indexLocal.put((byte) b); - - - return this; - } - - public Trace input1(final Bytes b) { - if (filled.get(20)) { - throw new IllegalStateException("rlptxrcpt.INPUT_1 already set"); - } else { - filled.set(20); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.INPUT_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { input4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rlptxrcpt.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.LOCAL_SIZE has invalid value (" + b + ")"); } - localSize.put((byte) (b >> 24)); - localSize.put((byte) (b >> 16)); - localSize.put((byte) (b >> 8)); - localSize.put((byte) b); - - - return this; - } - - public Trace logEntrySize(final long b) { - if (filled.get(31)) { - throw new IllegalStateException("rlptxrcpt.LOG_ENTRY_SIZE already set"); - } else { - filled.set(31); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.LOG_ENTRY_SIZE has invalid value (" + b + ")"); } - logEntrySize.put((byte) (b >> 24)); - logEntrySize.put((byte) (b >> 16)); - logEntrySize.put((byte) (b >> 8)); - logEntrySize.put((byte) b); - - - return this; - } - - public Trace nBytes(final long b) { - if (filled.get(42)) { - throw new IllegalStateException("rlptxrcpt.nBYTES already set"); - } else { - filled.set(42); - } - - if(b >= 32L) { throw new IllegalArgumentException("rlptxrcpt.nBYTES has invalid value (" + b + ")"); } - nBytes.put((byte) b); - - - return this; - } - - public Trace nStep(final long b) { - if (filled.get(43)) { - throw new IllegalStateException("rlptxrcpt.nSTEP already set"); - } else { - filled.set(43); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.nSTEP has invalid value (" + b + ")"); } - nStep.put((byte) (b >> 24)); - nStep.put((byte) (b >> 16)); - nStep.put((byte) (b >> 8)); - nStep.put((byte) b); - - - return this; - } - - public Trace phase1(final Boolean b) { - if (filled.get(32)) { - throw new IllegalStateException("rlptxrcpt.PHASE_1 already set"); - } else { - filled.set(32); - } - - phase1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phase2(final Boolean b) { - if (filled.get(33)) { - throw new IllegalStateException("rlptxrcpt.PHASE_2 already set"); - } else { - filled.set(33); - } - - phase2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phase3(final Boolean b) { - if (filled.get(34)) { - throw new IllegalStateException("rlptxrcpt.PHASE_3 already set"); - } else { - filled.set(34); - } - - phase3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phase4(final Boolean b) { - if (filled.get(35)) { - throw new IllegalStateException("rlptxrcpt.PHASE_4 already set"); - } else { - filled.set(35); - } - - phase4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phase5(final Boolean b) { - if (filled.get(36)) { - throw new IllegalStateException("rlptxrcpt.PHASE_5 already set"); - } else { - filled.set(36); - } - - phase5.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phaseEnd(final Boolean b) { - if (filled.get(37)) { - throw new IllegalStateException("rlptxrcpt.PHASE_END already set"); - } else { - filled.set(37); - } - - phaseEnd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace phaseId(final long b) { - if (filled.get(38)) { - throw new IllegalStateException("rlptxrcpt.PHASE_ID already set"); - } else { - filled.set(38); - } - - if(b >= 65536L) { throw new IllegalArgumentException("rlptxrcpt.PHASE_ID has invalid value (" + b + ")"); } - phaseId.put((byte) (b >> 8)); - phaseId.put((byte) b); - - - return this; - } - - public Trace phaseSize(final long b) { - if (filled.get(39)) { - throw new IllegalStateException("rlptxrcpt.PHASE_SIZE already set"); - } else { - filled.set(39); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.PHASE_SIZE has invalid value (" + b + ")"); } - phaseSize.put((byte) (b >> 24)); - phaseSize.put((byte) (b >> 16)); - phaseSize.put((byte) (b >> 8)); - phaseSize.put((byte) b); - - - return this; - } - - public Trace power(final Bytes b) { - if (filled.get(40)) { - throw new IllegalStateException("rlptxrcpt.POWER already set"); - } else { - filled.set(40); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rlptxrcpt.POWER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { power.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rlptxrcpt.TXRCPT_SIZE has invalid value (" + b + ")"); } - txrcptSize.put((byte) (b >> 24)); - txrcptSize.put((byte) (b >> 16)); - txrcptSize.put((byte) (b >> 8)); - txrcptSize.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("rlptxrcpt.ABS_LOG_NUM has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("rlptxrcpt.ABS_LOG_NUM_MAX has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("rlptxrcpt.ABS_TX_NUM has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("rlptxrcpt.ABS_TX_NUM_MAX has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("rlptxrcpt.ACC_1 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("rlptxrcpt.ACC_2 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("rlptxrcpt.ACC_3 has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("rlptxrcpt.ACC_4 has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("rlptxrcpt.ACC_SIZE has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("rlptxrcpt.BIT has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("rlptxrcpt.BIT_ACC has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("rlptxrcpt.BYTE_1 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("rlptxrcpt.BYTE_2 has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("rlptxrcpt.BYTE_3 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("rlptxrcpt.BYTE_4 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("rlptxrcpt.COUNTER has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("rlptxrcpt.DEPTH_1 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("rlptxrcpt.DONE has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("rlptxrcpt.INDEX has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("rlptxrcpt.INDEX_LOCAL has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("rlptxrcpt.INPUT_1 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("rlptxrcpt.INPUT_2 has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("rlptxrcpt.INPUT_3 has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("rlptxrcpt.INPUT_4 has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("rlptxrcpt.IS_DATA has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("rlptxrcpt.IS_PREFIX has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("rlptxrcpt.IS_TOPIC has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("rlptxrcpt.LC_CORRECTION has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("rlptxrcpt.LIMB has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("rlptxrcpt.LIMB_CONSTRUCTED has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("rlptxrcpt.LOCAL_SIZE has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("rlptxrcpt.LOG_ENTRY_SIZE has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("rlptxrcpt.nBYTES has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("rlptxrcpt.nSTEP has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("rlptxrcpt.PHASE_1 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("rlptxrcpt.PHASE_2 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("rlptxrcpt.PHASE_3 has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("rlptxrcpt.PHASE_4 has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("rlptxrcpt.PHASE_5 has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("rlptxrcpt.PHASE_END has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("rlptxrcpt.PHASE_ID has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("rlptxrcpt.PHASE_SIZE has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("rlptxrcpt.POWER has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("rlptxrcpt.TXRCPT_SIZE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - absLogNum.position(absLogNum.position() + 4); - } - - if (!filled.get(1)) { - absLogNumMax.position(absLogNumMax.position() + 4); - } - - if (!filled.get(2)) { - absTxNum.position(absTxNum.position() + 4); - } - - if (!filled.get(3)) { - absTxNumMax.position(absTxNumMax.position() + 4); - } - - if (!filled.get(4)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(5)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(6)) { - acc3.position(acc3.position() + 16); - } - - if (!filled.get(7)) { - acc4.position(acc4.position() + 16); - } - - if (!filled.get(8)) { - accSize.position(accSize.position() + 1); - } - - if (!filled.get(9)) { - bit.position(bit.position() + 1); - } - - if (!filled.get(10)) { - bitAcc.position(bitAcc.position() + 1); - } - - if (!filled.get(11)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(12)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(13)) { - byte3.position(byte3.position() + 1); - } - - if (!filled.get(14)) { - byte4.position(byte4.position() + 1); - } - - if (!filled.get(15)) { - counter.position(counter.position() + 4); - } - - if (!filled.get(16)) { - depth1.position(depth1.position() + 1); - } - - if (!filled.get(17)) { - done.position(done.position() + 1); - } - - if (!filled.get(18)) { - index.position(index.position() + 3); - } - - if (!filled.get(19)) { - indexLocal.position(indexLocal.position() + 3); - } - - if (!filled.get(20)) { - input1.position(input1.position() + 16); - } - - if (!filled.get(21)) { - input2.position(input2.position() + 16); - } - - if (!filled.get(22)) { - input3.position(input3.position() + 16); - } - - if (!filled.get(23)) { - input4.position(input4.position() + 16); - } - - if (!filled.get(24)) { - isData.position(isData.position() + 1); - } - - if (!filled.get(25)) { - isPrefix.position(isPrefix.position() + 1); - } - - if (!filled.get(26)) { - isTopic.position(isTopic.position() + 1); - } - - if (!filled.get(27)) { - lcCorrection.position(lcCorrection.position() + 1); - } - - if (!filled.get(28)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(29)) { - limbConstructed.position(limbConstructed.position() + 1); - } - - if (!filled.get(30)) { - localSize.position(localSize.position() + 4); - } - - if (!filled.get(31)) { - logEntrySize.position(logEntrySize.position() + 4); - } - - if (!filled.get(42)) { - nBytes.position(nBytes.position() + 1); - } - - if (!filled.get(43)) { - nStep.position(nStep.position() + 4); - } - - if (!filled.get(32)) { - phase1.position(phase1.position() + 1); - } - - if (!filled.get(33)) { - phase2.position(phase2.position() + 1); - } - - if (!filled.get(34)) { - phase3.position(phase3.position() + 1); - } - - if (!filled.get(35)) { - phase4.position(phase4.position() + 1); - } - - if (!filled.get(36)) { - phase5.position(phase5.position() + 1); - } - - if (!filled.get(37)) { - phaseEnd.position(phaseEnd.position() + 1); - } - - if (!filled.get(38)) { - phaseId.position(phaseId.position() + 2); - } - - if (!filled.get(39)) { - phaseSize.position(phaseSize.position() + 4); - } - - if (!filled.get(40)) { - power.position(power.position() + 16); - } - - if (!filled.get(41)) { - txrcptSize.position(txrcptSize.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java deleted file mode 100644 index 6598ebb6d..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/rom/Trace.java +++ /dev/null @@ -1,664 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.rom; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc; - private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer codeFragmentIndexInfty; - private final MappedByteBuffer codeSize; - private final MappedByteBuffer codesizeReached; - private final MappedByteBuffer counter; - private final MappedByteBuffer counterMax; - private final MappedByteBuffer counterPush; - private final MappedByteBuffer index; - private final MappedByteBuffer isJumpdest; - private final MappedByteBuffer isPush; - private final MappedByteBuffer isPushData; - private final MappedByteBuffer limb; - private final MappedByteBuffer nBytes; - private final MappedByteBuffer nBytesAcc; - private final MappedByteBuffer opcode; - private final MappedByteBuffer paddedBytecodeByte; - private final MappedByteBuffer programCounter; - private final MappedByteBuffer pushFunnelBit; - private final MappedByteBuffer pushParameter; - private final MappedByteBuffer pushValueAcc; - private final MappedByteBuffer pushValueHi; - private final MappedByteBuffer pushValueLo; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("rom.ACC", 16, length)); - headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("rom.CODE_FRAGMENT_INDEX_INFTY", 4, length)); - headers.add(new ColumnHeader("rom.CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("rom.CODESIZE_REACHED", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER_MAX", 1, length)); - headers.add(new ColumnHeader("rom.COUNTER_PUSH", 1, length)); - headers.add(new ColumnHeader("rom.INDEX", 4, length)); - headers.add(new ColumnHeader("rom.IS_JUMPDEST", 1, length)); - headers.add(new ColumnHeader("rom.IS_PUSH", 1, length)); - headers.add(new ColumnHeader("rom.IS_PUSH_DATA", 1, length)); - headers.add(new ColumnHeader("rom.LIMB", 16, length)); - headers.add(new ColumnHeader("rom.nBYTES", 1, length)); - headers.add(new ColumnHeader("rom.nBYTES_ACC", 1, length)); - headers.add(new ColumnHeader("rom.OPCODE", 1, length)); - headers.add(new ColumnHeader("rom.PADDED_BYTECODE_BYTE", 1, length)); - headers.add(new ColumnHeader("rom.PROGRAM_COUNTER", 4, length)); - headers.add(new ColumnHeader("rom.PUSH_FUNNEL_BIT", 1, length)); - headers.add(new ColumnHeader("rom.PUSH_PARAMETER", 1, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_ACC", 16, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_HI", 16, length)); - headers.add(new ColumnHeader("rom.PUSH_VALUE_LO", 16, length)); - return headers; - } - - public Trace (List buffers) { - this.acc = buffers.get(0); - this.codeFragmentIndex = buffers.get(1); - this.codeFragmentIndexInfty = buffers.get(2); - this.codeSize = buffers.get(3); - this.codesizeReached = buffers.get(4); - this.counter = buffers.get(5); - this.counterMax = buffers.get(6); - this.counterPush = buffers.get(7); - this.index = buffers.get(8); - this.isJumpdest = buffers.get(9); - this.isPush = buffers.get(10); - this.isPushData = buffers.get(11); - this.limb = buffers.get(12); - this.nBytes = buffers.get(13); - this.nBytesAcc = buffers.get(14); - this.opcode = buffers.get(15); - this.paddedBytecodeByte = buffers.get(16); - this.programCounter = buffers.get(17); - this.pushFunnelBit = buffers.get(18); - this.pushParameter = buffers.get(19); - this.pushValueAcc = buffers.get(20); - this.pushValueHi = buffers.get(21); - this.pushValueLo = buffers.get(22); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("rom.ACC already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.ACC has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rom.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndex.put((byte) (b >> 24)); - codeFragmentIndex.put((byte) (b >> 16)); - codeFragmentIndex.put((byte) (b >> 8)); - codeFragmentIndex.put((byte) b); - - - return this; - } - - public Trace codeFragmentIndexInfty(final long b) { - if (filled.get(3)) { - throw new IllegalStateException("rom.CODE_FRAGMENT_INDEX_INFTY already set"); - } else { - filled.set(3); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rom.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); } - codeFragmentIndexInfty.put((byte) (b >> 24)); - codeFragmentIndexInfty.put((byte) (b >> 16)); - codeFragmentIndexInfty.put((byte) (b >> 8)); - codeFragmentIndexInfty.put((byte) b); - - - return this; - } - - public Trace codeSize(final long b) { - if (filled.get(4)) { - throw new IllegalStateException("rom.CODE_SIZE already set"); - } else { - filled.set(4); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rom.CODE_SIZE has invalid value (" + b + ")"); } - codeSize.put((byte) (b >> 24)); - codeSize.put((byte) (b >> 16)); - codeSize.put((byte) (b >> 8)); - codeSize.put((byte) b); - - - return this; - } - - public Trace codesizeReached(final Boolean b) { - if (filled.get(1)) { - throw new IllegalStateException("rom.CODESIZE_REACHED already set"); - } else { - filled.set(1); - } - - codesizeReached.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace counter(final UnsignedByte b) { - if (filled.get(5)) { - throw new IllegalStateException("rom.COUNTER already set"); - } else { - filled.set(5); - } - - counter.put(b.toByte()); - - return this; - } - - public Trace counterMax(final UnsignedByte b) { - if (filled.get(6)) { - throw new IllegalStateException("rom.COUNTER_MAX already set"); - } else { - filled.set(6); - } - - counterMax.put(b.toByte()); - - return this; - } - - public Trace counterPush(final UnsignedByte b) { - if (filled.get(7)) { - throw new IllegalStateException("rom.COUNTER_PUSH already set"); - } else { - filled.set(7); - } - - counterPush.put(b.toByte()); - - return this; - } - - public Trace index(final long b) { - if (filled.get(8)) { - throw new IllegalStateException("rom.INDEX already set"); - } else { - filled.set(8); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("rom.INDEX has invalid value (" + b + ")"); } - index.put((byte) (b >> 24)); - index.put((byte) (b >> 16)); - index.put((byte) (b >> 8)); - index.put((byte) b); - - - return this; - } - - public Trace isJumpdest(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("rom.IS_JUMPDEST already set"); - } else { - filled.set(9); - } - - isJumpdest.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isPush(final Boolean b) { - if (filled.get(10)) { - throw new IllegalStateException("rom.IS_PUSH already set"); - } else { - filled.set(10); - } - - isPush.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isPushData(final Boolean b) { - if (filled.get(11)) { - throw new IllegalStateException("rom.IS_PUSH_DATA already set"); - } else { - filled.set(11); - } - - isPushData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(12)) { - throw new IllegalStateException("rom.LIMB already set"); - } else { - filled.set(12); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("rom.PROGRAM_COUNTER has invalid value (" + b + ")"); } - programCounter.put((byte) (b >> 24)); - programCounter.put((byte) (b >> 16)); - programCounter.put((byte) (b >> 8)); - programCounter.put((byte) b); - - - return this; - } - - public Trace pushFunnelBit(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("rom.PUSH_FUNNEL_BIT already set"); - } else { - filled.set(16); - } - - pushFunnelBit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace pushParameter(final UnsignedByte b) { - if (filled.get(17)) { - throw new IllegalStateException("rom.PUSH_PARAMETER already set"); - } else { - filled.set(17); - } - - pushParameter.put(b.toByte()); - - return this; - } - - public Trace pushValueAcc(final Bytes b) { - if (filled.get(18)) { - throw new IllegalStateException("rom.PUSH_VALUE_ACC already set"); - } else { - filled.set(18); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_ACC has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { pushValueAcc.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { pushValueHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("rom.PUSH_VALUE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { pushValueLo.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer addressHi; - private final MappedByteBuffer addressLo; - private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer codeFragmentIndexInfty; - private final MappedByteBuffer codeHashHi; - private final MappedByteBuffer codeHashLo; - private final MappedByteBuffer codeSize; - private final MappedByteBuffer commitToState; - private final MappedByteBuffer deploymentNumber; - private final MappedByteBuffer deploymentStatus; - private final MappedByteBuffer readFromState; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("romlex.ADDRESS_HI", 4, length)); - headers.add(new ColumnHeader("romlex.ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("romlex.CODE_FRAGMENT_INDEX_INFTY", 4, length)); - headers.add(new ColumnHeader("romlex.CODE_HASH_HI", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_HASH_LO", 16, length)); - headers.add(new ColumnHeader("romlex.CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("romlex.COMMIT_TO_STATE", 1, length)); - headers.add(new ColumnHeader("romlex.DEPLOYMENT_NUMBER", 2, length)); - headers.add(new ColumnHeader("romlex.DEPLOYMENT_STATUS", 1, length)); - headers.add(new ColumnHeader("romlex.READ_FROM_STATE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.addressHi = buffers.get(0); - this.addressLo = buffers.get(1); - this.codeFragmentIndex = buffers.get(2); - this.codeFragmentIndexInfty = buffers.get(3); - this.codeHashHi = buffers.get(4); - this.codeHashLo = buffers.get(5); - this.codeSize = buffers.get(6); - this.commitToState = buffers.get(7); - this.deploymentNumber = buffers.get(8); - this.deploymentStatus = buffers.get(9); - this.readFromState = buffers.get(10); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace addressHi(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("romlex.ADDRESS_HI already set"); - } else { - filled.set(0); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.ADDRESS_HI has invalid value (" + b + ")"); } - addressHi.put((byte) (b >> 24)); - addressHi.put((byte) (b >> 16)); - addressHi.put((byte) (b >> 8)); - addressHi.put((byte) b); - - - return this; - } - - public Trace addressLo(final Bytes b) { - if (filled.get(1)) { - throw new IllegalStateException("romlex.ADDRESS_LO already set"); - } else { - filled.set(1); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("romlex.ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { addressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndex.put((byte) (b >> 24)); - codeFragmentIndex.put((byte) (b >> 16)); - codeFragmentIndex.put((byte) (b >> 8)); - codeFragmentIndex.put((byte) b); - - - return this; - } - - public Trace codeFragmentIndexInfty(final long b) { - if (filled.get(3)) { - throw new IllegalStateException("romlex.CODE_FRAGMENT_INDEX_INFTY already set"); - } else { - filled.set(3); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_FRAGMENT_INDEX_INFTY has invalid value (" + b + ")"); } - codeFragmentIndexInfty.put((byte) (b >> 24)); - codeFragmentIndexInfty.put((byte) (b >> 16)); - codeFragmentIndexInfty.put((byte) (b >> 8)); - codeFragmentIndexInfty.put((byte) b); - - - return this; - } - - public Trace codeHashHi(final Bytes b) { - if (filled.get(4)) { - throw new IllegalStateException("romlex.CODE_HASH_HI already set"); - } else { - filled.set(4); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("romlex.CODE_HASH_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("romlex.CODE_HASH_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { codeHashLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("romlex.CODE_SIZE has invalid value (" + b + ")"); } - codeSize.put((byte) (b >> 24)); - codeSize.put((byte) (b >> 16)); - codeSize.put((byte) (b >> 8)); - codeSize.put((byte) b); - - - return this; - } - - public Trace commitToState(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("romlex.COMMIT_TO_STATE already set"); - } else { - filled.set(7); - } - - commitToState.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace deploymentNumber(final long b) { - if (filled.get(8)) { - throw new IllegalStateException("romlex.DEPLOYMENT_NUMBER already set"); - } else { - filled.set(8); - } - - if(b >= 65536L) { throw new IllegalArgumentException("romlex.DEPLOYMENT_NUMBER has invalid value (" + b + ")"); } - deploymentNumber.put((byte) (b >> 8)); - deploymentNumber.put((byte) b); - - - return this; - } - - public Trace deploymentStatus(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("romlex.DEPLOYMENT_STATUS already set"); - } else { - filled.set(9); - } - - deploymentStatus.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace readFromState(final Boolean b) { - if (filled.get(10)) { - throw new IllegalStateException("romlex.READ_FROM_STATE already set"); - } else { - filled.set(10); - } - - readFromState.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("romlex.ADDRESS_HI has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("romlex.ADDRESS_LO has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("romlex.CODE_FRAGMENT_INDEX has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("romlex.CODE_FRAGMENT_INDEX_INFTY has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("romlex.CODE_HASH_HI has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("romlex.CODE_HASH_LO has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("romlex.CODE_SIZE has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("romlex.COMMIT_TO_STATE has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("romlex.DEPLOYMENT_NUMBER has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("romlex.DEPLOYMENT_STATUS has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("romlex.READ_FROM_STATE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - addressHi.position(addressHi.position() + 4); - } - - if (!filled.get(1)) { - addressLo.position(addressLo.position() + 16); - } - - if (!filled.get(2)) { - codeFragmentIndex.position(codeFragmentIndex.position() + 4); - } - - if (!filled.get(3)) { - codeFragmentIndexInfty.position(codeFragmentIndexInfty.position() + 4); - } - - if (!filled.get(4)) { - codeHashHi.position(codeHashHi.position() + 16); - } - - if (!filled.get(5)) { - codeHashLo.position(codeHashLo.position() + 16); - } - - if (!filled.get(6)) { - codeSize.position(codeSize.position() + 4); - } - - if (!filled.get(7)) { - commitToState.position(commitToState.position() + 1); - } - - if (!filled.get(8)) { - deploymentNumber.position(deploymentNumber.position() + 2); - } - - if (!filled.get(9)) { - deploymentStatus.position(deploymentStatus.position() + 1); - } - - if (!filled.get(10)) { - readFromState.position(readFromState.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java deleted file mode 100644 index c936843b3..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shakiradata/Trace.java +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.shakiradata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int INDEX_MAX_RESULT = 0x1; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer id; - private final MappedByteBuffer index; - private final MappedByteBuffer indexMax; - private final MappedByteBuffer isKeccakData; - private final MappedByteBuffer isKeccakResult; - private final MappedByteBuffer isRipemdData; - private final MappedByteBuffer isRipemdResult; - private final MappedByteBuffer isSha2Data; - private final MappedByteBuffer isSha2Result; - private final MappedByteBuffer limb; - private final MappedByteBuffer nBytes; - private final MappedByteBuffer nBytesAcc; - private final MappedByteBuffer phase; - private final MappedByteBuffer selectorKeccakResHi; - private final MappedByteBuffer selectorRipemdResHi; - private final MappedByteBuffer selectorSha2ResHi; - private final MappedByteBuffer shakiraStamp; - private final MappedByteBuffer totalSize; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shakiradata.ID", 4, length)); - headers.add(new ColumnHeader("shakiradata.INDEX", 4, length)); - headers.add(new ColumnHeader("shakiradata.INDEX_MAX", 4, length)); - headers.add(new ColumnHeader("shakiradata.IS_KECCAK_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_KECCAK_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_RIPEMD_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_SHA2_DATA", 1, length)); - headers.add(new ColumnHeader("shakiradata.IS_SHA2_RESULT", 1, length)); - headers.add(new ColumnHeader("shakiradata.LIMB", 16, length)); - headers.add(new ColumnHeader("shakiradata.nBYTES", 1, length)); - headers.add(new ColumnHeader("shakiradata.nBYTES_ACC", 4, length)); - headers.add(new ColumnHeader("shakiradata.PHASE", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_KECCAK_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_RIPEMD_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SELECTOR_SHA2_RES_HI", 1, length)); - headers.add(new ColumnHeader("shakiradata.SHAKIRA_STAMP", 4, length)); - headers.add(new ColumnHeader("shakiradata.TOTAL_SIZE", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.id = buffers.get(0); - this.index = buffers.get(1); - this.indexMax = buffers.get(2); - this.isKeccakData = buffers.get(3); - this.isKeccakResult = buffers.get(4); - this.isRipemdData = buffers.get(5); - this.isRipemdResult = buffers.get(6); - this.isSha2Data = buffers.get(7); - this.isSha2Result = buffers.get(8); - this.limb = buffers.get(9); - this.nBytes = buffers.get(10); - this.nBytesAcc = buffers.get(11); - this.phase = buffers.get(12); - this.selectorKeccakResHi = buffers.get(13); - this.selectorRipemdResHi = buffers.get(14); - this.selectorSha2ResHi = buffers.get(15); - this.shakiraStamp = buffers.get(16); - this.totalSize = buffers.get(17); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace id(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("shakiradata.ID already set"); - } else { - filled.set(0); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.ID has invalid value (" + b + ")"); } - id.put((byte) (b >> 24)); - id.put((byte) (b >> 16)); - id.put((byte) (b >> 8)); - id.put((byte) b); - - - return this; - } - - public Trace index(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("shakiradata.INDEX already set"); - } else { - filled.set(1); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.INDEX has invalid value (" + b + ")"); } - index.put((byte) (b >> 24)); - index.put((byte) (b >> 16)); - index.put((byte) (b >> 8)); - index.put((byte) b); - - - return this; - } - - public Trace indexMax(final long b) { - if (filled.get(2)) { - throw new IllegalStateException("shakiradata.INDEX_MAX already set"); - } else { - filled.set(2); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.INDEX_MAX has invalid value (" + b + ")"); } - indexMax.put((byte) (b >> 24)); - indexMax.put((byte) (b >> 16)); - indexMax.put((byte) (b >> 8)); - indexMax.put((byte) b); - - - return this; - } - - public Trace isKeccakData(final Boolean b) { - if (filled.get(3)) { - throw new IllegalStateException("shakiradata.IS_KECCAK_DATA already set"); - } else { - filled.set(3); - } - - isKeccakData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isKeccakResult(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("shakiradata.IS_KECCAK_RESULT already set"); - } else { - filled.set(4); - } - - isKeccakResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isRipemdData(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("shakiradata.IS_RIPEMD_DATA already set"); - } else { - filled.set(5); - } - - isRipemdData.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isRipemdResult(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("shakiradata.IS_RIPEMD_RESULT already set"); - } else { - filled.set(6); - } - - isRipemdResult.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isSha2Data(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("shakiradata.IS_SHA2_DATA already set"); - } else { - filled.set(7); - } - - isSha2Data.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isSha2Result(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("shakiradata.IS_SHA2_RESULT already set"); - } else { - filled.set(8); - } - - isSha2Result.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace limb(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("shakiradata.LIMB already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("shakiradata.LIMB has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { limb.put((byte) 0); } - // Write bytes - for(int j=0; j= 32L) { throw new IllegalArgumentException("shakiradata.nBYTES has invalid value (" + b + ")"); } - nBytes.put((byte) b); - - - return this; - } - - public Trace nBytesAcc(final long b) { - if (filled.get(17)) { - throw new IllegalStateException("shakiradata.nBYTES_ACC already set"); - } else { - filled.set(17); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.nBYTES_ACC has invalid value (" + b + ")"); } - nBytesAcc.put((byte) (b >> 24)); - nBytesAcc.put((byte) (b >> 16)); - nBytesAcc.put((byte) (b >> 8)); - nBytesAcc.put((byte) b); - - - return this; - } - - public Trace phase(final UnsignedByte b) { - if (filled.get(10)) { - throw new IllegalStateException("shakiradata.PHASE already set"); - } else { - filled.set(10); - } - - phase.put(b.toByte()); - - return this; - } - - public Trace selectorKeccakResHi(final Boolean b) { - if (filled.get(11)) { - throw new IllegalStateException("shakiradata.SELECTOR_KECCAK_RES_HI already set"); - } else { - filled.set(11); - } - - selectorKeccakResHi.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace selectorRipemdResHi(final Boolean b) { - if (filled.get(12)) { - throw new IllegalStateException("shakiradata.SELECTOR_RIPEMD_RES_HI already set"); - } else { - filled.set(12); - } - - selectorRipemdResHi.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace selectorSha2ResHi(final Boolean b) { - if (filled.get(13)) { - throw new IllegalStateException("shakiradata.SELECTOR_SHA2_RES_HI already set"); - } else { - filled.set(13); - } - - selectorSha2ResHi.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace shakiraStamp(final long b) { - if (filled.get(14)) { - throw new IllegalStateException("shakiradata.SHAKIRA_STAMP already set"); - } else { - filled.set(14); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.SHAKIRA_STAMP has invalid value (" + b + ")"); } - shakiraStamp.put((byte) (b >> 24)); - shakiraStamp.put((byte) (b >> 16)); - shakiraStamp.put((byte) (b >> 8)); - shakiraStamp.put((byte) b); - - - return this; - } - - public Trace totalSize(final long b) { - if (filled.get(15)) { - throw new IllegalStateException("shakiradata.TOTAL_SIZE already set"); - } else { - filled.set(15); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("shakiradata.TOTAL_SIZE has invalid value (" + b + ")"); } - totalSize.put((byte) (b >> 24)); - totalSize.put((byte) (b >> 16)); - totalSize.put((byte) (b >> 8)); - totalSize.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("shakiradata.ID has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("shakiradata.INDEX has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("shakiradata.INDEX_MAX has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("shakiradata.IS_KECCAK_DATA has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("shakiradata.IS_KECCAK_RESULT has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("shakiradata.IS_RIPEMD_DATA has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("shakiradata.IS_RIPEMD_RESULT has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("shakiradata.IS_SHA2_DATA has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("shakiradata.IS_SHA2_RESULT has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("shakiradata.LIMB has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("shakiradata.nBYTES has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("shakiradata.nBYTES_ACC has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("shakiradata.PHASE has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("shakiradata.SELECTOR_KECCAK_RES_HI has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("shakiradata.SELECTOR_RIPEMD_RES_HI has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("shakiradata.SELECTOR_SHA2_RES_HI has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("shakiradata.SHAKIRA_STAMP has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("shakiradata.TOTAL_SIZE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - id.position(id.position() + 4); - } - - if (!filled.get(1)) { - index.position(index.position() + 4); - } - - if (!filled.get(2)) { - indexMax.position(indexMax.position() + 4); - } - - if (!filled.get(3)) { - isKeccakData.position(isKeccakData.position() + 1); - } - - if (!filled.get(4)) { - isKeccakResult.position(isKeccakResult.position() + 1); - } - - if (!filled.get(5)) { - isRipemdData.position(isRipemdData.position() + 1); - } - - if (!filled.get(6)) { - isRipemdResult.position(isRipemdResult.position() + 1); - } - - if (!filled.get(7)) { - isSha2Data.position(isSha2Data.position() + 1); - } - - if (!filled.get(8)) { - isSha2Result.position(isSha2Result.position() + 1); - } - - if (!filled.get(9)) { - limb.position(limb.position() + 16); - } - - if (!filled.get(16)) { - nBytes.position(nBytes.position() + 1); - } - - if (!filled.get(17)) { - nBytesAcc.position(nBytesAcc.position() + 4); - } - - if (!filled.get(10)) { - phase.position(phase.position() + 1); - } - - if (!filled.get(11)) { - selectorKeccakResHi.position(selectorKeccakResHi.position() + 1); - } - - if (!filled.get(12)) { - selectorRipemdResHi.position(selectorRipemdResHi.position() + 1); - } - - if (!filled.get(13)) { - selectorSha2ResHi.position(selectorSha2ResHi.position() + 1); - } - - if (!filled.get(14)) { - shakiraStamp.position(shakiraStamp.position() + 4); - } - - if (!filled.get(15)) { - totalSize.position(totalSize.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java deleted file mode 100644 index edc03b9ea..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/shf/Trace.java +++ /dev/null @@ -1,1341 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.shf; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer acc5; - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Hi; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bit2; - private final MappedByteBuffer bit3; - private final MappedByteBuffer bit4; - private final MappedByteBuffer bitB3; - private final MappedByteBuffer bitB4; - private final MappedByteBuffer bitB5; - private final MappedByteBuffer bitB6; - private final MappedByteBuffer bitB7; - private final MappedByteBuffer bits; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer byte3; - private final MappedByteBuffer byte4; - private final MappedByteBuffer byte5; - private final MappedByteBuffer counter; - private final MappedByteBuffer inst; - private final MappedByteBuffer iomf; - private final MappedByteBuffer known; - private final MappedByteBuffer leftAlignedSuffixHigh; - private final MappedByteBuffer leftAlignedSuffixLow; - private final MappedByteBuffer low3; - private final MappedByteBuffer microShiftParameter; - private final MappedByteBuffer neg; - private final MappedByteBuffer oneLineInstruction; - private final MappedByteBuffer ones; - private final MappedByteBuffer resHi; - private final MappedByteBuffer resLo; - private final MappedByteBuffer rightAlignedPrefixHigh; - private final MappedByteBuffer rightAlignedPrefixLow; - private final MappedByteBuffer shb3Hi; - private final MappedByteBuffer shb3Lo; - private final MappedByteBuffer shb4Hi; - private final MappedByteBuffer shb4Lo; - private final MappedByteBuffer shb5Hi; - private final MappedByteBuffer shb5Lo; - private final MappedByteBuffer shb6Hi; - private final MappedByteBuffer shb6Lo; - private final MappedByteBuffer shb7Hi; - private final MappedByteBuffer shb7Lo; - private final MappedByteBuffer shiftDirection; - private final MappedByteBuffer shiftStamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shf.ACC_1", 16, length)); - headers.add(new ColumnHeader("shf.ACC_2", 16, length)); - headers.add(new ColumnHeader("shf.ACC_3", 16, length)); - headers.add(new ColumnHeader("shf.ACC_4", 16, length)); - headers.add(new ColumnHeader("shf.ACC_5", 16, length)); - headers.add(new ColumnHeader("shf.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("shf.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("shf.ARG_2_HI", 16, length)); - headers.add(new ColumnHeader("shf.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("shf.BIT_1", 1, length)); - headers.add(new ColumnHeader("shf.BIT_2", 1, length)); - headers.add(new ColumnHeader("shf.BIT_3", 1, length)); - headers.add(new ColumnHeader("shf.BIT_4", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_3", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_4", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_5", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_6", 1, length)); - headers.add(new ColumnHeader("shf.BIT_B_7", 1, length)); - headers.add(new ColumnHeader("shf.BITS", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_1", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_2", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_3", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_4", 1, length)); - headers.add(new ColumnHeader("shf.BYTE_5", 1, length)); - headers.add(new ColumnHeader("shf.COUNTER", 1, length)); - headers.add(new ColumnHeader("shf.INST", 1, length)); - headers.add(new ColumnHeader("shf.IOMF", 1, length)); - headers.add(new ColumnHeader("shf.KNOWN", 1, length)); - headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_HIGH", 1, length)); - headers.add(new ColumnHeader("shf.LEFT_ALIGNED_SUFFIX_LOW", 1, length)); - headers.add(new ColumnHeader("shf.LOW_3", 16, length)); - headers.add(new ColumnHeader("shf.MICRO_SHIFT_PARAMETER", 1, length)); - headers.add(new ColumnHeader("shf.NEG", 1, length)); - headers.add(new ColumnHeader("shf.ONE_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("shf.ONES", 1, length)); - headers.add(new ColumnHeader("shf.RES_HI", 16, length)); - headers.add(new ColumnHeader("shf.RES_LO", 16, length)); - headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_HIGH", 1, length)); - headers.add(new ColumnHeader("shf.RIGHT_ALIGNED_PREFIX_LOW", 1, length)); - headers.add(new ColumnHeader("shf.SHB_3_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_3_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_4_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_4_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_5_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_5_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_6_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_6_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHB_7_HI", 1, length)); - headers.add(new ColumnHeader("shf.SHB_7_LO", 1, length)); - headers.add(new ColumnHeader("shf.SHIFT_DIRECTION", 1, length)); - headers.add(new ColumnHeader("shf.SHIFT_STAMP", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.acc3 = buffers.get(2); - this.acc4 = buffers.get(3); - this.acc5 = buffers.get(4); - this.arg1Hi = buffers.get(5); - this.arg1Lo = buffers.get(6); - this.arg2Hi = buffers.get(7); - this.arg2Lo = buffers.get(8); - this.bit1 = buffers.get(9); - this.bit2 = buffers.get(10); - this.bit3 = buffers.get(11); - this.bit4 = buffers.get(12); - this.bitB3 = buffers.get(13); - this.bitB4 = buffers.get(14); - this.bitB5 = buffers.get(15); - this.bitB6 = buffers.get(16); - this.bitB7 = buffers.get(17); - this.bits = buffers.get(18); - this.byte1 = buffers.get(19); - this.byte2 = buffers.get(20); - this.byte3 = buffers.get(21); - this.byte4 = buffers.get(22); - this.byte5 = buffers.get(23); - this.counter = buffers.get(24); - this.inst = buffers.get(25); - this.iomf = buffers.get(26); - this.known = buffers.get(27); - this.leftAlignedSuffixHigh = buffers.get(28); - this.leftAlignedSuffixLow = buffers.get(29); - this.low3 = buffers.get(30); - this.microShiftParameter = buffers.get(31); - this.neg = buffers.get(32); - this.oneLineInstruction = buffers.get(33); - this.ones = buffers.get(34); - this.resHi = buffers.get(35); - this.resLo = buffers.get(36); - this.rightAlignedPrefixHigh = buffers.get(37); - this.rightAlignedPrefixLow = buffers.get(38); - this.shb3Hi = buffers.get(39); - this.shb3Lo = buffers.get(40); - this.shb4Hi = buffers.get(41); - this.shb4Lo = buffers.get(42); - this.shb5Hi = buffers.get(43); - this.shb5Lo = buffers.get(44); - this.shb6Hi = buffers.get(45); - this.shb6Lo = buffers.get(46); - this.shb7Hi = buffers.get(47); - this.shb7Lo = buffers.get(48); - this.shiftDirection = buffers.get(49); - this.shiftStamp = buffers.get(50); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("shf.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ARG_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("shf.COUNTER has invalid value (" + b + ")"); } - counter.put((byte) b); - - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(25)) { - throw new IllegalStateException("shf.INST already set"); - } else { - filled.set(25); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace iomf(final Boolean b) { - if (filled.get(26)) { - throw new IllegalStateException("shf.IOMF already set"); - } else { - filled.set(26); - } - - iomf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace known(final Boolean b) { - if (filled.get(27)) { - throw new IllegalStateException("shf.KNOWN already set"); - } else { - filled.set(27); - } - - known.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace leftAlignedSuffixHigh(final UnsignedByte b) { - if (filled.get(28)) { - throw new IllegalStateException("shf.LEFT_ALIGNED_SUFFIX_HIGH already set"); - } else { - filled.set(28); - } - - leftAlignedSuffixHigh.put(b.toByte()); - - return this; - } - - public Trace leftAlignedSuffixLow(final UnsignedByte b) { - if (filled.get(29)) { - throw new IllegalStateException("shf.LEFT_ALIGNED_SUFFIX_LOW already set"); - } else { - filled.set(29); - } - - leftAlignedSuffixLow.put(b.toByte()); - - return this; - } - - public Trace low3(final Bytes b) { - if (filled.get(30)) { - throw new IllegalStateException("shf.LOW_3 already set"); - } else { - filled.set(30); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.LOW_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { low3.put((byte) 0); } - // Write bytes - for(int j=0; j= 256L) { throw new IllegalArgumentException("shf.MICRO_SHIFT_PARAMETER has invalid value (" + b + ")"); } - microShiftParameter.put((byte) b); - - - return this; - } - - public Trace neg(final Boolean b) { - if (filled.get(32)) { - throw new IllegalStateException("shf.NEG already set"); - } else { - filled.set(32); - } - - neg.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace oneLineInstruction(final Boolean b) { - if (filled.get(34)) { - throw new IllegalStateException("shf.ONE_LINE_INSTRUCTION already set"); - } else { - filled.set(34); - } - - oneLineInstruction.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace ones(final UnsignedByte b) { - if (filled.get(33)) { - throw new IllegalStateException("shf.ONES already set"); - } else { - filled.set(33); - } - - ones.put(b.toByte()); - - return this; - } - - public Trace resHi(final Bytes b) { - if (filled.get(35)) { - throw new IllegalStateException("shf.RES_HI already set"); - } else { - filled.set(35); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("shf.RES_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("shf.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("shf.SHIFT_STAMP has invalid value (" + b + ")"); } - shiftStamp.put((byte) (b >> 24)); - shiftStamp.put((byte) (b >> 16)); - shiftStamp.put((byte) (b >> 8)); - shiftStamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("shf.ACC_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("shf.ACC_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("shf.ACC_3 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("shf.ACC_4 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("shf.ACC_5 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("shf.ARG_1_HI has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("shf.ARG_1_LO has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("shf.ARG_2_HI has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("shf.ARG_2_LO has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("shf.BIT_1 has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("shf.BIT_2 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("shf.BIT_3 has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("shf.BIT_4 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("shf.BIT_B_3 has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("shf.BIT_B_4 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("shf.BIT_B_5 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("shf.BIT_B_6 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("shf.BIT_B_7 has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("shf.BITS has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("shf.BYTE_1 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("shf.BYTE_2 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("shf.BYTE_3 has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("shf.BYTE_4 has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("shf.BYTE_5 has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("shf.COUNTER has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("shf.INST has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("shf.IOMF has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("shf.KNOWN has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("shf.LEFT_ALIGNED_SUFFIX_HIGH has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("shf.LEFT_ALIGNED_SUFFIX_LOW has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("shf.LOW_3 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("shf.MICRO_SHIFT_PARAMETER has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("shf.NEG has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("shf.ONE_LINE_INSTRUCTION has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("shf.ONES has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("shf.RES_HI has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("shf.RES_LO has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("shf.RIGHT_ALIGNED_PREFIX_HIGH has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("shf.RIGHT_ALIGNED_PREFIX_LOW has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("shf.SHB_3_HI has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("shf.SHB_3_LO has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("shf.SHB_4_HI has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("shf.SHB_4_LO has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("shf.SHB_5_HI has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("shf.SHB_5_LO has not been filled"); - } - - if (!filled.get(45)) { - throw new IllegalStateException("shf.SHB_6_HI has not been filled"); - } - - if (!filled.get(46)) { - throw new IllegalStateException("shf.SHB_6_LO has not been filled"); - } - - if (!filled.get(47)) { - throw new IllegalStateException("shf.SHB_7_HI has not been filled"); - } - - if (!filled.get(48)) { - throw new IllegalStateException("shf.SHB_7_LO has not been filled"); - } - - if (!filled.get(49)) { - throw new IllegalStateException("shf.SHIFT_DIRECTION has not been filled"); - } - - if (!filled.get(50)) { - throw new IllegalStateException("shf.SHIFT_STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(1)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(2)) { - acc3.position(acc3.position() + 16); - } - - if (!filled.get(3)) { - acc4.position(acc4.position() + 16); - } - - if (!filled.get(4)) { - acc5.position(acc5.position() + 16); - } - - if (!filled.get(5)) { - arg1Hi.position(arg1Hi.position() + 16); - } - - if (!filled.get(6)) { - arg1Lo.position(arg1Lo.position() + 16); - } - - if (!filled.get(7)) { - arg2Hi.position(arg2Hi.position() + 16); - } - - if (!filled.get(8)) { - arg2Lo.position(arg2Lo.position() + 16); - } - - if (!filled.get(10)) { - bit1.position(bit1.position() + 1); - } - - if (!filled.get(11)) { - bit2.position(bit2.position() + 1); - } - - if (!filled.get(12)) { - bit3.position(bit3.position() + 1); - } - - if (!filled.get(13)) { - bit4.position(bit4.position() + 1); - } - - if (!filled.get(14)) { - bitB3.position(bitB3.position() + 1); - } - - if (!filled.get(15)) { - bitB4.position(bitB4.position() + 1); - } - - if (!filled.get(16)) { - bitB5.position(bitB5.position() + 1); - } - - if (!filled.get(17)) { - bitB6.position(bitB6.position() + 1); - } - - if (!filled.get(18)) { - bitB7.position(bitB7.position() + 1); - } - - if (!filled.get(9)) { - bits.position(bits.position() + 1); - } - - if (!filled.get(19)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(20)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(21)) { - byte3.position(byte3.position() + 1); - } - - if (!filled.get(22)) { - byte4.position(byte4.position() + 1); - } - - if (!filled.get(23)) { - byte5.position(byte5.position() + 1); - } - - if (!filled.get(24)) { - counter.position(counter.position() + 1); - } - - if (!filled.get(25)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(26)) { - iomf.position(iomf.position() + 1); - } - - if (!filled.get(27)) { - known.position(known.position() + 1); - } - - if (!filled.get(28)) { - leftAlignedSuffixHigh.position(leftAlignedSuffixHigh.position() + 1); - } - - if (!filled.get(29)) { - leftAlignedSuffixLow.position(leftAlignedSuffixLow.position() + 1); - } - - if (!filled.get(30)) { - low3.position(low3.position() + 16); - } - - if (!filled.get(31)) { - microShiftParameter.position(microShiftParameter.position() + 1); - } - - if (!filled.get(32)) { - neg.position(neg.position() + 1); - } - - if (!filled.get(34)) { - oneLineInstruction.position(oneLineInstruction.position() + 1); - } - - if (!filled.get(33)) { - ones.position(ones.position() + 1); - } - - if (!filled.get(35)) { - resHi.position(resHi.position() + 16); - } - - if (!filled.get(36)) { - resLo.position(resLo.position() + 16); - } - - if (!filled.get(37)) { - rightAlignedPrefixHigh.position(rightAlignedPrefixHigh.position() + 1); - } - - if (!filled.get(38)) { - rightAlignedPrefixLow.position(rightAlignedPrefixLow.position() + 1); - } - - if (!filled.get(39)) { - shb3Hi.position(shb3Hi.position() + 1); - } - - if (!filled.get(40)) { - shb3Lo.position(shb3Lo.position() + 1); - } - - if (!filled.get(41)) { - shb4Hi.position(shb4Hi.position() + 1); - } - - if (!filled.get(42)) { - shb4Lo.position(shb4Lo.position() + 1); - } - - if (!filled.get(43)) { - shb5Hi.position(shb5Hi.position() + 1); - } - - if (!filled.get(44)) { - shb5Lo.position(shb5Lo.position() + 1); - } - - if (!filled.get(45)) { - shb6Hi.position(shb6Hi.position() + 1); - } - - if (!filled.get(46)) { - shb6Lo.position(shb6Lo.position() + 1); - } - - if (!filled.get(47)) { - shb7Hi.position(shb7Hi.position() + 1); - } - - if (!filled.get(48)) { - shb7Lo.position(shb7Lo.position() + 1); - } - - if (!filled.get(49)) { - shiftDirection.position(shiftDirection.position() + 1); - } - - if (!filled.get(50)) { - shiftStamp.position(shiftStamp.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java deleted file mode 100644 index 7cb674d7f..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/stp/Trace.java +++ /dev/null @@ -1,837 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.stp; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer arg1Hi; - private final MappedByteBuffer arg1Lo; - private final MappedByteBuffer arg2Lo; - private final MappedByteBuffer ct; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer exists; - private final MappedByteBuffer exogenousModuleInstruction; - private final MappedByteBuffer gasActual; - private final MappedByteBuffer gasHi; - private final MappedByteBuffer gasLo; - private final MappedByteBuffer gasMxp; - private final MappedByteBuffer gasOutOfPocket; - private final MappedByteBuffer gasStipend; - private final MappedByteBuffer gasUpfront; - private final MappedByteBuffer instruction; - private final MappedByteBuffer isCall; - private final MappedByteBuffer isCallcode; - private final MappedByteBuffer isCreate; - private final MappedByteBuffer isCreate2; - private final MappedByteBuffer isDelegatecall; - private final MappedByteBuffer isStaticcall; - private final MappedByteBuffer modFlag; - private final MappedByteBuffer outOfGasException; - private final MappedByteBuffer resLo; - private final MappedByteBuffer stamp; - private final MappedByteBuffer valHi; - private final MappedByteBuffer valLo; - private final MappedByteBuffer warm; - private final MappedByteBuffer wcpFlag; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("stp.ARG_1_HI", 16, length)); - headers.add(new ColumnHeader("stp.ARG_1_LO", 16, length)); - headers.add(new ColumnHeader("stp.ARG_2_LO", 16, length)); - headers.add(new ColumnHeader("stp.CT", 1, length)); - headers.add(new ColumnHeader("stp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("stp.EXISTS", 1, length)); - headers.add(new ColumnHeader("stp.EXOGENOUS_MODULE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("stp.GAS_ACTUAL", 8, length)); - headers.add(new ColumnHeader("stp.GAS_HI", 16, length)); - headers.add(new ColumnHeader("stp.GAS_LO", 16, length)); - headers.add(new ColumnHeader("stp.GAS_MXP", 8, length)); - headers.add(new ColumnHeader("stp.GAS_OUT_OF_POCKET", 8, length)); - headers.add(new ColumnHeader("stp.GAS_STIPEND", 8, length)); - headers.add(new ColumnHeader("stp.GAS_UPFRONT", 8, length)); - headers.add(new ColumnHeader("stp.INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("stp.IS_CALL", 1, length)); - headers.add(new ColumnHeader("stp.IS_CALLCODE", 1, length)); - headers.add(new ColumnHeader("stp.IS_CREATE", 1, length)); - headers.add(new ColumnHeader("stp.IS_CREATE2", 1, length)); - headers.add(new ColumnHeader("stp.IS_DELEGATECALL", 1, length)); - headers.add(new ColumnHeader("stp.IS_STATICCALL", 1, length)); - headers.add(new ColumnHeader("stp.MOD_FLAG", 1, length)); - headers.add(new ColumnHeader("stp.OUT_OF_GAS_EXCEPTION", 1, length)); - headers.add(new ColumnHeader("stp.RES_LO", 16, length)); - headers.add(new ColumnHeader("stp.STAMP", 3, length)); - headers.add(new ColumnHeader("stp.VAL_HI", 16, length)); - headers.add(new ColumnHeader("stp.VAL_LO", 16, length)); - headers.add(new ColumnHeader("stp.WARM", 1, length)); - headers.add(new ColumnHeader("stp.WCP_FLAG", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.arg1Hi = buffers.get(0); - this.arg1Lo = buffers.get(1); - this.arg2Lo = buffers.get(2); - this.ct = buffers.get(3); - this.ctMax = buffers.get(4); - this.exists = buffers.get(5); - this.exogenousModuleInstruction = buffers.get(6); - this.gasActual = buffers.get(7); - this.gasHi = buffers.get(8); - this.gasLo = buffers.get(9); - this.gasMxp = buffers.get(10); - this.gasOutOfPocket = buffers.get(11); - this.gasStipend = buffers.get(12); - this.gasUpfront = buffers.get(13); - this.instruction = buffers.get(14); - this.isCall = buffers.get(15); - this.isCallcode = buffers.get(16); - this.isCreate = buffers.get(17); - this.isCreate2 = buffers.get(18); - this.isDelegatecall = buffers.get(19); - this.isStaticcall = buffers.get(20); - this.modFlag = buffers.get(21); - this.outOfGasException = buffers.get(22); - this.resLo = buffers.get(23); - this.stamp = buffers.get(24); - this.valHi = buffers.get(25); - this.valLo = buffers.get(26); - this.warm = buffers.get(27); - this.wcpFlag = buffers.get(28); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace arg1Hi(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("stp.ARG_1_HI already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.ARG_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.ARG_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.ARG_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { arg2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("stp.GAS_ACTUAL has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasActual.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.GAS_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { gasHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.GAS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { gasLo.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("stp.GAS_MXP has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasMxp.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("stp.GAS_OUT_OF_POCKET has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasOutOfPocket.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("stp.GAS_STIPEND has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasStipend.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("stp.GAS_UPFRONT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasUpfront.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.RES_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { resLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 16777216L) { throw new IllegalArgumentException("stp.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace valHi(final Bytes b) { - if (filled.get(25)) { - throw new IllegalStateException("stp.VAL_HI already set"); - } else { - filled.set(25); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("stp.VAL_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("stp.VAL_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { valLo.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer inputByte1; - private final MappedByteBuffer inputByte2; - private final MappedByteBuffer inst; - private final MappedByteBuffer resultByte; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("binreftable.INPUT_BYTE_1", 1, length)); - headers.add(new ColumnHeader("binreftable.INPUT_BYTE_2", 1, length)); - headers.add(new ColumnHeader("binreftable.INST", 1, length)); - headers.add(new ColumnHeader("binreftable.RESULT_BYTE", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.inputByte1 = buffers.get(0); - this.inputByte2 = buffers.get(1); - this.inst = buffers.get(2); - this.resultByte = buffers.get(3); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace inputByte1(final UnsignedByte b) { - if (filled.get(0)) { - throw new IllegalStateException("binreftable.INPUT_BYTE_1 already set"); - } else { - filled.set(0); - } - - inputByte1.put(b.toByte()); - - return this; - } - - public Trace inputByte2(final UnsignedByte b) { - if (filled.get(1)) { - throw new IllegalStateException("binreftable.INPUT_BYTE_2 already set"); - } else { - filled.set(1); - } - - inputByte2.put(b.toByte()); - - return this; - } - - public Trace inst(final UnsignedByte b) { - if (filled.get(2)) { - throw new IllegalStateException("binreftable.INST already set"); - } else { - filled.set(2); - } - - inst.put(b.toByte()); - - return this; - } - - public Trace resultByte(final UnsignedByte b) { - if (filled.get(3)) { - throw new IllegalStateException("binreftable.RESULT_BYTE already set"); - } else { - filled.set(3); - } - - resultByte.put(b.toByte()); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("binreftable.INPUT_BYTE_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("binreftable.INPUT_BYTE_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("binreftable.INST has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("binreftable.RESULT_BYTE has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - inputByte1.position(inputByte1.position() + 1); - } - - if (!filled.get(1)) { - inputByte2.position(inputByte2.position() + 1); - } - - if (!filled.get(2)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(3)) { - resultByte.position(resultByte.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java deleted file mode 100644 index 2bb6d5214..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/Trace.java +++ /dev/null @@ -1,1122 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.tables.instructionDecoder; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer alpha; - private final MappedByteBuffer billingPerByte; - private final MappedByteBuffer billingPerWord; - private final MappedByteBuffer delta; - private final MappedByteBuffer familyAccount; - private final MappedByteBuffer familyAdd; - private final MappedByteBuffer familyBatch; - private final MappedByteBuffer familyBin; - private final MappedByteBuffer familyCall; - private final MappedByteBuffer familyContext; - private final MappedByteBuffer familyCopy; - private final MappedByteBuffer familyCreate; - private final MappedByteBuffer familyDup; - private final MappedByteBuffer familyExt; - private final MappedByteBuffer familyHalt; - private final MappedByteBuffer familyInvalid; - private final MappedByteBuffer familyJump; - private final MappedByteBuffer familyKec; - private final MappedByteBuffer familyLog; - private final MappedByteBuffer familyMachineState; - private final MappedByteBuffer familyMod; - private final MappedByteBuffer familyMul; - private final MappedByteBuffer familyPushPop; - private final MappedByteBuffer familyShf; - private final MappedByteBuffer familyStackRam; - private final MappedByteBuffer familyStorage; - private final MappedByteBuffer familySwap; - private final MappedByteBuffer familyTransaction; - private final MappedByteBuffer familyWcp; - private final MappedByteBuffer flag1; - private final MappedByteBuffer flag2; - private final MappedByteBuffer flag3; - private final MappedByteBuffer flag4; - private final MappedByteBuffer isJumpdest; - private final MappedByteBuffer isPush; - private final MappedByteBuffer mxpFlag; - private final MappedByteBuffer mxpType1; - private final MappedByteBuffer mxpType2; - private final MappedByteBuffer mxpType3; - private final MappedByteBuffer mxpType4; - private final MappedByteBuffer mxpType5; - private final MappedByteBuffer opcode; - private final MappedByteBuffer staticFlag; - private final MappedByteBuffer staticGas; - private final MappedByteBuffer twoLineInstruction; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("instdecoder.ALPHA", 1, length)); - headers.add(new ColumnHeader("instdecoder.BILLING_PER_BYTE", 1, length)); - headers.add(new ColumnHeader("instdecoder.BILLING_PER_WORD", 1, length)); - headers.add(new ColumnHeader("instdecoder.DELTA", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_ACCOUNT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_ADD", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_BATCH", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_BIN", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CALL", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CONTEXT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_COPY", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_CREATE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_DUP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_EXT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_HALT", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_INVALID", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_JUMP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_KEC", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_LOG", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MACHINE_STATE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MOD", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_MUL", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_PUSH_POP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_SHF", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_STACK_RAM", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_STORAGE", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_SWAP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_TRANSACTION", 1, length)); - headers.add(new ColumnHeader("instdecoder.FAMILY_WCP", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_1", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_2", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_3", 1, length)); - headers.add(new ColumnHeader("instdecoder.FLAG_4", 1, length)); - headers.add(new ColumnHeader("instdecoder.IS_JUMPDEST", 1, length)); - headers.add(new ColumnHeader("instdecoder.IS_PUSH", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_FLAG", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_1", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_2", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_3", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_4", 1, length)); - headers.add(new ColumnHeader("instdecoder.MXP_TYPE_5", 1, length)); - headers.add(new ColumnHeader("instdecoder.OPCODE", 32, length)); - headers.add(new ColumnHeader("instdecoder.STATIC_FLAG", 1, length)); - headers.add(new ColumnHeader("instdecoder.STATIC_GAS", 4, length)); - headers.add(new ColumnHeader("instdecoder.TWO_LINE_INSTRUCTION", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.alpha = buffers.get(0); - this.billingPerByte = buffers.get(1); - this.billingPerWord = buffers.get(2); - this.delta = buffers.get(3); - this.familyAccount = buffers.get(4); - this.familyAdd = buffers.get(5); - this.familyBatch = buffers.get(6); - this.familyBin = buffers.get(7); - this.familyCall = buffers.get(8); - this.familyContext = buffers.get(9); - this.familyCopy = buffers.get(10); - this.familyCreate = buffers.get(11); - this.familyDup = buffers.get(12); - this.familyExt = buffers.get(13); - this.familyHalt = buffers.get(14); - this.familyInvalid = buffers.get(15); - this.familyJump = buffers.get(16); - this.familyKec = buffers.get(17); - this.familyLog = buffers.get(18); - this.familyMachineState = buffers.get(19); - this.familyMod = buffers.get(20); - this.familyMul = buffers.get(21); - this.familyPushPop = buffers.get(22); - this.familyShf = buffers.get(23); - this.familyStackRam = buffers.get(24); - this.familyStorage = buffers.get(25); - this.familySwap = buffers.get(26); - this.familyTransaction = buffers.get(27); - this.familyWcp = buffers.get(28); - this.flag1 = buffers.get(29); - this.flag2 = buffers.get(30); - this.flag3 = buffers.get(31); - this.flag4 = buffers.get(32); - this.isJumpdest = buffers.get(33); - this.isPush = buffers.get(34); - this.mxpFlag = buffers.get(35); - this.mxpType1 = buffers.get(36); - this.mxpType2 = buffers.get(37); - this.mxpType3 = buffers.get(38); - this.mxpType4 = buffers.get(39); - this.mxpType5 = buffers.get(40); - this.opcode = buffers.get(41); - this.staticFlag = buffers.get(42); - this.staticGas = buffers.get(43); - this.twoLineInstruction = buffers.get(44); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace alpha(final UnsignedByte b) { - if (filled.get(0)) { - throw new IllegalStateException("instdecoder.ALPHA already set"); - } else { - filled.set(0); - } - - alpha.put(b.toByte()); - - return this; - } - - public Trace billingPerByte(final UnsignedByte b) { - if (filled.get(1)) { - throw new IllegalStateException("instdecoder.BILLING_PER_BYTE already set"); - } else { - filled.set(1); - } - - billingPerByte.put(b.toByte()); - - return this; - } - - public Trace billingPerWord(final UnsignedByte b) { - if (filled.get(2)) { - throw new IllegalStateException("instdecoder.BILLING_PER_WORD already set"); - } else { - filled.set(2); - } - - billingPerWord.put(b.toByte()); - - return this; - } - - public Trace delta(final UnsignedByte b) { - if (filled.get(3)) { - throw new IllegalStateException("instdecoder.DELTA already set"); - } else { - filled.set(3); - } - - delta.put(b.toByte()); - - return this; - } - - public Trace familyAccount(final Boolean b) { - if (filled.get(4)) { - throw new IllegalStateException("instdecoder.FAMILY_ACCOUNT already set"); - } else { - filled.set(4); - } - - familyAccount.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyAdd(final Boolean b) { - if (filled.get(5)) { - throw new IllegalStateException("instdecoder.FAMILY_ADD already set"); - } else { - filled.set(5); - } - - familyAdd.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyBatch(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("instdecoder.FAMILY_BATCH already set"); - } else { - filled.set(6); - } - - familyBatch.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyBin(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("instdecoder.FAMILY_BIN already set"); - } else { - filled.set(7); - } - - familyBin.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyCall(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("instdecoder.FAMILY_CALL already set"); - } else { - filled.set(8); - } - - familyCall.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyContext(final Boolean b) { - if (filled.get(9)) { - throw new IllegalStateException("instdecoder.FAMILY_CONTEXT already set"); - } else { - filled.set(9); - } - - familyContext.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyCopy(final Boolean b) { - if (filled.get(10)) { - throw new IllegalStateException("instdecoder.FAMILY_COPY already set"); - } else { - filled.set(10); - } - - familyCopy.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyCreate(final Boolean b) { - if (filled.get(11)) { - throw new IllegalStateException("instdecoder.FAMILY_CREATE already set"); - } else { - filled.set(11); - } - - familyCreate.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyDup(final Boolean b) { - if (filled.get(12)) { - throw new IllegalStateException("instdecoder.FAMILY_DUP already set"); - } else { - filled.set(12); - } - - familyDup.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyExt(final Boolean b) { - if (filled.get(13)) { - throw new IllegalStateException("instdecoder.FAMILY_EXT already set"); - } else { - filled.set(13); - } - - familyExt.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyHalt(final Boolean b) { - if (filled.get(14)) { - throw new IllegalStateException("instdecoder.FAMILY_HALT already set"); - } else { - filled.set(14); - } - - familyHalt.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyInvalid(final Boolean b) { - if (filled.get(15)) { - throw new IllegalStateException("instdecoder.FAMILY_INVALID already set"); - } else { - filled.set(15); - } - - familyInvalid.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyJump(final Boolean b) { - if (filled.get(16)) { - throw new IllegalStateException("instdecoder.FAMILY_JUMP already set"); - } else { - filled.set(16); - } - - familyJump.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyKec(final Boolean b) { - if (filled.get(17)) { - throw new IllegalStateException("instdecoder.FAMILY_KEC already set"); - } else { - filled.set(17); - } - - familyKec.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyLog(final Boolean b) { - if (filled.get(18)) { - throw new IllegalStateException("instdecoder.FAMILY_LOG already set"); - } else { - filled.set(18); - } - - familyLog.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyMachineState(final Boolean b) { - if (filled.get(19)) { - throw new IllegalStateException("instdecoder.FAMILY_MACHINE_STATE already set"); - } else { - filled.set(19); - } - - familyMachineState.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyMod(final Boolean b) { - if (filled.get(20)) { - throw new IllegalStateException("instdecoder.FAMILY_MOD already set"); - } else { - filled.set(20); - } - - familyMod.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyMul(final Boolean b) { - if (filled.get(21)) { - throw new IllegalStateException("instdecoder.FAMILY_MUL already set"); - } else { - filled.set(21); - } - - familyMul.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyPushPop(final Boolean b) { - if (filled.get(22)) { - throw new IllegalStateException("instdecoder.FAMILY_PUSH_POP already set"); - } else { - filled.set(22); - } - - familyPushPop.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyShf(final Boolean b) { - if (filled.get(23)) { - throw new IllegalStateException("instdecoder.FAMILY_SHF already set"); - } else { - filled.set(23); - } - - familyShf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyStackRam(final Boolean b) { - if (filled.get(24)) { - throw new IllegalStateException("instdecoder.FAMILY_STACK_RAM already set"); - } else { - filled.set(24); - } - - familyStackRam.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyStorage(final Boolean b) { - if (filled.get(25)) { - throw new IllegalStateException("instdecoder.FAMILY_STORAGE already set"); - } else { - filled.set(25); - } - - familyStorage.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familySwap(final Boolean b) { - if (filled.get(26)) { - throw new IllegalStateException("instdecoder.FAMILY_SWAP already set"); - } else { - filled.set(26); - } - - familySwap.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyTransaction(final Boolean b) { - if (filled.get(27)) { - throw new IllegalStateException("instdecoder.FAMILY_TRANSACTION already set"); - } else { - filled.set(27); - } - - familyTransaction.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace familyWcp(final Boolean b) { - if (filled.get(28)) { - throw new IllegalStateException("instdecoder.FAMILY_WCP already set"); - } else { - filled.set(28); - } - - familyWcp.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace flag1(final Boolean b) { - if (filled.get(29)) { - throw new IllegalStateException("instdecoder.FLAG_1 already set"); - } else { - filled.set(29); - } - - flag1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace flag2(final Boolean b) { - if (filled.get(30)) { - throw new IllegalStateException("instdecoder.FLAG_2 already set"); - } else { - filled.set(30); - } - - flag2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace flag3(final Boolean b) { - if (filled.get(31)) { - throw new IllegalStateException("instdecoder.FLAG_3 already set"); - } else { - filled.set(31); - } - - flag3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace flag4(final Boolean b) { - if (filled.get(32)) { - throw new IllegalStateException("instdecoder.FLAG_4 already set"); - } else { - filled.set(32); - } - - flag4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isJumpdest(final Boolean b) { - if (filled.get(33)) { - throw new IllegalStateException("instdecoder.IS_JUMPDEST already set"); - } else { - filled.set(33); - } - - isJumpdest.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace isPush(final Boolean b) { - if (filled.get(34)) { - throw new IllegalStateException("instdecoder.IS_PUSH already set"); - } else { - filled.set(34); - } - - isPush.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpFlag(final Boolean b) { - if (filled.get(35)) { - throw new IllegalStateException("instdecoder.MXP_FLAG already set"); - } else { - filled.set(35); - } - - mxpFlag.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpType1(final Boolean b) { - if (filled.get(36)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_1 already set"); - } else { - filled.set(36); - } - - mxpType1.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpType2(final Boolean b) { - if (filled.get(37)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_2 already set"); - } else { - filled.set(37); - } - - mxpType2.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpType3(final Boolean b) { - if (filled.get(38)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_3 already set"); - } else { - filled.set(38); - } - - mxpType3.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpType4(final Boolean b) { - if (filled.get(39)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_4 already set"); - } else { - filled.set(39); - } - - mxpType4.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace mxpType5(final Boolean b) { - if (filled.get(40)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_5 already set"); - } else { - filled.set(40); - } - - mxpType5.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace opcode(final Bytes b) { - if (filled.get(41)) { - throw new IllegalStateException("instdecoder.OPCODE already set"); - } else { - filled.set(41); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 256) { throw new IllegalArgumentException("instdecoder.OPCODE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<32; i++) { opcode.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("instdecoder.STATIC_GAS has invalid value (" + b + ")"); } - staticGas.put((byte) (b >> 24)); - staticGas.put((byte) (b >> 16)); - staticGas.put((byte) (b >> 8)); - staticGas.put((byte) b); - - - return this; - } - - public Trace twoLineInstruction(final Boolean b) { - if (filled.get(44)) { - throw new IllegalStateException("instdecoder.TWO_LINE_INSTRUCTION already set"); - } else { - filled.set(44); - } - - twoLineInstruction.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("instdecoder.ALPHA has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("instdecoder.BILLING_PER_BYTE has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("instdecoder.BILLING_PER_WORD has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("instdecoder.DELTA has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("instdecoder.FAMILY_ACCOUNT has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("instdecoder.FAMILY_ADD has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("instdecoder.FAMILY_BATCH has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("instdecoder.FAMILY_BIN has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("instdecoder.FAMILY_CALL has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("instdecoder.FAMILY_CONTEXT has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("instdecoder.FAMILY_COPY has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("instdecoder.FAMILY_CREATE has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("instdecoder.FAMILY_DUP has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("instdecoder.FAMILY_EXT has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("instdecoder.FAMILY_HALT has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("instdecoder.FAMILY_INVALID has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("instdecoder.FAMILY_JUMP has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("instdecoder.FAMILY_KEC has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("instdecoder.FAMILY_LOG has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("instdecoder.FAMILY_MACHINE_STATE has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("instdecoder.FAMILY_MOD has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("instdecoder.FAMILY_MUL has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("instdecoder.FAMILY_PUSH_POP has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("instdecoder.FAMILY_SHF has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("instdecoder.FAMILY_STACK_RAM has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("instdecoder.FAMILY_STORAGE has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("instdecoder.FAMILY_SWAP has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("instdecoder.FAMILY_TRANSACTION has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("instdecoder.FAMILY_WCP has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("instdecoder.FLAG_1 has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("instdecoder.FLAG_2 has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("instdecoder.FLAG_3 has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("instdecoder.FLAG_4 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("instdecoder.IS_JUMPDEST has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("instdecoder.IS_PUSH has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("instdecoder.MXP_FLAG has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_1 has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_2 has not been filled"); - } - - if (!filled.get(38)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_3 has not been filled"); - } - - if (!filled.get(39)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_4 has not been filled"); - } - - if (!filled.get(40)) { - throw new IllegalStateException("instdecoder.MXP_TYPE_5 has not been filled"); - } - - if (!filled.get(41)) { - throw new IllegalStateException("instdecoder.OPCODE has not been filled"); - } - - if (!filled.get(42)) { - throw new IllegalStateException("instdecoder.STATIC_FLAG has not been filled"); - } - - if (!filled.get(43)) { - throw new IllegalStateException("instdecoder.STATIC_GAS has not been filled"); - } - - if (!filled.get(44)) { - throw new IllegalStateException("instdecoder.TWO_LINE_INSTRUCTION has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - alpha.position(alpha.position() + 1); - } - - if (!filled.get(1)) { - billingPerByte.position(billingPerByte.position() + 1); - } - - if (!filled.get(2)) { - billingPerWord.position(billingPerWord.position() + 1); - } - - if (!filled.get(3)) { - delta.position(delta.position() + 1); - } - - if (!filled.get(4)) { - familyAccount.position(familyAccount.position() + 1); - } - - if (!filled.get(5)) { - familyAdd.position(familyAdd.position() + 1); - } - - if (!filled.get(6)) { - familyBatch.position(familyBatch.position() + 1); - } - - if (!filled.get(7)) { - familyBin.position(familyBin.position() + 1); - } - - if (!filled.get(8)) { - familyCall.position(familyCall.position() + 1); - } - - if (!filled.get(9)) { - familyContext.position(familyContext.position() + 1); - } - - if (!filled.get(10)) { - familyCopy.position(familyCopy.position() + 1); - } - - if (!filled.get(11)) { - familyCreate.position(familyCreate.position() + 1); - } - - if (!filled.get(12)) { - familyDup.position(familyDup.position() + 1); - } - - if (!filled.get(13)) { - familyExt.position(familyExt.position() + 1); - } - - if (!filled.get(14)) { - familyHalt.position(familyHalt.position() + 1); - } - - if (!filled.get(15)) { - familyInvalid.position(familyInvalid.position() + 1); - } - - if (!filled.get(16)) { - familyJump.position(familyJump.position() + 1); - } - - if (!filled.get(17)) { - familyKec.position(familyKec.position() + 1); - } - - if (!filled.get(18)) { - familyLog.position(familyLog.position() + 1); - } - - if (!filled.get(19)) { - familyMachineState.position(familyMachineState.position() + 1); - } - - if (!filled.get(20)) { - familyMod.position(familyMod.position() + 1); - } - - if (!filled.get(21)) { - familyMul.position(familyMul.position() + 1); - } - - if (!filled.get(22)) { - familyPushPop.position(familyPushPop.position() + 1); - } - - if (!filled.get(23)) { - familyShf.position(familyShf.position() + 1); - } - - if (!filled.get(24)) { - familyStackRam.position(familyStackRam.position() + 1); - } - - if (!filled.get(25)) { - familyStorage.position(familyStorage.position() + 1); - } - - if (!filled.get(26)) { - familySwap.position(familySwap.position() + 1); - } - - if (!filled.get(27)) { - familyTransaction.position(familyTransaction.position() + 1); - } - - if (!filled.get(28)) { - familyWcp.position(familyWcp.position() + 1); - } - - if (!filled.get(29)) { - flag1.position(flag1.position() + 1); - } - - if (!filled.get(30)) { - flag2.position(flag2.position() + 1); - } - - if (!filled.get(31)) { - flag3.position(flag3.position() + 1); - } - - if (!filled.get(32)) { - flag4.position(flag4.position() + 1); - } - - if (!filled.get(33)) { - isJumpdest.position(isJumpdest.position() + 1); - } - - if (!filled.get(34)) { - isPush.position(isPush.position() + 1); - } - - if (!filled.get(35)) { - mxpFlag.position(mxpFlag.position() + 1); - } - - if (!filled.get(36)) { - mxpType1.position(mxpType1.position() + 1); - } - - if (!filled.get(37)) { - mxpType2.position(mxpType2.position() + 1); - } - - if (!filled.get(38)) { - mxpType3.position(mxpType3.position() + 1); - } - - if (!filled.get(39)) { - mxpType4.position(mxpType4.position() + 1); - } - - if (!filled.get(40)) { - mxpType5.position(mxpType5.position() + 1); - } - - if (!filled.get(41)) { - opcode.position(opcode.position() + 32); - } - - if (!filled.get(42)) { - staticFlag.position(staticFlag.position() + 1); - } - - if (!filled.get(43)) { - staticGas.position(staticGas.position() + 4); - } - - if (!filled.get(44)) { - twoLineInstruction.position(twoLineInstruction.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java deleted file mode 100644 index e4bca602e..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/shf/Trace.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.tables.shf; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer byte1; - private final MappedByteBuffer iomf; - private final MappedByteBuffer las; - private final MappedByteBuffer mshp; - private final MappedByteBuffer ones; - private final MappedByteBuffer rap; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("shfreftable.BYTE1", 1, length)); - headers.add(new ColumnHeader("shfreftable.IOMF", 1, length)); - headers.add(new ColumnHeader("shfreftable.LAS", 1, length)); - headers.add(new ColumnHeader("shfreftable.MSHP", 1, length)); - headers.add(new ColumnHeader("shfreftable.ONES", 1, length)); - headers.add(new ColumnHeader("shfreftable.RAP", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.byte1 = buffers.get(0); - this.iomf = buffers.get(1); - this.las = buffers.get(2); - this.mshp = buffers.get(3); - this.ones = buffers.get(4); - this.rap = buffers.get(5); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace byte1(final UnsignedByte b) { - if (filled.get(0)) { - throw new IllegalStateException("shfreftable.BYTE1 already set"); - } else { - filled.set(0); - } - - byte1.put(b.toByte()); - - return this; - } - - public Trace iomf(final Boolean b) { - if (filled.get(1)) { - throw new IllegalStateException("shfreftable.IOMF already set"); - } else { - filled.set(1); - } - - iomf.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace las(final UnsignedByte b) { - if (filled.get(2)) { - throw new IllegalStateException("shfreftable.LAS already set"); - } else { - filled.set(2); - } - - las.put(b.toByte()); - - return this; - } - - public Trace mshp(final UnsignedByte b) { - if (filled.get(3)) { - throw new IllegalStateException("shfreftable.MSHP already set"); - } else { - filled.set(3); - } - - mshp.put(b.toByte()); - - return this; - } - - public Trace ones(final UnsignedByte b) { - if (filled.get(4)) { - throw new IllegalStateException("shfreftable.ONES already set"); - } else { - filled.set(4); - } - - ones.put(b.toByte()); - - return this; - } - - public Trace rap(final UnsignedByte b) { - if (filled.get(5)) { - throw new IllegalStateException("shfreftable.RAP already set"); - } else { - filled.set(5); - } - - rap.put(b.toByte()); - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("shfreftable.BYTE1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("shfreftable.IOMF has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("shfreftable.LAS has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("shfreftable.MSHP has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("shfreftable.ONES has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("shfreftable.RAP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(1)) { - iomf.position(iomf.position() + 1); - } - - if (!filled.get(2)) { - las.position(las.position() + 1); - } - - if (!filled.get(3)) { - mshp.position(mshp.position() + 1); - } - - if (!filled.get(4)) { - ones.position(ones.position() + 1); - } - - if (!filled.get(5)) { - rap.position(rap.position() + 1); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java deleted file mode 100644 index 1604c27ec..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/trm/Trace.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.trm; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer accHi; - private final MappedByteBuffer accLo; - private final MappedByteBuffer accT; - private final MappedByteBuffer byteHi; - private final MappedByteBuffer byteLo; - private final MappedByteBuffer ct; - private final MappedByteBuffer isPrecompile; - private final MappedByteBuffer one; - private final MappedByteBuffer plateauBit; - private final MappedByteBuffer rawAddressHi; - private final MappedByteBuffer rawAddressLo; - private final MappedByteBuffer stamp; - private final MappedByteBuffer trmAddressHi; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("trm.ACC_HI", 16, length)); - headers.add(new ColumnHeader("trm.ACC_LO", 16, length)); - headers.add(new ColumnHeader("trm.ACC_T", 4, length)); - headers.add(new ColumnHeader("trm.BYTE_HI", 1, length)); - headers.add(new ColumnHeader("trm.BYTE_LO", 1, length)); - headers.add(new ColumnHeader("trm.CT", 1, length)); - headers.add(new ColumnHeader("trm.IS_PRECOMPILE", 1, length)); - headers.add(new ColumnHeader("trm.ONE", 1, length)); - headers.add(new ColumnHeader("trm.PLATEAU_BIT", 1, length)); - headers.add(new ColumnHeader("trm.RAW_ADDRESS_HI", 16, length)); - headers.add(new ColumnHeader("trm.RAW_ADDRESS_LO", 16, length)); - headers.add(new ColumnHeader("trm.STAMP", 3, length)); - headers.add(new ColumnHeader("trm.TRM_ADDRESS_HI", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.accHi = buffers.get(0); - this.accLo = buffers.get(1); - this.accT = buffers.get(2); - this.byteHi = buffers.get(3); - this.byteLo = buffers.get(4); - this.ct = buffers.get(5); - this.isPrecompile = buffers.get(6); - this.one = buffers.get(7); - this.plateauBit = buffers.get(8); - this.rawAddressHi = buffers.get(9); - this.rawAddressLo = buffers.get(10); - this.stamp = buffers.get(11); - this.trmAddressHi = buffers.get(12); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace accHi(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("trm.ACC_HI already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.ACC_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("trm.ACC_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { accLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("trm.ACC_T has invalid value (" + b + ")"); } - accT.put((byte) (b >> 24)); - accT.put((byte) (b >> 16)); - accT.put((byte) (b >> 8)); - accT.put((byte) b); - - - return this; - } - - public Trace byteHi(final UnsignedByte b) { - if (filled.get(3)) { - throw new IllegalStateException("trm.BYTE_HI already set"); - } else { - filled.set(3); - } - - byteHi.put(b.toByte()); - - return this; - } - - public Trace byteLo(final UnsignedByte b) { - if (filled.get(4)) { - throw new IllegalStateException("trm.BYTE_LO already set"); - } else { - filled.set(4); - } - - byteLo.put(b.toByte()); - - return this; - } - - public Trace ct(final long b) { - if (filled.get(5)) { - throw new IllegalStateException("trm.CT already set"); - } else { - filled.set(5); - } - - if(b >= 16L) { throw new IllegalArgumentException("trm.CT has invalid value (" + b + ")"); } - ct.put((byte) b); - - - return this; - } - - public Trace isPrecompile(final Boolean b) { - if (filled.get(6)) { - throw new IllegalStateException("trm.IS_PRECOMPILE already set"); - } else { - filled.set(6); - } - - isPrecompile.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace one(final Boolean b) { - if (filled.get(7)) { - throw new IllegalStateException("trm.ONE already set"); - } else { - filled.set(7); - } - - one.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace plateauBit(final Boolean b) { - if (filled.get(8)) { - throw new IllegalStateException("trm.PLATEAU_BIT already set"); - } else { - filled.set(8); - } - - plateauBit.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace rawAddressHi(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("trm.RAW_ADDRESS_HI already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("trm.RAW_ADDRESS_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAddressHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("trm.RAW_ADDRESS_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { rawAddressLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 16777216L) { throw new IllegalArgumentException("trm.STAMP has invalid value (" + b + ")"); } - stamp.put((byte) (b >> 16)); - stamp.put((byte) (b >> 8)); - stamp.put((byte) b); - - - return this; - } - - public Trace trmAddressHi(final long b) { - if (filled.get(12)) { - throw new IllegalStateException("trm.TRM_ADDRESS_HI already set"); - } else { - filled.set(12); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("trm.TRM_ADDRESS_HI has invalid value (" + b + ")"); } - trmAddressHi.put((byte) (b >> 24)); - trmAddressHi.put((byte) (b >> 16)); - trmAddressHi.put((byte) (b >> 8)); - trmAddressHi.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("trm.ACC_HI has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("trm.ACC_LO has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("trm.ACC_T has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("trm.BYTE_HI has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("trm.BYTE_LO has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("trm.CT has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("trm.IS_PRECOMPILE has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("trm.ONE has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("trm.PLATEAU_BIT has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("trm.RAW_ADDRESS_HI has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("trm.RAW_ADDRESS_LO has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("trm.STAMP has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("trm.TRM_ADDRESS_HI has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - accHi.position(accHi.position() + 16); - } - - if (!filled.get(1)) { - accLo.position(accLo.position() + 16); - } - - if (!filled.get(2)) { - accT.position(accT.position() + 4); - } - - if (!filled.get(3)) { - byteHi.position(byteHi.position() + 1); - } - - if (!filled.get(4)) { - byteLo.position(byteLo.position() + 1); - } - - if (!filled.get(5)) { - ct.position(ct.position() + 1); - } - - if (!filled.get(6)) { - isPrecompile.position(isPrecompile.position() + 1); - } - - if (!filled.get(7)) { - one.position(one.position() + 1); - } - - if (!filled.get(8)) { - plateauBit.position(plateauBit.position() + 1); - } - - if (!filled.get(9)) { - rawAddressHi.position(rawAddressHi.position() + 16); - } - - if (!filled.get(10)) { - rawAddressLo.position(rawAddressLo.position() + 16); - } - - if (!filled.get(11)) { - stamp.position(stamp.position() + 3); - } - - if (!filled.get(12)) { - trmAddressHi.position(trmAddressHi.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java deleted file mode 100644 index 2fe3d1806..000000000 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/Trace.java +++ /dev/null @@ -1,1712 +0,0 @@ -/* - * Copyright ConsenSys Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.txndata; - -import java.math.BigInteger; -import java.nio.MappedByteBuffer; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - -import net.consensys.linea.zktracer.ColumnHeader; -import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; - -/** - * WARNING: This code is generated automatically. - * - *

Any modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - public static final int BLOCKHASH_MAX_HISTORY = 0x100; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_0 = 0x1; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_1 = 0x8; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_2 = 0x3; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_3 = 0x9; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_4 = 0xa; - public static final int COMMON_RLP_TXN_PHASE_NUMBER_5 = 0x7; - public static final int CREATE2_SHIFT = 0xff; - public static final int CT_MAX_TYPE_0 = 0x7; - public static final int CT_MAX_TYPE_1 = 0x8; - public static final int CT_MAX_TYPE_2 = 0x8; - public static final long EIP2681_MAX_NONCE = 0xffffffffffffffffL; - public static final int EIP_3541_MARKER = 0xef; - public static final BigInteger EMPTY_KECCAK_HI = new BigInteger("262949717399590921288928019264691438528"); - public static final BigInteger EMPTY_KECCAK_LO = new BigInteger("304396909071904405792975023732328604784"); - public static final int EMPTY_RIPEMD_HI = 0x9c1185a5; - public static final BigInteger EMPTY_RIPEMD_LO = new BigInteger("263072838190121256777638892741499129137"); - public static final BigInteger EMPTY_SHA2_HI = new BigInteger("302652579918965577886386472538583578916"); - public static final BigInteger EMPTY_SHA2_LO = new BigInteger("52744687940778649747319168982913824853"); - public static final long ETHEREUM_GAS_LIMIT_MAXIMUM = 0xffffffffffffffffL; - public static final int ETHEREUM_GAS_LIMIT_MINIMUM = 0x1388; - public static final int EVM_INST_ADD = 0x1; - public static final int EVM_INST_ADDMOD = 0x8; - public static final int EVM_INST_ADDRESS = 0x30; - public static final int EVM_INST_AND = 0x16; - public static final int EVM_INST_BALANCE = 0x31; - public static final int EVM_INST_BASEFEE = 0x48; - public static final int EVM_INST_BLOCKHASH = 0x40; - public static final int EVM_INST_BYTE = 0x1a; - public static final int EVM_INST_CALL = 0xf1; - public static final int EVM_INST_CALLCODE = 0xf2; - public static final int EVM_INST_CALLDATACOPY = 0x37; - public static final int EVM_INST_CALLDATALOAD = 0x35; - public static final int EVM_INST_CALLDATASIZE = 0x36; - public static final int EVM_INST_CALLER = 0x33; - public static final int EVM_INST_CALLVALUE = 0x34; - public static final int EVM_INST_CHAINID = 0x46; - public static final int EVM_INST_CODECOPY = 0x39; - public static final int EVM_INST_CODESIZE = 0x38; - public static final int EVM_INST_COINBASE = 0x41; - public static final int EVM_INST_CREATE = 0xf0; - public static final int EVM_INST_CREATE2 = 0xf5; - public static final int EVM_INST_DELEGATECALL = 0xf4; - public static final int EVM_INST_DIFFICULTY = 0x44; - public static final int EVM_INST_DIV = 0x4; - public static final int EVM_INST_DUP1 = 0x80; - public static final int EVM_INST_DUP10 = 0x89; - public static final int EVM_INST_DUP11 = 0x8a; - public static final int EVM_INST_DUP12 = 0x8b; - public static final int EVM_INST_DUP13 = 0x8c; - public static final int EVM_INST_DUP14 = 0x8d; - public static final int EVM_INST_DUP15 = 0x8e; - public static final int EVM_INST_DUP16 = 0x8f; - public static final int EVM_INST_DUP2 = 0x81; - public static final int EVM_INST_DUP3 = 0x82; - public static final int EVM_INST_DUP4 = 0x83; - public static final int EVM_INST_DUP5 = 0x84; - public static final int EVM_INST_DUP6 = 0x85; - public static final int EVM_INST_DUP7 = 0x86; - public static final int EVM_INST_DUP8 = 0x87; - public static final int EVM_INST_DUP9 = 0x88; - public static final int EVM_INST_EQ = 0x14; - public static final int EVM_INST_EXP = 0xa; - public static final int EVM_INST_EXTCODECOPY = 0x3c; - public static final int EVM_INST_EXTCODEHASH = 0x3f; - public static final int EVM_INST_EXTCODESIZE = 0x3b; - public static final int EVM_INST_GAS = 0x5a; - public static final int EVM_INST_GASLIMIT = 0x45; - public static final int EVM_INST_GASPRICE = 0x3a; - public static final int EVM_INST_GT = 0x11; - public static final int EVM_INST_INVALID = 0xfe; - public static final int EVM_INST_ISZERO = 0x15; - public static final int EVM_INST_JUMP = 0x56; - public static final int EVM_INST_JUMPDEST = 0x5b; - public static final int EVM_INST_JUMPI = 0x57; - public static final int EVM_INST_LOG0 = 0xa0; - public static final int EVM_INST_LOG1 = 0xa1; - public static final int EVM_INST_LOG2 = 0xa2; - public static final int EVM_INST_LOG3 = 0xa3; - public static final int EVM_INST_LOG4 = 0xa4; - public static final int EVM_INST_LT = 0x10; - public static final int EVM_INST_MLOAD = 0x51; - public static final int EVM_INST_MOD = 0x6; - public static final int EVM_INST_MSIZE = 0x59; - public static final int EVM_INST_MSTORE = 0x52; - public static final int EVM_INST_MSTORE8 = 0x53; - public static final int EVM_INST_MUL = 0x2; - public static final int EVM_INST_MULMOD = 0x9; - public static final int EVM_INST_NOT = 0x19; - public static final int EVM_INST_NUMBER = 0x43; - public static final int EVM_INST_OR = 0x17; - public static final int EVM_INST_ORIGIN = 0x32; - public static final int EVM_INST_PC = 0x58; - public static final int EVM_INST_POP = 0x50; - public static final int EVM_INST_PUSH1 = 0x60; - public static final int EVM_INST_PUSH10 = 0x69; - public static final int EVM_INST_PUSH11 = 0x6a; - public static final int EVM_INST_PUSH12 = 0x6b; - public static final int EVM_INST_PUSH13 = 0x6c; - public static final int EVM_INST_PUSH14 = 0x6d; - public static final int EVM_INST_PUSH15 = 0x6e; - public static final int EVM_INST_PUSH16 = 0x6f; - public static final int EVM_INST_PUSH17 = 0x70; - public static final int EVM_INST_PUSH18 = 0x71; - public static final int EVM_INST_PUSH19 = 0x72; - public static final int EVM_INST_PUSH2 = 0x61; - public static final int EVM_INST_PUSH20 = 0x73; - public static final int EVM_INST_PUSH21 = 0x74; - public static final int EVM_INST_PUSH22 = 0x75; - public static final int EVM_INST_PUSH23 = 0x76; - public static final int EVM_INST_PUSH24 = 0x77; - public static final int EVM_INST_PUSH25 = 0x78; - public static final int EVM_INST_PUSH26 = 0x79; - public static final int EVM_INST_PUSH27 = 0x7a; - public static final int EVM_INST_PUSH28 = 0x7b; - public static final int EVM_INST_PUSH29 = 0x7c; - public static final int EVM_INST_PUSH3 = 0x62; - public static final int EVM_INST_PUSH30 = 0x7d; - public static final int EVM_INST_PUSH31 = 0x7e; - public static final int EVM_INST_PUSH32 = 0x7f; - public static final int EVM_INST_PUSH4 = 0x63; - public static final int EVM_INST_PUSH5 = 0x64; - public static final int EVM_INST_PUSH6 = 0x65; - public static final int EVM_INST_PUSH7 = 0x66; - public static final int EVM_INST_PUSH8 = 0x67; - public static final int EVM_INST_PUSH9 = 0x68; - public static final int EVM_INST_RETURN = 0xf3; - public static final int EVM_INST_RETURNDATACOPY = 0x3e; - public static final int EVM_INST_RETURNDATASIZE = 0x3d; - public static final int EVM_INST_REVERT = 0xfd; - public static final int EVM_INST_SAR = 0x1d; - public static final int EVM_INST_SDIV = 0x5; - public static final int EVM_INST_SELFBALANCE = 0x47; - public static final int EVM_INST_SELFDESTRUCT = 0xff; - public static final int EVM_INST_SGT = 0x13; - public static final int EVM_INST_SHA3 = 0x20; - public static final int EVM_INST_SHL = 0x1b; - public static final int EVM_INST_SHR = 0x1c; - public static final int EVM_INST_SIGNEXTEND = 0xb; - public static final int EVM_INST_SLOAD = 0x54; - public static final int EVM_INST_SLT = 0x12; - public static final int EVM_INST_SMOD = 0x7; - public static final int EVM_INST_SSTORE = 0x55; - public static final int EVM_INST_STATICCALL = 0xfa; - public static final int EVM_INST_STOP = 0x0; - public static final int EVM_INST_SUB = 0x3; - public static final int EVM_INST_SWAP1 = 0x90; - public static final int EVM_INST_SWAP10 = 0x99; - public static final int EVM_INST_SWAP11 = 0x9a; - public static final int EVM_INST_SWAP12 = 0x9b; - public static final int EVM_INST_SWAP13 = 0x9c; - public static final int EVM_INST_SWAP14 = 0x9d; - public static final int EVM_INST_SWAP15 = 0x9e; - public static final int EVM_INST_SWAP16 = 0x9f; - public static final int EVM_INST_SWAP2 = 0x91; - public static final int EVM_INST_SWAP3 = 0x92; - public static final int EVM_INST_SWAP4 = 0x93; - public static final int EVM_INST_SWAP5 = 0x94; - public static final int EVM_INST_SWAP6 = 0x95; - public static final int EVM_INST_SWAP7 = 0x96; - public static final int EVM_INST_SWAP8 = 0x97; - public static final int EVM_INST_SWAP9 = 0x98; - public static final int EVM_INST_TIMESTAMP = 0x42; - public static final int EVM_INST_XOR = 0x18; - public static final int EXO_SUM_INDEX_BLAKEMODEXP = 0x6; - public static final int EXO_SUM_INDEX_ECDATA = 0x4; - public static final int EXO_SUM_INDEX_KEC = 0x1; - public static final int EXO_SUM_INDEX_LOG = 0x2; - public static final int EXO_SUM_INDEX_RIPSHA = 0x5; - public static final int EXO_SUM_INDEX_ROM = 0x0; - public static final int EXO_SUM_INDEX_TXCD = 0x3; - public static final int EXO_SUM_WEIGHT_BLAKEMODEXP = 0x40; - public static final int EXO_SUM_WEIGHT_ECDATA = 0x10; - public static final int EXO_SUM_WEIGHT_KEC = 0x2; - public static final int EXO_SUM_WEIGHT_LOG = 0x4; - public static final int EXO_SUM_WEIGHT_RIPSHA = 0x20; - public static final int EXO_SUM_WEIGHT_ROM = 0x1; - public static final int EXO_SUM_WEIGHT_TXCD = 0x8; - public static final int EXP_INST_EXPLOG = 0xee0a; - public static final int EXP_INST_MODEXPLOG = 0xee05; - public static final int GAS_CONST_G_ACCESS_LIST_ADRESS = 0x960; - public static final int GAS_CONST_G_ACCESS_LIST_STORAGE = 0x76c; - public static final int GAS_CONST_G_BASE = 0x2; - public static final int GAS_CONST_G_BLOCKHASH = 0x14; - public static final int GAS_CONST_G_CALL_STIPEND = 0x8fc; - public static final int GAS_CONST_G_CALL_VALUE = 0x2328; - public static final int GAS_CONST_G_CODE_DEPOSIT = 0xc8; - public static final int GAS_CONST_G_COLD_ACCOUNT_ACCESS = 0xa28; - public static final int GAS_CONST_G_COLD_SLOAD = 0x834; - public static final int GAS_CONST_G_COPY = 0x3; - public static final int GAS_CONST_G_CREATE = 0x7d00; - public static final int GAS_CONST_G_EXP = 0xa; - public static final int GAS_CONST_G_EXP_BYTE = 0x32; - public static final int GAS_CONST_G_HIGH = 0xa; - public static final int GAS_CONST_G_JUMPDEST = 0x1; - public static final int GAS_CONST_G_KECCAK_256 = 0x1e; - public static final int GAS_CONST_G_KECCAK_256_WORD = 0x6; - public static final int GAS_CONST_G_LOG = 0x177; - public static final int GAS_CONST_G_LOG_DATA = 0x8; - public static final int GAS_CONST_G_LOG_TOPIC = 0x177; - public static final int GAS_CONST_G_LOW = 0x5; - public static final int GAS_CONST_G_MEMORY = 0x3; - public static final int GAS_CONST_G_MID = 0x8; - public static final int GAS_CONST_G_NEW_ACCOUNT = 0x61a8; - public static final int GAS_CONST_G_SELFDESTRUCT = 0x1388; - public static final int GAS_CONST_G_SRESET = 0xb54; - public static final int GAS_CONST_G_SSET = 0x4e20; - public static final int GAS_CONST_G_TRANSACTION = 0x5208; - public static final int GAS_CONST_G_TX_CREATE = 0x7d00; - public static final int GAS_CONST_G_TX_DATA_NONZERO = 0x10; - public static final int GAS_CONST_G_TX_DATA_ZERO = 0x4; - public static final int GAS_CONST_G_VERY_LOW = 0x3; - public static final int GAS_CONST_G_WARM_ACCESS = 0x64; - public static final int GAS_CONST_G_ZERO = 0x0; - public static final int GAS_LIMIT_ADJUSTMENT_FACTOR = 0x400; - public static final int LINEA_BASE_FEE = 0x7; - public static final int LINEA_BLOCK_GAS_LIMIT = 0x3a2c940; - public static final int LINEA_CHAIN_ID = 0xe708; - public static final int LINEA_DIFFICULTY = 0x2; - public static final int LINEA_GAS_LIMIT_MAXIMUM = 0x77359400; - public static final int LINEA_GAS_LIMIT_MINIMUM = 0x3a2c940; - public static final int LINEA_GOERLI_CHAIN_ID = 0xe704; - public static final int LINEA_MAX_NUMBER_OF_TRANSACTIONS_IN_BATCH = 0xc8; - public static final int LINEA_SEPOLIA_CHAIN_ID = 0xe705; - public static final int LLARGE = 0x10; - public static final int LLARGEMO = 0xf; - public static final int LLARGEPO = 0x11; - public static final int MAX_CODE_SIZE = 0x6000; - public static final int MAX_REFUND_QUOTIENT = 0x5; - public static final int MISC_WEIGHT_EXP = 0x1; - public static final int MISC_WEIGHT_MMU = 0x2; - public static final int MISC_WEIGHT_MXP = 0x4; - public static final int MISC_WEIGHT_OOB = 0x8; - public static final int MISC_WEIGHT_STP = 0x10; - public static final int MMEDIUM = 0x8; - public static final int MMEDIUMMO = 0x7; - public static final int MMIO_INST_LIMB_TO_RAM_ONE_TARGET = 0xfe12; - public static final int MMIO_INST_LIMB_TO_RAM_TRANSPLANT = 0xfe11; - public static final int MMIO_INST_LIMB_TO_RAM_TWO_TARGET = 0xfe13; - public static final int MMIO_INST_LIMB_VANISHES = 0xfe01; - public static final int MMIO_INST_RAM_EXCISION = 0xfe41; - public static final int MMIO_INST_RAM_TO_LIMB_ONE_SOURCE = 0xfe22; - public static final int MMIO_INST_RAM_TO_LIMB_TRANSPLANT = 0xfe21; - public static final int MMIO_INST_RAM_TO_LIMB_TWO_SOURCE = 0xfe23; - public static final int MMIO_INST_RAM_TO_RAM_PARTIAL = 0xfe32; - public static final int MMIO_INST_RAM_TO_RAM_TRANSPLANT = 0xfe31; - public static final int MMIO_INST_RAM_TO_RAM_TWO_SOURCE = 0xfe34; - public static final int MMIO_INST_RAM_TO_RAM_TWO_TARGET = 0xfe33; - public static final int MMIO_INST_RAM_VANISHES = 0xfe42; - public static final int MMU_INST_ANY_TO_RAM_WITH_PADDING = 0xfe50; - public static final int MMU_INST_BLAKE = 0xfe80; - public static final int MMU_INST_EXO_TO_RAM_TRANSPLANTS = 0xfe30; - public static final int MMU_INST_INVALID_CODE_PREFIX = 0xfe00; - public static final int MMU_INST_MLOAD = 0xfe01; - public static final int MMU_INST_MODEXP_DATA = 0xfe70; - public static final int MMU_INST_MODEXP_ZERO = 0xfe60; - public static final int MMU_INST_MSTORE = 0xfe02; - public static final int MMU_INST_MSTORE8 = 0xfe03; - public static final int MMU_INST_RAM_TO_EXO_WITH_PADDING = 0xfe20; - public static final int MMU_INST_RAM_TO_RAM_SANS_PADDING = 0xfe40; - public static final int MMU_INST_RIGHT_PADDED_WORD_EXTRACTION = 0xfe10; - public static final int NB_ROWS_TYPE_0 = 0x8; - public static final int NB_ROWS_TYPE_1 = 0x9; - public static final int NB_ROWS_TYPE_2 = 0x9; - public static final int OOB_INST_BLAKE_CDS = 0xfa09; - public static final int OOB_INST_BLAKE_PARAMS = 0xfb09; - public static final int OOB_INST_CALL = 0xca; - public static final int OOB_INST_CDL = 0x35; - public static final int OOB_INST_CREATE = 0xce; - public static final int OOB_INST_DEPLOYMENT = 0xf3; - public static final int OOB_INST_ECADD = 0xff06; - public static final int OOB_INST_ECMUL = 0xff07; - public static final int OOB_INST_ECPAIRING = 0xff08; - public static final int OOB_INST_ECRECOVER = 0xff01; - public static final int OOB_INST_IDENTITY = 0xff04; - public static final int OOB_INST_JUMP = 0x56; - public static final int OOB_INST_JUMPI = 0x57; - public static final int OOB_INST_MODEXP_CDS = 0xfa05; - public static final int OOB_INST_MODEXP_EXTRACT = 0xfe05; - public static final int OOB_INST_MODEXP_LEAD = 0xfc05; - public static final int OOB_INST_MODEXP_PRICING = 0xfd05; - public static final int OOB_INST_MODEXP_XBS = 0xfb05; - public static final int OOB_INST_RDC = 0x3e; - public static final int OOB_INST_RIPEMD = 0xff03; - public static final int OOB_INST_SHA2 = 0xff02; - public static final int OOB_INST_SSTORE = 0x55; - public static final int OOB_INST_XCALL = 0xcc; - public static final int PHASE_BLAKE_DATA = 0x5; - public static final int PHASE_BLAKE_PARAMS = 0x6; - public static final int PHASE_BLAKE_RESULT = 0x7; - public static final int PHASE_ECADD_DATA = 0x60a; - public static final int PHASE_ECADD_RESULT = 0x60b; - public static final int PHASE_ECMUL_DATA = 0x70a; - public static final int PHASE_ECMUL_RESULT = 0x70b; - public static final int PHASE_ECPAIRING_DATA = 0x80a; - public static final int PHASE_ECPAIRING_RESULT = 0x80b; - public static final int PHASE_ECRECOVER_DATA = 0x10a; - public static final int PHASE_ECRECOVER_RESULT = 0x10b; - public static final int PHASE_KECCAK_DATA = 0x5; - public static final int PHASE_KECCAK_RESULT = 0x6; - public static final int PHASE_MODEXP_BASE = 0x1; - public static final int PHASE_MODEXP_EXPONENT = 0x2; - public static final int PHASE_MODEXP_MODULUS = 0x3; - public static final int PHASE_MODEXP_RESULT = 0x4; - public static final int PHASE_RIPEMD_DATA = 0x3; - public static final int PHASE_RIPEMD_RESULT = 0x4; - public static final int PHASE_SHA2_DATA = 0x1; - public static final int PHASE_SHA2_RESULT = 0x2; - public static final int REFUND_CONST_R_SCLEAR = 0x12c0; - public static final int RLP_ADDR_RECIPE_1 = 0x1; - public static final int RLP_ADDR_RECIPE_2 = 0x2; - public static final int RLP_PREFIX_INT_LONG = 0xb7; - public static final int RLP_PREFIX_INT_SHORT = 0x80; - public static final int RLP_PREFIX_LIST_LONG = 0xf7; - public static final int RLP_PREFIX_LIST_SHORT = 0xc0; - public static final int RLP_RCPT_SUBPHASE_ID_ADDR = 0x35; - public static final int RLP_RCPT_SUBPHASE_ID_CUMUL_GAS = 0x3; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_LIMB = 0x4d; - public static final int RLP_RCPT_SUBPHASE_ID_DATA_SIZE = 0x53; - public static final int RLP_RCPT_SUBPHASE_ID_NO_LOG_ENTRY = 0xb; - public static final int RLP_RCPT_SUBPHASE_ID_STATUS_CODE = 0x2; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_BASE = 0x41; - public static final int RLP_RCPT_SUBPHASE_ID_TOPIC_DELTA = 0x60; - public static final int RLP_RCPT_SUBPHASE_ID_TYPE = 0x7; - public static final int RLP_TXN_PHASE_ACCESS_LIST = 0xb; - public static final int RLP_TXN_PHASE_BETA = 0xc; - public static final int RLP_TXN_PHASE_CHAIN_ID = 0x2; - public static final int RLP_TXN_PHASE_DATA = 0xa; - public static final int RLP_TXN_PHASE_GAS_LIMIT = 0x7; - public static final int RLP_TXN_PHASE_GAS_PRICE = 0x4; - public static final int RLP_TXN_PHASE_MAX_FEE_PER_GAS = 0x6; - public static final int RLP_TXN_PHASE_MAX_PRIORITY_FEE_PER_GAS = 0x5; - public static final int RLP_TXN_PHASE_NONCE = 0x3; - public static final int RLP_TXN_PHASE_R = 0xe; - public static final int RLP_TXN_PHASE_RLP_PREFIX = 0x1; - public static final int RLP_TXN_PHASE_S = 0xf; - public static final int RLP_TXN_PHASE_TO = 0x8; - public static final int RLP_TXN_PHASE_VALUE = 0x9; - public static final int RLP_TXN_PHASE_Y = 0xd; - public static final int TYPE_0_RLP_TXN_PHASE_NUMBER_6 = 0x4; - public static final int TYPE_1_RLP_TXN_PHASE_NUMBER_6 = 0x4; - public static final int TYPE_1_RLP_TXN_PHASE_NUMBER_7 = 0xb; - public static final int TYPE_2_RLP_TXN_PHASE_NUMBER_6 = 0x6; - public static final int TYPE_2_RLP_TXN_PHASE_NUMBER_7 = 0xb; - public static final int WCP_INST_GEQ = 0xe; - public static final int WCP_INST_LEQ = 0xf; - public static final int WORD_SIZE = 0x20; - public static final int WORD_SIZE_MO = 0x1f; - public static final int row_offset___computing_effective_gas_price_comparison = 0x8; - public static final int row_offset___detecting_empty_call_data_comparison = 0x5; - public static final int row_offset___effective_refund_comparison = 0x4; - public static final int row_offset___initial_balance_comparison = 0x1; - public static final int row_offset___max_fee_and_basefee_comparison = 0x6; - public static final int row_offset___max_fee_and_max_priority_fee_comparison = 0x7; - public static final int row_offset___nonce_comparison = 0x0; - public static final int row_offset___sufficient_gas_comparison = 0x2; - public static final int row_offset___upper_limit_refunds_comparison = 0x3; - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer absTxNum; - private final MappedByteBuffer absTxNumMax; - private final MappedByteBuffer argOneLo; - private final MappedByteBuffer argTwoLo; - private final MappedByteBuffer basefee; - private final MappedByteBuffer blockGasLimit; - private final MappedByteBuffer callDataSize; - private final MappedByteBuffer codeFragmentIndex; - private final MappedByteBuffer coinbaseHi; - private final MappedByteBuffer coinbaseLo; - private final MappedByteBuffer copyTxcd; - private final MappedByteBuffer ct; - private final MappedByteBuffer eucFlag; - private final MappedByteBuffer fromHi; - private final MappedByteBuffer fromLo; - private final MappedByteBuffer gasCumulative; - private final MappedByteBuffer gasInitiallyAvailable; - private final MappedByteBuffer gasLeftover; - private final MappedByteBuffer gasLimit; - private final MappedByteBuffer gasPrice; - private final MappedByteBuffer initCodeSize; - private final MappedByteBuffer initialBalance; - private final MappedByteBuffer inst; - private final MappedByteBuffer isDep; - private final MappedByteBuffer isLastTxOfBlock; - private final MappedByteBuffer nonce; - private final MappedByteBuffer outgoingHi; - private final MappedByteBuffer outgoingLo; - private final MappedByteBuffer outgoingRlpTxnrcpt; - private final MappedByteBuffer phaseRlpTxn; - private final MappedByteBuffer phaseRlpTxnrcpt; - private final MappedByteBuffer priorityFeePerGas; - private final MappedByteBuffer refundCounter; - private final MappedByteBuffer refundEffective; - private final MappedByteBuffer relBlock; - private final MappedByteBuffer relTxNum; - private final MappedByteBuffer relTxNumMax; - private final MappedByteBuffer requiresEvmExecution; - private final MappedByteBuffer res; - private final MappedByteBuffer statusCode; - private final MappedByteBuffer toHi; - private final MappedByteBuffer toLo; - private final MappedByteBuffer type0; - private final MappedByteBuffer type1; - private final MappedByteBuffer type2; - private final MappedByteBuffer value; - private final MappedByteBuffer wcpFlag; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("txndata.ABS_TX_NUM", 2, length)); - headers.add(new ColumnHeader("txndata.ABS_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("txndata.ARG_ONE_LO", 16, length)); - headers.add(new ColumnHeader("txndata.ARG_TWO_LO", 16, length)); - headers.add(new ColumnHeader("txndata.BASEFEE", 16, length)); - headers.add(new ColumnHeader("txndata.BLOCK_GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("txndata.CALL_DATA_SIZE", 4, length)); - headers.add(new ColumnHeader("txndata.CODE_FRAGMENT_INDEX", 4, length)); - headers.add(new ColumnHeader("txndata.COINBASE_HI", 4, length)); - headers.add(new ColumnHeader("txndata.COINBASE_LO", 16, length)); - headers.add(new ColumnHeader("txndata.COPY_TXCD", 1, length)); - headers.add(new ColumnHeader("txndata.CT", 1, length)); - headers.add(new ColumnHeader("txndata.EUC_FLAG", 1, length)); - headers.add(new ColumnHeader("txndata.FROM_HI", 4, length)); - headers.add(new ColumnHeader("txndata.FROM_LO", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_CUMULATIVE", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_INITIALLY_AVAILABLE", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_LEFTOVER", 16, length)); - headers.add(new ColumnHeader("txndata.GAS_LIMIT", 8, length)); - headers.add(new ColumnHeader("txndata.GAS_PRICE", 8, length)); - headers.add(new ColumnHeader("txndata.INIT_CODE_SIZE", 4, length)); - headers.add(new ColumnHeader("txndata.INITIAL_BALANCE", 16, length)); - headers.add(new ColumnHeader("txndata.INST", 1, length)); - headers.add(new ColumnHeader("txndata.IS_DEP", 1, length)); - headers.add(new ColumnHeader("txndata.IS_LAST_TX_OF_BLOCK", 1, length)); - headers.add(new ColumnHeader("txndata.NONCE", 8, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_HI", 8, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_LO", 16, length)); - headers.add(new ColumnHeader("txndata.OUTGOING_RLP_TXNRCPT", 16, length)); - headers.add(new ColumnHeader("txndata.PHASE_RLP_TXN", 1, length)); - headers.add(new ColumnHeader("txndata.PHASE_RLP_TXNRCPT", 1, length)); - headers.add(new ColumnHeader("txndata.PRIORITY_FEE_PER_GAS", 16, length)); - headers.add(new ColumnHeader("txndata.REFUND_COUNTER", 16, length)); - headers.add(new ColumnHeader("txndata.REFUND_EFFECTIVE", 16, length)); - headers.add(new ColumnHeader("txndata.REL_BLOCK", 2, length)); - headers.add(new ColumnHeader("txndata.REL_TX_NUM", 2, length)); - headers.add(new ColumnHeader("txndata.REL_TX_NUM_MAX", 2, length)); - headers.add(new ColumnHeader("txndata.REQUIRES_EVM_EXECUTION", 1, length)); - headers.add(new ColumnHeader("txndata.RES", 8, length)); - headers.add(new ColumnHeader("txndata.STATUS_CODE", 1, length)); - headers.add(new ColumnHeader("txndata.TO_HI", 4, length)); - headers.add(new ColumnHeader("txndata.TO_LO", 16, length)); - headers.add(new ColumnHeader("txndata.TYPE0", 1, length)); - headers.add(new ColumnHeader("txndata.TYPE1", 1, length)); - headers.add(new ColumnHeader("txndata.TYPE2", 1, length)); - headers.add(new ColumnHeader("txndata.VALUE", 16, length)); - headers.add(new ColumnHeader("txndata.WCP_FLAG", 1, length)); - return headers; - } - - public Trace (List buffers) { - this.absTxNum = buffers.get(0); - this.absTxNumMax = buffers.get(1); - this.argOneLo = buffers.get(2); - this.argTwoLo = buffers.get(3); - this.basefee = buffers.get(4); - this.blockGasLimit = buffers.get(5); - this.callDataSize = buffers.get(6); - this.codeFragmentIndex = buffers.get(7); - this.coinbaseHi = buffers.get(8); - this.coinbaseLo = buffers.get(9); - this.copyTxcd = buffers.get(10); - this.ct = buffers.get(11); - this.eucFlag = buffers.get(12); - this.fromHi = buffers.get(13); - this.fromLo = buffers.get(14); - this.gasCumulative = buffers.get(15); - this.gasInitiallyAvailable = buffers.get(16); - this.gasLeftover = buffers.get(17); - this.gasLimit = buffers.get(18); - this.gasPrice = buffers.get(19); - this.initCodeSize = buffers.get(20); - this.initialBalance = buffers.get(21); - this.inst = buffers.get(22); - this.isDep = buffers.get(23); - this.isLastTxOfBlock = buffers.get(24); - this.nonce = buffers.get(25); - this.outgoingHi = buffers.get(26); - this.outgoingLo = buffers.get(27); - this.outgoingRlpTxnrcpt = buffers.get(28); - this.phaseRlpTxn = buffers.get(29); - this.phaseRlpTxnrcpt = buffers.get(30); - this.priorityFeePerGas = buffers.get(31); - this.refundCounter = buffers.get(32); - this.refundEffective = buffers.get(33); - this.relBlock = buffers.get(34); - this.relTxNum = buffers.get(35); - this.relTxNumMax = buffers.get(36); - this.requiresEvmExecution = buffers.get(37); - this.res = buffers.get(38); - this.statusCode = buffers.get(39); - this.toHi = buffers.get(40); - this.toLo = buffers.get(41); - this.type0 = buffers.get(42); - this.type1 = buffers.get(43); - this.type2 = buffers.get(44); - this.value = buffers.get(45); - this.wcpFlag = buffers.get(46); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace absTxNum(final long b) { - if (filled.get(0)) { - throw new IllegalStateException("txndata.ABS_TX_NUM already set"); - } else { - filled.set(0); - } - - if(b >= 65536L) { throw new IllegalArgumentException("txndata.ABS_TX_NUM has invalid value (" + b + ")"); } - absTxNum.put((byte) (b >> 8)); - absTxNum.put((byte) b); - - - return this; - } - - public Trace absTxNumMax(final long b) { - if (filled.get(1)) { - throw new IllegalStateException("txndata.ABS_TX_NUM_MAX already set"); - } else { - filled.set(1); - } - - if(b >= 65536L) { throw new IllegalArgumentException("txndata.ABS_TX_NUM_MAX has invalid value (" + b + ")"); } - absTxNumMax.put((byte) (b >> 8)); - absTxNumMax.put((byte) b); - - - return this; - } - - public Trace argOneLo(final Bytes b) { - if (filled.get(2)) { - throw new IllegalStateException("txndata.ARG_ONE_LO already set"); - } else { - filled.set(2); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.ARG_ONE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argOneLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.ARG_TWO_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argTwoLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.BASEFEE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { basefee.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("txndata.BLOCK_GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { blockGasLimit.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("txndata.CALL_DATA_SIZE has invalid value (" + b + ")"); } - callDataSize.put((byte) (b >> 24)); - callDataSize.put((byte) (b >> 16)); - callDataSize.put((byte) (b >> 8)); - callDataSize.put((byte) b); - - - return this; - } - - public Trace codeFragmentIndex(final long b) { - if (filled.get(7)) { - throw new IllegalStateException("txndata.CODE_FRAGMENT_INDEX already set"); - } else { - filled.set(7); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.CODE_FRAGMENT_INDEX has invalid value (" + b + ")"); } - codeFragmentIndex.put((byte) (b >> 24)); - codeFragmentIndex.put((byte) (b >> 16)); - codeFragmentIndex.put((byte) (b >> 8)); - codeFragmentIndex.put((byte) b); - - - return this; - } - - public Trace coinbaseHi(final long b) { - if (filled.get(8)) { - throw new IllegalStateException("txndata.COINBASE_HI already set"); - } else { - filled.set(8); - } - - if(b >= 4294967296L) { throw new IllegalArgumentException("txndata.COINBASE_HI has invalid value (" + b + ")"); } - coinbaseHi.put((byte) (b >> 24)); - coinbaseHi.put((byte) (b >> 16)); - coinbaseHi.put((byte) (b >> 8)); - coinbaseHi.put((byte) b); - - - return this; - } - - public Trace coinbaseLo(final Bytes b) { - if (filled.get(9)) { - throw new IllegalStateException("txndata.COINBASE_LO already set"); - } else { - filled.set(9); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.COINBASE_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { coinbaseLo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("txndata.FROM_HI has invalid value (" + b + ")"); } - fromHi.put((byte) (b >> 24)); - fromHi.put((byte) (b >> 16)); - fromHi.put((byte) (b >> 8)); - fromHi.put((byte) b); - - - return this; - } - - public Trace fromLo(final Bytes b) { - if (filled.get(14)) { - throw new IllegalStateException("txndata.FROM_LO already set"); - } else { - filled.set(14); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.FROM_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { fromLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.GAS_CUMULATIVE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { gasCumulative.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.GAS_INITIALLY_AVAILABLE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { gasInitiallyAvailable.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.GAS_LEFTOVER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { gasLeftover.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("txndata.GAS_LIMIT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasLimit.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("txndata.GAS_PRICE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { gasPrice.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("txndata.INIT_CODE_SIZE has invalid value (" + b + ")"); } - initCodeSize.put((byte) (b >> 24)); - initCodeSize.put((byte) (b >> 16)); - initCodeSize.put((byte) (b >> 8)); - initCodeSize.put((byte) b); - - - return this; - } - - public Trace initialBalance(final Bytes b) { - if (filled.get(20)) { - throw new IllegalStateException("txndata.INITIAL_BALANCE already set"); - } else { - filled.set(20); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.INITIAL_BALANCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { initialBalance.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("txndata.NONCE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { nonce.put((byte) 0); } - // Write bytes - for(int j=0; j 64) { throw new IllegalArgumentException("txndata.OUTGOING_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { outgoingHi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.OUTGOING_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.OUTGOING_RLP_TXNRCPT has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { outgoingRlpTxnrcpt.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.PRIORITY_FEE_PER_GAS has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { priorityFeePerGas.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.REFUND_COUNTER has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { refundCounter.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.REFUND_EFFECTIVE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { refundEffective.put((byte) 0); } - // Write bytes - for(int j=0; j= 65536L) { throw new IllegalArgumentException("txndata.REL_BLOCK has invalid value (" + b + ")"); } - relBlock.put((byte) (b >> 8)); - relBlock.put((byte) b); - - - return this; - } - - public Trace relTxNum(final long b) { - if (filled.get(35)) { - throw new IllegalStateException("txndata.REL_TX_NUM already set"); - } else { - filled.set(35); - } - - if(b >= 65536L) { throw new IllegalArgumentException("txndata.REL_TX_NUM has invalid value (" + b + ")"); } - relTxNum.put((byte) (b >> 8)); - relTxNum.put((byte) b); - - - return this; - } - - public Trace relTxNumMax(final long b) { - if (filled.get(36)) { - throw new IllegalStateException("txndata.REL_TX_NUM_MAX already set"); - } else { - filled.set(36); - } - - if(b >= 65536L) { throw new IllegalArgumentException("txndata.REL_TX_NUM_MAX has invalid value (" + b + ")"); } - relTxNumMax.put((byte) (b >> 8)); - relTxNumMax.put((byte) b); - - - return this; - } - - public Trace requiresEvmExecution(final Boolean b) { - if (filled.get(37)) { - throw new IllegalStateException("txndata.REQUIRES_EVM_EXECUTION already set"); - } else { - filled.set(37); - } - - requiresEvmExecution.put((byte) (b ? 1 : 0)); - - return this; - } - - public Trace res(final Bytes b) { - if (filled.get(38)) { - throw new IllegalStateException("txndata.RES already set"); - } else { - filled.set(38); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 64) { throw new IllegalArgumentException("txndata.RES has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<8; i++) { res.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("txndata.TO_HI has invalid value (" + b + ")"); } - toHi.put((byte) (b >> 24)); - toHi.put((byte) (b >> 16)); - toHi.put((byte) (b >> 8)); - toHi.put((byte) b); - - - return this; - } - - public Trace toLo(final Bytes b) { - if (filled.get(41)) { - throw new IllegalStateException("txndata.TO_LO already set"); - } else { - filled.set(41); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("txndata.TO_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { toLo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("txndata.VALUE has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { value.put((byte) 0); } - // Write bytes - for(int j=0; jAny modifications to this code may be overwritten and could lead to unexpected behavior. - * Please DO NOT ATTEMPT TO MODIFY this code directly. - */ -public class Trace { - - private final BitSet filled = new BitSet(); - private int currentLine = 0; - - private final MappedByteBuffer acc1; - private final MappedByteBuffer acc2; - private final MappedByteBuffer acc3; - private final MappedByteBuffer acc4; - private final MappedByteBuffer acc5; - private final MappedByteBuffer acc6; - private final MappedByteBuffer argument1Hi; - private final MappedByteBuffer argument1Lo; - private final MappedByteBuffer argument2Hi; - private final MappedByteBuffer argument2Lo; - private final MappedByteBuffer bit1; - private final MappedByteBuffer bit2; - private final MappedByteBuffer bit3; - private final MappedByteBuffer bit4; - private final MappedByteBuffer bits; - private final MappedByteBuffer byte1; - private final MappedByteBuffer byte2; - private final MappedByteBuffer byte3; - private final MappedByteBuffer byte4; - private final MappedByteBuffer byte5; - private final MappedByteBuffer byte6; - private final MappedByteBuffer counter; - private final MappedByteBuffer ctMax; - private final MappedByteBuffer inst; - private final MappedByteBuffer isEq; - private final MappedByteBuffer isGeq; - private final MappedByteBuffer isGt; - private final MappedByteBuffer isIszero; - private final MappedByteBuffer isLeq; - private final MappedByteBuffer isLt; - private final MappedByteBuffer isSgt; - private final MappedByteBuffer isSlt; - private final MappedByteBuffer neg1; - private final MappedByteBuffer neg2; - private final MappedByteBuffer oneLineInstruction; - private final MappedByteBuffer result; - private final MappedByteBuffer variableLengthInstruction; - private final MappedByteBuffer wordComparisonStamp; - - static List headers(int length) { - List headers = new ArrayList<>(); - headers.add(new ColumnHeader("wcp.ACC_1", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_2", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_3", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_4", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_5", 16, length)); - headers.add(new ColumnHeader("wcp.ACC_6", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_1_HI", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_1_LO", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_2_HI", 16, length)); - headers.add(new ColumnHeader("wcp.ARGUMENT_2_LO", 16, length)); - headers.add(new ColumnHeader("wcp.BIT_1", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_2", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_3", 1, length)); - headers.add(new ColumnHeader("wcp.BIT_4", 1, length)); - headers.add(new ColumnHeader("wcp.BITS", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_1", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_2", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_3", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_4", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_5", 1, length)); - headers.add(new ColumnHeader("wcp.BYTE_6", 1, length)); - headers.add(new ColumnHeader("wcp.COUNTER", 1, length)); - headers.add(new ColumnHeader("wcp.CT_MAX", 1, length)); - headers.add(new ColumnHeader("wcp.INST", 1, length)); - headers.add(new ColumnHeader("wcp.IS_EQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_GEQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_GT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_ISZERO", 1, length)); - headers.add(new ColumnHeader("wcp.IS_LEQ", 1, length)); - headers.add(new ColumnHeader("wcp.IS_LT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_SGT", 1, length)); - headers.add(new ColumnHeader("wcp.IS_SLT", 1, length)); - headers.add(new ColumnHeader("wcp.NEG_1", 1, length)); - headers.add(new ColumnHeader("wcp.NEG_2", 1, length)); - headers.add(new ColumnHeader("wcp.ONE_LINE_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("wcp.RESULT", 1, length)); - headers.add(new ColumnHeader("wcp.VARIABLE_LENGTH_INSTRUCTION", 1, length)); - headers.add(new ColumnHeader("wcp.WORD_COMPARISON_STAMP", 4, length)); - return headers; - } - - public Trace (List buffers) { - this.acc1 = buffers.get(0); - this.acc2 = buffers.get(1); - this.acc3 = buffers.get(2); - this.acc4 = buffers.get(3); - this.acc5 = buffers.get(4); - this.acc6 = buffers.get(5); - this.argument1Hi = buffers.get(6); - this.argument1Lo = buffers.get(7); - this.argument2Hi = buffers.get(8); - this.argument2Lo = buffers.get(9); - this.bit1 = buffers.get(10); - this.bit2 = buffers.get(11); - this.bit3 = buffers.get(12); - this.bit4 = buffers.get(13); - this.bits = buffers.get(14); - this.byte1 = buffers.get(15); - this.byte2 = buffers.get(16); - this.byte3 = buffers.get(17); - this.byte4 = buffers.get(18); - this.byte5 = buffers.get(19); - this.byte6 = buffers.get(20); - this.counter = buffers.get(21); - this.ctMax = buffers.get(22); - this.inst = buffers.get(23); - this.isEq = buffers.get(24); - this.isGeq = buffers.get(25); - this.isGt = buffers.get(26); - this.isIszero = buffers.get(27); - this.isLeq = buffers.get(28); - this.isLt = buffers.get(29); - this.isSgt = buffers.get(30); - this.isSlt = buffers.get(31); - this.neg1 = buffers.get(32); - this.neg2 = buffers.get(33); - this.oneLineInstruction = buffers.get(34); - this.result = buffers.get(35); - this.variableLengthInstruction = buffers.get(36); - this.wordComparisonStamp = buffers.get(37); - } - - public int size() { - if (!filled.isEmpty()) { - throw new RuntimeException("Cannot measure a trace with a non-validated row."); - } - - return this.currentLine; - } - - public Trace acc1(final Bytes b) { - if (filled.get(0)) { - throw new IllegalStateException("wcp.ACC_1 already set"); - } else { - filled.set(0); - } - - // Trim array to size - Bytes bs = b.trimLeadingZeros(); - // Sanity check against expected width - if(bs.bitLength() > 128) { throw new IllegalArgumentException("wcp.ACC_1 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc1.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ACC_2 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc2.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ACC_3 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc3.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ACC_4 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc4.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ACC_5 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc5.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ACC_6 has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { acc6.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ARGUMENT_1_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument1Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ARGUMENT_1_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument1Lo.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ARGUMENT_2_HI has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument2Hi.put((byte) 0); } - // Write bytes - for(int j=0; j 128) { throw new IllegalArgumentException("wcp.ARGUMENT_2_LO has invalid width (" + bs.bitLength() + "bits)"); } - // Write padding (if necessary) - for(int i=bs.size(); i<16; i++) { argument2Lo.put((byte) 0); } - // Write bytes - for(int j=0; j= 4294967296L) { throw new IllegalArgumentException("wcp.WORD_COMPARISON_STAMP has invalid value (" + b + ")"); } - wordComparisonStamp.put((byte) (b >> 24)); - wordComparisonStamp.put((byte) (b >> 16)); - wordComparisonStamp.put((byte) (b >> 8)); - wordComparisonStamp.put((byte) b); - - - return this; - } - - public Trace validateRow() { - if (!filled.get(0)) { - throw new IllegalStateException("wcp.ACC_1 has not been filled"); - } - - if (!filled.get(1)) { - throw new IllegalStateException("wcp.ACC_2 has not been filled"); - } - - if (!filled.get(2)) { - throw new IllegalStateException("wcp.ACC_3 has not been filled"); - } - - if (!filled.get(3)) { - throw new IllegalStateException("wcp.ACC_4 has not been filled"); - } - - if (!filled.get(4)) { - throw new IllegalStateException("wcp.ACC_5 has not been filled"); - } - - if (!filled.get(5)) { - throw new IllegalStateException("wcp.ACC_6 has not been filled"); - } - - if (!filled.get(6)) { - throw new IllegalStateException("wcp.ARGUMENT_1_HI has not been filled"); - } - - if (!filled.get(7)) { - throw new IllegalStateException("wcp.ARGUMENT_1_LO has not been filled"); - } - - if (!filled.get(8)) { - throw new IllegalStateException("wcp.ARGUMENT_2_HI has not been filled"); - } - - if (!filled.get(9)) { - throw new IllegalStateException("wcp.ARGUMENT_2_LO has not been filled"); - } - - if (!filled.get(11)) { - throw new IllegalStateException("wcp.BIT_1 has not been filled"); - } - - if (!filled.get(12)) { - throw new IllegalStateException("wcp.BIT_2 has not been filled"); - } - - if (!filled.get(13)) { - throw new IllegalStateException("wcp.BIT_3 has not been filled"); - } - - if (!filled.get(14)) { - throw new IllegalStateException("wcp.BIT_4 has not been filled"); - } - - if (!filled.get(10)) { - throw new IllegalStateException("wcp.BITS has not been filled"); - } - - if (!filled.get(15)) { - throw new IllegalStateException("wcp.BYTE_1 has not been filled"); - } - - if (!filled.get(16)) { - throw new IllegalStateException("wcp.BYTE_2 has not been filled"); - } - - if (!filled.get(17)) { - throw new IllegalStateException("wcp.BYTE_3 has not been filled"); - } - - if (!filled.get(18)) { - throw new IllegalStateException("wcp.BYTE_4 has not been filled"); - } - - if (!filled.get(19)) { - throw new IllegalStateException("wcp.BYTE_5 has not been filled"); - } - - if (!filled.get(20)) { - throw new IllegalStateException("wcp.BYTE_6 has not been filled"); - } - - if (!filled.get(21)) { - throw new IllegalStateException("wcp.COUNTER has not been filled"); - } - - if (!filled.get(22)) { - throw new IllegalStateException("wcp.CT_MAX has not been filled"); - } - - if (!filled.get(23)) { - throw new IllegalStateException("wcp.INST has not been filled"); - } - - if (!filled.get(24)) { - throw new IllegalStateException("wcp.IS_EQ has not been filled"); - } - - if (!filled.get(25)) { - throw new IllegalStateException("wcp.IS_GEQ has not been filled"); - } - - if (!filled.get(26)) { - throw new IllegalStateException("wcp.IS_GT has not been filled"); - } - - if (!filled.get(27)) { - throw new IllegalStateException("wcp.IS_ISZERO has not been filled"); - } - - if (!filled.get(28)) { - throw new IllegalStateException("wcp.IS_LEQ has not been filled"); - } - - if (!filled.get(29)) { - throw new IllegalStateException("wcp.IS_LT has not been filled"); - } - - if (!filled.get(30)) { - throw new IllegalStateException("wcp.IS_SGT has not been filled"); - } - - if (!filled.get(31)) { - throw new IllegalStateException("wcp.IS_SLT has not been filled"); - } - - if (!filled.get(32)) { - throw new IllegalStateException("wcp.NEG_1 has not been filled"); - } - - if (!filled.get(33)) { - throw new IllegalStateException("wcp.NEG_2 has not been filled"); - } - - if (!filled.get(34)) { - throw new IllegalStateException("wcp.ONE_LINE_INSTRUCTION has not been filled"); - } - - if (!filled.get(35)) { - throw new IllegalStateException("wcp.RESULT has not been filled"); - } - - if (!filled.get(36)) { - throw new IllegalStateException("wcp.VARIABLE_LENGTH_INSTRUCTION has not been filled"); - } - - if (!filled.get(37)) { - throw new IllegalStateException("wcp.WORD_COMPARISON_STAMP has not been filled"); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public Trace fillAndValidateRow() { - if (!filled.get(0)) { - acc1.position(acc1.position() + 16); - } - - if (!filled.get(1)) { - acc2.position(acc2.position() + 16); - } - - if (!filled.get(2)) { - acc3.position(acc3.position() + 16); - } - - if (!filled.get(3)) { - acc4.position(acc4.position() + 16); - } - - if (!filled.get(4)) { - acc5.position(acc5.position() + 16); - } - - if (!filled.get(5)) { - acc6.position(acc6.position() + 16); - } - - if (!filled.get(6)) { - argument1Hi.position(argument1Hi.position() + 16); - } - - if (!filled.get(7)) { - argument1Lo.position(argument1Lo.position() + 16); - } - - if (!filled.get(8)) { - argument2Hi.position(argument2Hi.position() + 16); - } - - if (!filled.get(9)) { - argument2Lo.position(argument2Lo.position() + 16); - } - - if (!filled.get(11)) { - bit1.position(bit1.position() + 1); - } - - if (!filled.get(12)) { - bit2.position(bit2.position() + 1); - } - - if (!filled.get(13)) { - bit3.position(bit3.position() + 1); - } - - if (!filled.get(14)) { - bit4.position(bit4.position() + 1); - } - - if (!filled.get(10)) { - bits.position(bits.position() + 1); - } - - if (!filled.get(15)) { - byte1.position(byte1.position() + 1); - } - - if (!filled.get(16)) { - byte2.position(byte2.position() + 1); - } - - if (!filled.get(17)) { - byte3.position(byte3.position() + 1); - } - - if (!filled.get(18)) { - byte4.position(byte4.position() + 1); - } - - if (!filled.get(19)) { - byte5.position(byte5.position() + 1); - } - - if (!filled.get(20)) { - byte6.position(byte6.position() + 1); - } - - if (!filled.get(21)) { - counter.position(counter.position() + 1); - } - - if (!filled.get(22)) { - ctMax.position(ctMax.position() + 1); - } - - if (!filled.get(23)) { - inst.position(inst.position() + 1); - } - - if (!filled.get(24)) { - isEq.position(isEq.position() + 1); - } - - if (!filled.get(25)) { - isGeq.position(isGeq.position() + 1); - } - - if (!filled.get(26)) { - isGt.position(isGt.position() + 1); - } - - if (!filled.get(27)) { - isIszero.position(isIszero.position() + 1); - } - - if (!filled.get(28)) { - isLeq.position(isLeq.position() + 1); - } - - if (!filled.get(29)) { - isLt.position(isLt.position() + 1); - } - - if (!filled.get(30)) { - isSgt.position(isSgt.position() + 1); - } - - if (!filled.get(31)) { - isSlt.position(isSlt.position() + 1); - } - - if (!filled.get(32)) { - neg1.position(neg1.position() + 1); - } - - if (!filled.get(33)) { - neg2.position(neg2.position() + 1); - } - - if (!filled.get(34)) { - oneLineInstruction.position(oneLineInstruction.position() + 1); - } - - if (!filled.get(35)) { - result.position(result.position() + 1); - } - - if (!filled.get(36)) { - variableLengthInstruction.position(variableLengthInstruction.position() + 1); - } - - if (!filled.get(37)) { - wordComparisonStamp.position(wordComparisonStamp.position() + 4); - } - - filled.clear(); - this.currentLine++; - - return this; - } - - public void build() { - if (!filled.isEmpty()) { - throw new IllegalStateException("Cannot build trace with a non-validated row."); - } - } -} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java index 61e5ce98a..7a7e160af 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java @@ -16,6 +16,7 @@ import static net.consensys.linea.zktracer.MultiBlockUtils.multiBlocksTest; import static net.consensys.linea.zktracer.module.blockdata.NextGasLimitScenario.*; +import static net.consensys.linea.zktracer.module.blockdata.Trace.*; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; import java.util.ArrayList; @@ -40,7 +41,7 @@ public class GasLimitTest { void legalGasLimitVariationsTest() { Bytes p = BytecodeCompiler.newProgram().push(1).compile(); - long gasLimit = LINEA_GAS_LIMIT_MINIMUM; + long gasLimit = GAS_LIMIT_MINIMUM; multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_SAME))); multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_INCREMENT))); multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MAX))); @@ -52,7 +53,7 @@ void legalGasLimitVariationsTest() { multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MAX))); multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MIN))); - gasLimit = LINEA_GAS_LIMIT_MAXIMUM; + gasLimit = GAS_LIMIT_MAXIMUM; multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_SAME))); multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_DECREMENT))); multiBlocksTest(List.of(p, p), List.of(gasLimit, nextGasLimit(gasLimit, IN_RANGE_MIN))); @@ -83,9 +84,9 @@ private static Stream blockDataVariableGasLimitTestSource() { List.of( 0L, (long) ETHEREUM_GAS_LIMIT_MINIMUM, - (long) LINEA_GAS_LIMIT_MINIMUM, + (long) GAS_LIMIT_MINIMUM, 100_000_000L, - (long) LINEA_GAS_LIMIT_MAXIMUM, + (long) GAS_LIMIT_MAXIMUM, Long.MAX_VALUE); for (Long gasLimit : gasLimits) { for (NextGasLimitScenario scenario : values()) { diff --git a/buildSrc/src/main/groovy/TraceFilesTask.groovy b/buildSrc/src/main/groovy/TraceFilesTask.groovy index cdb046fca..68c7c5986 100644 --- a/buildSrc/src/main/groovy/TraceFilesTask.groovy +++ b/buildSrc/src/main/groovy/TraceFilesTask.groovy @@ -24,7 +24,7 @@ abstract class TraceFilesTask extends Exec { protected void exec() { def arguments = ["besu", "-P", "${moduleDir.getOrElse(module.get()).replaceAll('/','.')}", - "-o", "${project.projectDir}/src/main/java/net/consensys/linea/zktracer/module/${moduleDir.getOrElse(module.get())}", + "-o", "${project.rootDir}/arithmetization/src/main/java/net/consensys/linea/zktracer/module/${moduleDir.getOrElse(module.get())}", "-c", "${className.getOrElse('Trace')}" ] arguments.addAll(files.get().collect({"linea-constraints/${it}"})) diff --git a/gradle/corset.gradle b/gradle/corset.gradle index 8296664e8..c9ff1a184 100644 --- a/gradle/corset.gradle +++ b/gradle/corset.gradle @@ -25,11 +25,16 @@ tasks.register('corsetExists') { } tasks.register('buildZkevmBin', Exec) { -// dependsOn corsetExists workingDir "${project.rootDir}/linea-constraints/" commandLine 'make', 'zkevm.bin' - - //store the output instead of printing to the console + // sanity check target chain + def chain = System.getProperty('blockchain') + // note: null indicates the default (which is Linea). + if(chain != null && chain != "Linea") { + println("*** incorrect target chain (expected 'Linea' was '" + chain + "')\n\n") + assert false + } + // store the output instead of printing to the console standardOutput = new ByteArrayOutputStream() ext.output = { return standardOutput.toString() @@ -37,13 +42,18 @@ tasks.register('buildZkevmBin', Exec) { } tasks.register('buildReferenceTestsZkevmBin', Exec) { -// dependsOn corsetExists workingDir "${project.rootDir}/linea-constraints/" commandLine 'make', 'zkevm_for_reference_tests.bin' - - //store the output instead of printing to the console + // sanity check target chain + def chain = System.getProperty('blockchain') + // + if(chain != "Ethereum") { + println("*** incorrect target chain (expected 'Ethereum' was '" + chain + "')\n\n") + assert false + } + // Store the output instead of printing to the console standardOutput = new ByteArrayOutputStream() ext.output = { return standardOutput.toString() } -} \ No newline at end of file +} diff --git a/gradle/tests.gradle b/gradle/tests.gradle index eeb24be97..185c8d970 100644 --- a/gradle/tests.gradle +++ b/gradle/tests.gradle @@ -42,7 +42,6 @@ apply plugin: 'com.adarshr.test-logger' */ tasks.withType(Test).configureEach { dependsOn 'buildZkevmBin' - dependsOn 'buildTracer' minHeapSize = "4g" maxHeapSize = "8g" diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index 04f89e7fd..64cac5c29 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -34,6 +34,23 @@ tasks.register("hub", TraceFilesTask) { 'hub/columns/storage.lisp', 'hub/columns/transaction.lisp', 'hub/columns/scenario.lisp', 'hub/columns/miscellaneous.lisp'] } +// +// Special case: blockdata - trace file differ between Ethereum and Linea for gas limit purposes +// +tasks.register("blockdataEthereum", TraceFilesTask) { + group "Trace files generation" + dependsOn corsetExists + module = 'blockdata' + files = ['blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/constants-ethereum.lisp'] +} + +tasks.register("blockdataLinea", TraceFilesTask) { + group "Trace files generation" + dependsOn corsetExists + module = 'blockdata' + files = ['blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/constants-linea.lisp'] +} + // // Reference table // @@ -75,7 +92,7 @@ tasks.register('binreftable', TraceFilesTask) { // // Put here modules following the conventional MODULE/columns.lisp, MODULE/constants.lisp naming scheme. // -['mmu', 'blake2fmodexpdata', 'blockdata', 'blockhash', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata'].each {moduleName -> +['mmu', 'blake2fmodexpdata', 'blockhash', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata'].each {moduleName -> tasks.register(moduleName, TraceFilesTask) { group "Trace files generation" dependsOn corsetExists @@ -115,6 +132,8 @@ tasks.register('binreftable', TraceFilesTask) { } } +// Task which generates all Trace.java (and related) files using +// corset. tasks.register('buildTracer') { group "Trace files generation" dependsOn 'add', 'ext', 'mul', 'mod' @@ -123,9 +142,23 @@ tasks.register('buildTracer') { dependsOn 'shfreftable' dependsOn 'binreftable' dependsOn 'bin', 'blockhash', 'euc', 'mmio', 'shf', 'wcp', 'rlptxn', 'rom', 'romlex', 'trm', 'stp', 'loginfo', 'logdata', 'gas' - dependsOn 'mmu', 'blake2fmodexpdata', 'blockdata', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata' + dependsOn 'mmu', 'blake2fmodexpdata', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata' dependsOn 'txndata' dependsOn 'constants' + + def chain = System.getProperty('blockchain') + // Conditional dependsOn + if(chain == null || chain == "Linea") { + print("Building for Linea...\n") + dependsOn 'blockdataLinea' + } else if(chain == "Ethereum") { + dependsOn 'blockdataEthereum' + print("Building for Ethereum...\n") + } else { + // Force build failure if unknown chain. + println("*** unknown target chain. Try '-Dblockchain=Linea' or '-Dblockchain=Ethereum'\n\n") + assert false + } } // Configure default build task to require the tracer is built first. diff --git a/linea-constraints b/linea-constraints index fc69fd62b..9119a9e94 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit fc69fd62bbfe9950ce66694479153d3f7d120aec +Subproject commit 9119a9e94fe32d9e6a40a2a6f5c1f8895eaa1049 diff --git a/plugins/build.gradle b/plugins/build.gradle index a46164671..836299296 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -27,10 +27,6 @@ version = rootProject.version apply from: rootProject.file("gradle/java.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') -//apply from: rootProject.file("gradle/corset.gradle") -//apply from: rootProject.file("gradle/tests.gradle") -//apply from: rootProject.file("gradle/trace-files.gradle") -//apply from: rootProject.file("gradle/build-aliases.gradle") apply from: rootProject.file("gradle/check-licenses.gradle") apply from: rootProject.file("gradle/lint.gradle") diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index e231009a0..5189e0940 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -19,8 +19,7 @@ plugins { apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/java.gradle") -//apply from: rootProject.file("gradle/tests.gradle") -//apply from: rootProject.file("gradle/trace-files.gradle") +apply from: rootProject.file("gradle/trace-files.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') apply from: rootProject.file("gradle/lint.gradle") diff --git a/testing/build.gradle b/testing/build.gradle index b8ae6ca2b..8f01fd55c 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -7,10 +7,7 @@ plugins { id "linea.yul-plugin" } -//apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/java.gradle") -//apply from: rootProject.file("gradle/tests.gradle") -//apply from: rootProject.file("gradle/trace-files.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') apply from: rootProject.file("gradle/lint.gradle") From 291b7b63e61651e263b3b7fc209e0737c548e3bd Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Wed, 15 Jan 2025 10:37:29 +0100 Subject: [PATCH 14/54] 1444 call corner cases testing (#1700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Co-authored-by: Olivier Bégassat <38285177+OlivierBBB@users.noreply.github.com> Co-authored-by: François Bojarski <54240434+letypequividelespoubelles@users.noreply.github.com> --- .../hub/ZeroSizeCallDataOrReturnDataTest.java | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/ZeroSizeCallDataOrReturnDataTest.java diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/ZeroSizeCallDataOrReturnDataTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/ZeroSizeCallDataOrReturnDataTest.java new file mode 100644 index 000000000..1d103c4af --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/ZeroSizeCallDataOrReturnDataTest.java @@ -0,0 +1,107 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.hub; + +import java.util.List; + +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.BytecodeRunner; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; +import org.junit.jupiter.api.Test; + +public class ZeroSizeCallDataOrReturnDataTest { + + @Test + void zeroSizeHugeReturnAtOffsetTest() { + BytecodeCompiler program = BytecodeCompiler.newProgram(); + program + .push(0) // return at capacity + .push("ff".repeat(32)) // return at offset + .push(0) // call data size + .push(0) // call data offset + .push("ca11ee") // address + .push(1000) // gas + .op(OpCode.STATICCALL); + + BytecodeCompiler calleeProgram = BytecodeCompiler.newProgram(); + calleeProgram.op(OpCode.CALLDATASIZE); + + final ToyAccount calleeAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .nonce(10) + .address(Address.fromHexString("ca11ee")) + .code(calleeProgram.compile()) + .build(); + + BytecodeRunner.of(program.compile()).run(Wei.fromEth(1), 30000L, List.of(calleeAccount)); + } + + @Test + void zeroSizeHugeCallDataOffsetTest() { + BytecodeCompiler program = BytecodeCompiler.newProgram(); + program + .push(0) // return at capacity + .push(0) // return at offset + .push(0) // call data size + .push("ff".repeat(32)) // call data offset + .push("ca11ee") // address + .push(1000) // gas + .op(OpCode.STATICCALL); + + BytecodeCompiler calleeProgram = BytecodeCompiler.newProgram(); + calleeProgram.op(OpCode.CALLDATASIZE); + + final ToyAccount calleeAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .nonce(10) + .address(Address.fromHexString("ca11ee")) + .code(calleeProgram.compile()) + .build(); + + BytecodeRunner.of(program.compile()).run(Wei.fromEth(1), 30000L, List.of(calleeAccount)); + } + + @Test + void zeroSizeHugeReturnDataOffsetTest() { + BytecodeCompiler program = BytecodeCompiler.newProgram(); + program + .push(0) // return at capacity + .push(0) // return at offset + .push(0) // call data size + .push(0) // call data offset + .push("ca11ee") // address + .push(1000) // gas + .op(OpCode.STATICCALL); + + BytecodeCompiler calleeProgram = BytecodeCompiler.newProgram(); + calleeProgram.push(0).push("ff".repeat(32)).op(OpCode.RETURN); + + final ToyAccount calleeAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .nonce(10) + .address(Address.fromHexString("ca11ee")) + .code(calleeProgram.compile()) + .build(); + + BytecodeRunner.of(program.compile()).run(Wei.fromEth(1), 30000L, List.of(calleeAccount)); + } +} From 4483ce574713cb4e2f40907201b9d2ebaae1c59a Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 16 Jan 2025 01:52:28 +1300 Subject: [PATCH 15/54] feat: update to delivery-25.1-develop-1be83c5 (#1694) --- .../linea/blockcapture/BlockCapturer.java | 2 +- .../snapshots/ConflationSnapshot.java | 5 +++-- .../zktracer/ConflationAwareOperationTracer.java | 10 ++++------ .../net/consensys/linea/zktracer/ZkTracer.java | 15 +++------------ .../linea/zktracer/container/module/Module.java | 4 +++- .../zktracer/module/blockhash/Blockhash.java | 4 +++- .../linea/zktracer/module/blockhash/Trace.java | 0 .../consensys/linea/zktracer/module/hub/Hub.java | 10 +++++----- .../zktracer/module/hub/transients/Block.java | 5 +++-- .../linea/zktracer/module/txndata/TxnData.java | 4 +++- gradle.properties | 2 +- gradle/gradle-daemon-jvm.properties | 2 ++ linea-constraints | 2 +- .../linea/BlockchainReferenceTestTools.java | 2 +- .../net/consensys/linea/CorsetBlockProcessor.java | 8 ++++---- .../linea/GeneralStateReferenceTestTools.java | 6 +++--- .../linea/testing/ExecutionEnvironment.java | 7 ++++--- .../testing/GeneralStateReferenceTestTools.java | 6 +++--- .../linea/testing/ReplayExecutionEnvironment.java | 14 ++++++++------ .../linea/testing/ToyExecutionEnvironmentV2.java | 2 ++ 20 files changed, 57 insertions(+), 53 deletions(-) create mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java create mode 100644 gradle/gradle-daemon-jvm.properties diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java index 75bb81401..17548d9f6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java @@ -173,7 +173,7 @@ public void tracePreExecution(MessageFrame frame) { // Sanity check block within last 256 blocks. if (blockNumber < currentBlockNumber && (currentBlockNumber - blockNumber) <= 256) { // Use enclosing frame to determine hash - Hash blockHash = frame.getBlockHashLookup().apply(blockNumber); + Hash blockHash = frame.getBlockHashLookup().apply(frame, blockNumber); // Record it was seen this.reaper.touchBlockHash(blockNumber, blockHash); } diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/snapshots/ConflationSnapshot.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/snapshots/ConflationSnapshot.java index 142c04ceb..7c436f2f0 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/snapshots/ConflationSnapshot.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/snapshots/ConflationSnapshot.java @@ -20,7 +20,8 @@ import java.util.Map; import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.evm.operation.BlockHashOperation.BlockHashLookup; +import org.hyperledger.besu.evm.blockhash.BlockHashLookup; +import org.hyperledger.besu.evm.frame.MessageFrame; /** * Contain the minimal set of information to replay a conflation as a unit test without requiring @@ -64,7 +65,7 @@ private static class BlockHashMap implements BlockHashLookup { private final Map blockHashCache = new HashMap<>(); @Override - public Hash apply(Long blockNumber) { + public Hash apply(MessageFrame frame, Long blockNumber) { // Sanity check we found the hash if (!this.blockHashCache.containsKey(blockNumber)) { // Missing for some reason diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java index a2609cbce..01fc47f79 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java @@ -80,12 +80,10 @@ public void traceEndConflation(WorldView state) { this.tracers.forEach(tracer -> tracer.traceEndConflation(state)); } - public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody) { - this.tracers.forEach(tracer -> tracer.traceStartBlock(blockHeader, blockBody)); - } - - public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) { - this.tracers.forEach(tracer -> tracer.traceStartBlock(processableBlockHeader)); + public void traceStartBlock( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { + this.tracers.forEach( + tracer -> tracer.traceStartBlock(processableBlockHeader, miningBeneficiary)); } public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java index 7d43e5240..0edc2be74 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java @@ -173,25 +173,16 @@ public void traceEndConflation(final WorldView state) { } @Override - public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) { + public void traceStartBlock( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { try { - this.hub.traceStartBlock(processableBlockHeader); + this.hub.traceStartBlock(processableBlockHeader, miningBeneficiary); this.debugMode.ifPresent(DebugMode::traceEndConflation); } catch (final Exception e) { this.tracingExceptions.add(e); } } - @Override - public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody) { - try { - this.hub.traceStartBlock(blockHeader); - this.debugMode.ifPresent(x -> x.traceStartBlock(blockHeader, blockBody)); - } catch (final Exception e) { - this.tracingExceptions.add(e); - } - } - @Override public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { try { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/container/module/Module.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/container/module/Module.java index 823e3b3bb..230d860d4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/container/module/Module.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/container/module/Module.java @@ -20,6 +20,7 @@ import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.worldstate.WorldView; import org.hyperledger.besu.plugin.data.BlockBody; @@ -33,7 +34,8 @@ default void traceStartConflation(final long blockCount) {} default void traceEndConflation(final WorldView state) {} - default void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {} + default void traceStartBlock( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {} default void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) {} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java index 00a7b5930..7ce39c801 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java @@ -32,6 +32,7 @@ import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes32; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.operation.Operation; import org.hyperledger.besu.evm.worldstate.WorldView; @@ -67,7 +68,8 @@ public String moduleKey() { } @Override - public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) { + public void traceStartBlock( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { relBlock += 1; absBlock = processableBlockHeader.getNumber(); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java new file mode 100644 index 000000000..e69de29bb diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index b923ddcac..cc8d20533 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -473,12 +473,14 @@ public void traceEndConflation(final WorldView world) { } @Override - public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) { + public void traceStartBlock( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { + this.coinbaseAddress = miningBeneficiary; state.firstAndLastStorageSlotOccurrences.add(new HashMap<>()); - this.transients().block().update(processableBlockHeader); + this.transients().block().update(processableBlockHeader, miningBeneficiary); txStack.resetBlock(); for (Module m : modules) { - m.traceStartBlock(processableBlockHeader); + m.traceStartBlock(processableBlockHeader, miningBeneficiary); } } @@ -499,7 +501,6 @@ public void traceStartTransaction(final WorldView world, final Transaction tx) { if (!transactionProcessingMetadata.requiresEvmExecution()) { state.setProcessingPhase(TX_SKIP); - Address coinbaseAddress = Address.fromHexString("8f81e2e3f8b46467523463835f965ffe476e1c9e"); new TxSkipSection(this, world, transactionProcessingMetadata, transients); } else { if (transactionProcessingMetadata.requiresPrewarming()) { @@ -552,7 +553,6 @@ public void traceContextEnter(MessageFrame frame) { // root and transaction call data context's if (frame.getDepth() == 0) { - coinbaseAddress = frame.getMiningBeneficiary(); if (state.getProcessingPhase() == TX_SKIP) { checkState(currentTraceSection() instanceof TxSkipSection); ((TxSkipSection) currentTraceSection()).coinbaseSnapshots(this, frame); diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/Block.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/Block.java index f9274a50b..16a711aa0 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/Block.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/Block.java @@ -34,9 +34,10 @@ public class Block { * * @param processableBlockHeader the processable block header */ - public void update(final ProcessableBlockHeader processableBlockHeader) { + public void update( + final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { this.blockNumber++; - this.coinbaseAddress = processableBlockHeader.getCoinbase(); + this.coinbaseAddress = miningBeneficiary; this.baseFee = Wei.fromQuantity(processableBlockHeader.getBaseFee().orElseThrow()); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java index ef66f25cf..0473abb76 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java @@ -29,6 +29,7 @@ import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.plugin.data.BlockBody; import org.hyperledger.besu.plugin.data.BlockHeader; import org.hyperledger.besu.plugin.data.ProcessableBlockHeader; @@ -57,7 +58,8 @@ public void traceStartConflation(final long blockCount) { } @Override - public final void traceStartBlock(final ProcessableBlockHeader blockHeader) { + public final void traceStartBlock( + final ProcessableBlockHeader blockHeader, final Address miningBeneficiary) { blocks.add(new BlockSnapshot(blockHeader)); } diff --git a/gradle.properties b/gradle.properties index f6f87cceb..0fa57a119 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=0.8.0-rc8 -besuVersion=24.12-delivery41 +besuVersion=25.1-delivery42 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 000000000..63e5bbdf4 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,2 @@ +#This file is generated by updateDaemonJvm +toolchainVersion=21 diff --git a/linea-constraints b/linea-constraints index 9119a9e94..b2730fcaf 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 9119a9e94fe32d9e6a40a2a6f5c1f8895eaa1049 +Subproject commit b2730fcaf1e9ae339471bbec8d43f302ad73d371 diff --git a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java index c06511e3c..31075c397 100644 --- a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java @@ -400,7 +400,7 @@ public static void executeTest(final BlockchainReferenceTestCaseSpec spec) { try { final Block block = candidateBlock.getBlock(); - zkTracer.traceStartBlock(block.getHeader()); + zkTracer.traceStartBlock(block.getHeader(), block.getHeader().getCoinbase()); final ProtocolSpec protocolSpec = schedule.getByBlockHeader(block.getHeader()); diff --git a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java index fb7f5e740..27bdf1a53 100644 --- a/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java +++ b/reference-tests/src/test/java/net/consensys/linea/CorsetBlockProcessor.java @@ -40,8 +40,8 @@ import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldState; import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.worldview.BonsaiWorldStateUpdateAccumulator; -import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup; -import org.hyperledger.besu.evm.operation.BlockHashOperation; +import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup; +import org.hyperledger.besu.evm.blockhash.BlockHashLookup; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @Slf4j @@ -96,8 +96,8 @@ public BlockProcessingResult processBlock( final WorldUpdater worldStateUpdater = worldState.updater(); - final BlockHashOperation.BlockHashLookup blockHashLookup = - new CachingBlockHashLookup(blockHeader, blockchain); + final BlockHashLookup blockHashLookup = + new BlockchainBasedBlockHashLookup(blockHeader, blockchain); final Address miningBeneficiary = miningBeneficiaryCalculator.calculateBeneficiary(blockHeader); diff --git a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java index 1eb422edd..c3e9058b2 100644 --- a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java @@ -43,7 +43,7 @@ import org.hyperledger.besu.ethereum.referencetests.ReferenceTestProtocolSchedules; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState; import org.hyperledger.besu.ethereum.rlp.RLP; -import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup; +import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.log.Log; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -178,7 +178,7 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) { final ZkTracer zkTracer = new ZkTracer(); zkTracer.traceStartConflation(1); - zkTracer.traceStartBlock(blockHeader, blockBody); + zkTracer.traceStartBlock(blockHeader, blockHeader.getCoinbase()); final TransactionProcessingResult result = processor.processTransaction( @@ -187,7 +187,7 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) { transaction, blockHeader.getCoinbase(), zkTracer, - new CachingBlockHashLookup(blockHeader, blockchain), + new BlockchainBasedBlockHashLookup(blockHeader, blockchain), false, TransactionValidationParams.processingBlock(), blobGasPrice); diff --git a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java index 9cf635ec5..3916c1878 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java @@ -28,7 +28,7 @@ import net.consensys.linea.corset.CorsetValidator; import net.consensys.linea.zktracer.ZkTracer; import org.apache.tuweni.bytes.Bytes32; -import org.hyperledger.besu.config.GenesisConfigFile; +import org.hyperledger.besu.config.GenesisConfig; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.consensus.clique.CliqueBlockHeaderFunctions; import org.hyperledger.besu.consensus.clique.CliqueForksSchedulesFactory; @@ -57,14 +57,15 @@ public class ExecutionEnvironment { public static final String CORSET_VALIDATION_RESULT = "Corset validation result: "; - static GenesisConfigFile GENESIS_CONFIG = - GenesisConfigFile.fromSource(GenesisConfigFile.class.getResource("/linea.json")); + static GenesisConfig GENESIS_CONFIG = + GenesisConfig.fromSource(GenesisConfig.class.getResource("/linea.json")); static final BlockHeaderBuilder DEFAULT_BLOCK_HEADER_BUILDER = BlockHeaderBuilder.createDefault() .number(ToyExecutionEnvironmentV2.DEFAULT_BLOCK_NUMBER) .timestamp(123456789) .parentHash(Hash.EMPTY_TRIE_HASH) + .baseFee(ToyExecutionEnvironmentV2.DEFAULT_BASE_FEE) .nonce(0) .blockHeaderFunctions(new CliqueBlockHeaderFunctions()); diff --git a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java index a48f8302c..d9cbd9743 100644 --- a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java +++ b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java @@ -40,7 +40,7 @@ import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState; import org.hyperledger.besu.ethereum.rlp.RLP; -import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup; +import org.hyperledger.besu.ethereum.vm.BlockchainBasedBlockHashLookup; import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.log.Log; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -93,7 +93,7 @@ public static void executeTest( .blobGasPricePerGas(blockHeader.getExcessBlobGas().orElse(BlobGas.ZERO)); tracer.traceStartConflation(1); - tracer.traceStartBlock(blockHeader, blockBody); + tracer.traceStartBlock(blockHeader, blockHeader.getCoinbase()); TransactionProcessingResult result = null; for (Transaction transaction : blockBody.getTransactions()) { // Several of the GeneralStateTests check if the transaction could potentially @@ -111,7 +111,7 @@ public static void executeTest( transaction, blockHeader.getCoinbase(), tracer, - new CachingBlockHashLookup(blockHeader, blockchain), + new BlockchainBasedBlockHashLookup(blockHeader, blockchain), false, TransactionValidationParams.processingBlock(), blobGasPrice); diff --git a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java index 294ff5fd7..f2c3cdfa0 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java @@ -49,9 +49,9 @@ import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState; import org.hyperledger.besu.evm.account.MutableAccount; +import org.hyperledger.besu.evm.blockhash.BlockHashLookup; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.internal.Words; -import org.hyperledger.besu.evm.operation.BlockHashOperation; import org.hyperledger.besu.evm.tracing.OperationTracer; import org.hyperledger.besu.evm.worldstate.WorldUpdater; @@ -187,7 +187,7 @@ private static void executeFrom( final boolean txResultChecking, final boolean useCoinbaseAddressFromBlockHeader, final TransactionProcessingResultValidator resultValidator) { - BlockHashOperation.BlockHashLookup blockHashLookup = conflation.toBlockHashLookup(); + BlockHashLookup blockHashLookup = conflation.toBlockHashLookup(); // Initialise world state from conflation MutableWorldState world = initWorld(conflation); // Construct the transaction processor @@ -203,7 +203,11 @@ private static void executeFrom( new BlockBody( blockSnapshot.txs().stream().map(TransactionSnapshot::toTransaction).toList(), new ArrayList<>()); - tracer.traceStartBlock(header, body); + final Address miningBeneficiary = + useCoinbaseAddressFromBlockHeader + ? header.getCoinbase() + : CliqueHelpers.getProposerOfBlock(header); + tracer.traceStartBlock(header, miningBeneficiary); for (TransactionSnapshot txs : blockSnapshot.txs()) { final Transaction tx = txs.toTransaction(); @@ -214,9 +218,7 @@ private static void executeFrom( updater, header, tx, - useCoinbaseAddressFromBlockHeader - ? header.getCoinbase() - : CliqueHelpers.getProposerOfBlock(header), + miningBeneficiary, buildOperationTracer(tx, txs.getOutcome(), tracer, txResultChecking), blockHashLookup, false, diff --git a/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java b/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java index b9240ef27..f90ced979 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java +++ b/testing/src/main/java/net/consensys/linea/testing/ToyExecutionEnvironmentV2.java @@ -47,6 +47,7 @@ public class ToyExecutionEnvironmentV2 { @Builder.Default private final List accounts = Collections.emptyList(); @Builder.Default private final Address coinbase = DEFAULT_COINBASE_ADDRESS; + @Builder.Default public static final Wei DEFAULT_BASE_FEE = Wei.of(7); @Singular private final List transactions; @@ -98,6 +99,7 @@ public GeneralStateTestCaseEipSpec buildGeneralStateTestCaseSpec(ProtocolSpec pr .coinbase(coinbase) .timestamp(DEFAULT_TIME_STAMP) .parentHash(DEFAULT_HASH) + .baseFee(DEFAULT_BASE_FEE) .buildBlockHeader(); List> txSuppliers = new ArrayList<>(); From e10ee3d350adc102599ef7c2d1c7a7ef6eeec8c4 Mon Sep 17 00:00:00 2001 From: amkCha <29160563+amkCha@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:51:24 +0100 Subject: [PATCH 16/54] Feat/multi transaction with create tests (#1615) --- .../failure/CreateInducedFailureTest.java | 82 +++++++++---------- .../GeneralStateReferenceTestTools.java | 2 +- .../consensys/linea/testing/ToyAccount.java | 5 -- .../linea/testing/ToyMultiTransaction.java | 47 +++++++++++ .../linea/testing/ToyTransaction.java | 5 +- 5 files changed, 88 insertions(+), 53 deletions(-) create mode 100644 testing/src/main/java/net/consensys/linea/testing/ToyMultiTransaction.java diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/createTests/failure/CreateInducedFailureTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/createTests/failure/CreateInducedFailureTest.java index d70407351..dd246c1bf 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/createTests/failure/CreateInducedFailureTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/createTests/failure/CreateInducedFailureTest.java @@ -14,6 +14,7 @@ */ package net.consensys.linea.zktracer.instructionprocessing.createTests.failure; +import static net.consensys.linea.testing.ToyTransaction.ToyTransactionBuilder; import static net.consensys.linea.zktracer.instructionprocessing.createTests.trivial.RootLevel.salt01; import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.keyPair; import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.userAccount; @@ -27,6 +28,7 @@ import net.consensys.linea.testing.BytecodeCompiler; import net.consensys.linea.testing.ToyAccount; import net.consensys.linea.testing.ToyExecutionEnvironmentV2; +import net.consensys.linea.testing.ToyMultiTransaction; import net.consensys.linea.testing.ToyTransaction; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Address; @@ -41,26 +43,27 @@ * *

- we start with an account {@link #entryPoint}; * - *

- in {@link #transactionDeployingDelegateCaller} we call {@link #entryPoint} with empty call - * data which leads to the deployment of {@link #delegateCaller}; + *

- in {@link #transactionBuilderDeployingDelegateCaller} we call {@link #entryPoint} with empty + * call data which leads to the deployment of {@link #delegateCaller}; * - *

- in {@link #transactionLeadingDelegateCallerToCreateAnAccount} we call {@link #entryPoint} - * with nonempty call data which leads it calling {@link #delegateCaller} which leads to it doing a - * DELEGATECALL to {@link #simpleCreator} thus deploying a new account with {@link - * #delegateCaller}'s nonce =1; + *

- in {@link #transactionBuilderLeadingDelegateCallerToCreateAnAccount} we call {@link + * #entryPoint} with nonempty call data which leads it calling {@link #delegateCaller} which leads + * to it doing a DELEGATECALL to {@link #simpleCreator} thus deploying a new account with + * {@link #delegateCaller}'s nonce =1; * - *

- in {@link #transactionLeadingDelegateCallerToSelfDestruct} we call {@link #entryPoint} with - * nonempty call data which leads it calling {@link #delegateCaller} which leads to it doing a - * DELEGATECALL to {@link #simpleSelfDestructor} self destructing; + *

- in {@link #transactionBuilderLeadingDelegateCallerToSelfDestruct} we call {@link + * #entryPoint} with nonempty call data which leads it calling {@link #delegateCaller} which leads + * to it doing a DELEGATECALL to {@link #simpleSelfDestructor} self destructing; * - *

- in {@link #transactionDeployingDelegateCallerAgain} we call {@link #entryPoint} with empty - * call data again which leads to the deployment of {@link #delegateCaller} again; + *

- in {@link #transactionBuilderDeployingDelegateCallerAgain} we call {@link #entryPoint} with + * empty call data again which leads to the deployment of {@link #delegateCaller} again; * - *

- in {@link #transactionLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF} - * we call {@link #entryPoint} with nonempty call data which leads it calling {@link - * #delegateCaller} which leads to it doing a DELEGATECALL to {@link #simpleCreator} thus - * attempting to redeploy at the same address where it did the first deployment; indeed - * {@link #delegateCaller}'s nonce is again =1; deploying a new account at nonce 1; + *

- in {@link + * #transactionBuilderLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF} we call + * {@link #entryPoint} with nonempty call data which leads it calling {@link #delegateCaller} which + * leads to it doing a DELEGATECALL to {@link #simpleCreator} thus attempting to + * redeploy at the same address where it did the first deployment; indeed {@link #delegateCaller}'s + * nonce is again =1; deploying a new account at nonce 1; */ @ExtendWith(UnitTestWatcher.class) public class CreateInducedFailureTest { @@ -201,67 +204,60 @@ public class CreateInducedFailureTest { .address(targetAddress) .build(); - final Transaction transactionDeployingDelegateCaller = + final ToyTransactionBuilder transactionBuilderDeployingDelegateCaller = ToyTransaction.builder() - .sender(userAccount) .to(entryPoint) .keyPair(keyPair) .value(Wei.of(0xffff)) .gasLimit(1_000_000L) - .gasPrice(Wei.of(8)) - .build(); + .gasPrice(Wei.of(8)); - final Transaction transactionLeadingDelegateCallerToCreateAnAccount = + final ToyTransactionBuilder transactionBuilderLeadingDelegateCallerToCreateAnAccount = ToyTransaction.builder() - .sender(userAccount.raiseNonceBy(1)) .to(entryPoint) .keyPair(keyPair) .value(Wei.of(0xeeee)) .gasLimit(1_000_000L) .gasPrice(Wei.of(8)) - .payload(leftPaddedAddress1) - .build(); + .payload(leftPaddedAddress1); - final Transaction transactionLeadingDelegateCallerToSelfDestruct = + final ToyTransactionBuilder transactionBuilderLeadingDelegateCallerToSelfDestruct = ToyTransaction.builder() - .sender(userAccount.raiseNonceBy(2)) .to(entryPoint) .keyPair(keyPair) .value(Wei.of(0xdddd)) .gasLimit(1_000_000L) .gasPrice(Wei.of(8)) - .payload(leftPaddedAddress2) - .build(); + .payload(leftPaddedAddress2); - final Transaction transactionDeployingDelegateCallerAgain = + final ToyTransactionBuilder transactionBuilderDeployingDelegateCallerAgain = ToyTransaction.builder() - .sender(userAccount.raiseNonceBy(3)) .to(entryPoint) .keyPair(keyPair) .value(Wei.of(0xcccc)) .gasLimit(1_000_000L) - .gasPrice(Wei.of(8)) - .build(); + .gasPrice(Wei.of(8)); - final Transaction - transactionLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF = + final ToyTransactionBuilder + transactionBuilderLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF = ToyTransaction.builder() - .sender(userAccount.raiseNonceBy(4)) .to(entryPoint) .keyPair(keyPair) .value(Wei.of(0xbbbb)) .gasLimit(1_000_000L) .gasPrice(Wei.of(8)) - .payload(leftPaddedAddress1) - .build(); + .payload(leftPaddedAddress1); + + final ToyTransactionBuilder[] toyTransactionBuilders = { + transactionBuilderDeployingDelegateCaller, + transactionBuilderLeadingDelegateCallerToCreateAnAccount, + transactionBuilderLeadingDelegateCallerToSelfDestruct, + transactionBuilderDeployingDelegateCallerAgain, + transactionBuilderLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF + }; final List transactions = - List.of( - transactionDeployingDelegateCaller, - transactionLeadingDelegateCallerToCreateAnAccount, - transactionLeadingDelegateCallerToSelfDestruct, - transactionDeployingDelegateCallerAgain, - transactionLeadingDelegateCallerToAttemptCreateAgainThusRaisingFailureConditionF); + ToyMultiTransaction.builder().build(toyTransactionBuilders, userAccount); final List accounts = List.of(userAccount, entryPoint, simpleSelfDestructor, simpleCreator); diff --git a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java index d9cbd9743..772a816b0 100644 --- a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java +++ b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java @@ -126,6 +126,7 @@ public static void executeTest( transactionProcessingResultValidator.accept(transaction, result); zkTracerValidator.accept(tracer); + worldStateUpdater.commit(); } tracer.traceEndBlock(blockHeader, blockBody); @@ -139,7 +140,6 @@ public static void executeTest( if (coinbase != null && coinbase.isEmpty() && shouldClearEmptyAccounts(spec.getFork())) { worldStateUpdater.deleteAccount(coinbase.getAddress()); } - worldStateUpdater.commit(); worldState.persist(blockHeader); // Check the world state root hash. diff --git a/testing/src/main/java/net/consensys/linea/testing/ToyAccount.java b/testing/src/main/java/net/consensys/linea/testing/ToyAccount.java index c6d0b5eee..d66bf1c0b 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ToyAccount.java +++ b/testing/src/main/java/net/consensys/linea/testing/ToyAccount.java @@ -202,9 +202,4 @@ public ReferenceTestWorldState.AccountMock toAccountMock() { return new ReferenceTestWorldState.AccountMock( Long.toHexString(nonce), balance.toHexString(), accountMockStorage, code.toHexString()); } - - public ToyAccount raiseNonceBy(long k) { - long updatedNonce = this.getNonce() + k; - return new ToyAccount(this.parent, this.getAddress(), updatedNonce, this.balance, this.balance); - } } diff --git a/testing/src/main/java/net/consensys/linea/testing/ToyMultiTransaction.java b/testing/src/main/java/net/consensys/linea/testing/ToyMultiTransaction.java new file mode 100644 index 000000000..9a91a155a --- /dev/null +++ b/testing/src/main/java/net/consensys/linea/testing/ToyMultiTransaction.java @@ -0,0 +1,47 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.testing; + +import java.util.ArrayList; +import java.util.List; + +import lombok.Builder; +import net.consensys.linea.testing.ToyTransaction.ToyTransactionBuilder; +import org.hyperledger.besu.ethereum.core.Transaction; + +@Builder +public class ToyMultiTransaction { + + /** Customizations applied to the Lombok generated builder. */ + public static class ToyMultiTransactionBuilder { + + /** + * Builder method returning an instance of {@link List}. + * + * @return an instance of {@link List} + */ + public List build( + ToyTransactionBuilder[] toyTxBuilders, ToyAccount senderAccount) { + long senderAccountNonce = senderAccount.getNonce(); + List results = new ArrayList<>(); + for (ToyTransactionBuilder toyTxBuilder : toyTxBuilders) { + results.add(toyTxBuilder.nonce(senderAccountNonce).build()); + senderAccountNonce++; + } + return results; + } + } +} diff --git a/testing/src/main/java/net/consensys/linea/testing/ToyTransaction.java b/testing/src/main/java/net/consensys/linea/testing/ToyTransaction.java index 3e4610c97..4d2073954 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ToyTransaction.java +++ b/testing/src/main/java/net/consensys/linea/testing/ToyTransaction.java @@ -23,10 +23,7 @@ import lombok.Builder; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.crypto.KeyPair; -import org.hyperledger.besu.datatypes.AccessListEntry; -import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.datatypes.TransactionType; -import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.datatypes.*; import org.hyperledger.besu.ethereum.core.Transaction; @Builder From 2c0173f5d40b65c62467f76aed621de4a7df39db Mon Sep 17 00:00:00 2001 From: FlorianHuc Date: Wed, 15 Jan 2025 18:02:49 +0100 Subject: [PATCH 17/54] init chain id in zktracer. (#1702) --- .../rpc/batchlinecount/ConflatedCountTracesV2.java | 7 ++++++- .../plugins/rpc/linecounts/GenerateLineCountsV2.java | 8 +++++++- .../rpc/tracegeneration/GenerateConflatedTracesV2.java | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/batchlinecount/ConflatedCountTracesV2.java b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/batchlinecount/ConflatedCountTracesV2.java index ea176af3f..da83464c3 100644 --- a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/batchlinecount/ConflatedCountTracesV2.java +++ b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/batchlinecount/ConflatedCountTracesV2.java @@ -28,6 +28,7 @@ import net.consensys.linea.zktracer.ZkTracer; import net.consensys.linea.zktracer.json.JsonConverter; import org.hyperledger.besu.plugin.ServiceManager; +import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.TraceService; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; @@ -85,7 +86,11 @@ private ConflatedLineCounts countConflation(PluginRpcRequest request) { final long fromBlock = params.startBlockNumber(); final long toBlock = params.endBlockNumber(); - final ZkTracer tracer = new ZkTracer(); + final ZkTracer tracer = + new ZkTracer( + BesuServiceProvider.getBesuService(besuContext, BlockchainService.class) + .getChainId() + .orElseThrow()); traceService.trace( fromBlock, diff --git a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/linecounts/GenerateLineCountsV2.java b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/linecounts/GenerateLineCountsV2.java index e2dd0731b..f97038c37 100644 --- a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/linecounts/GenerateLineCountsV2.java +++ b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/linecounts/GenerateLineCountsV2.java @@ -28,6 +28,7 @@ import net.consensys.linea.zktracer.ZkTracer; import net.consensys.linea.zktracer.json.JsonConverter; import org.hyperledger.besu.plugin.ServiceManager; +import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.TraceService; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; @@ -97,7 +98,12 @@ private LineCounts getLineCounts(PluginRpcRequest request) { .computeIfAbsent( requestedBlockNumber, blockNumber -> { - final ZkTracer tracer = new ZkTracer(); + final ZkTracer tracer = + new ZkTracer( + BesuServiceProvider.getBesuService( + besuContext, BlockchainService.class) + .getChainId() + .orElseThrow()); traceService.trace( blockNumber, blockNumber, diff --git a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/tracegeneration/GenerateConflatedTracesV2.java b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/tracegeneration/GenerateConflatedTracesV2.java index 200bc5f27..b0e605972 100644 --- a/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/tracegeneration/GenerateConflatedTracesV2.java +++ b/arithmetization/src/main/java/net/consensys/linea/plugins/rpc/tracegeneration/GenerateConflatedTracesV2.java @@ -28,6 +28,7 @@ import net.consensys.linea.zktracer.ZkTracer; import net.consensys.linea.zktracer.json.JsonConverter; import org.hyperledger.besu.plugin.ServiceManager; +import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.TraceService; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; @@ -91,7 +92,11 @@ private TraceFile generateTraceFile(PluginRpcRequest request) { final long fromBlock = params.startBlockNumber(); final long toBlock = params.endBlockNumber(); - final ZkTracer tracer = new ZkTracer(); + final ZkTracer tracer = + new ZkTracer( + BesuServiceProvider.getBesuService(besuContext, BlockchainService.class) + .getChainId() + .orElseThrow()); final TraceWriter traceWriter = new TraceWriter(tracer); traceService.trace( From bbdde9e94adcc33b3d94532439000331a6eb2055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:37:01 +0100 Subject: [PATCH 18/54] Fix: ignore `Trace.java` files and `GlobalConstants.java` + recognize 'beta*' as release tag (#1703) --- .github/workflows/release.yml | 1 + .gitignore | 2 ++ .../net/consensys/linea/zktracer/module/blockhash/Trace.java | 0 3 files changed, 3 insertions(+) delete mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc4595209..9d2fafdca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*' + - 'beta*' jobs: build: diff --git a/.gitignore b/.gitignore index 3aa3d826c..5acaa3683 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ reference-tests/src/test/java/net/consensys/linea/generated/* arithmetization/bin/ acceptance-tests/bin/ reference-tests/bin/ +**/*Trace.java +**/*GlobalConstants.java diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Trace.java deleted file mode 100644 index e69de29bb..000000000 From 681d172c23e29f7d5e8f2b9822b4615a579d33fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Wed, 15 Jan 2025 20:26:58 +0100 Subject: [PATCH 19/54] release: bump version to beta-v1.2.0-rc0 and updated CHANGELOG.md (#1704) --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdba8e1f1..e6e77c165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ # Changelog +## beta-v1.2.0-rc0 +* Fix: ignore `Trace.java` files and `GlobalConstants.java` + recognize 'beta*' as release tag (#1703) +* init chain id in zktracer. (#1702) +* Feat/multi transaction with create tests (#1615) +* feat: update to delivery-25.1-develop-1be83c5 (#1694) +* 1444 call corner cases testing (#1700) +* Feat/blockdata unique gas limit constant (#1699) +* support default filter for cron job (#1698) +* CHANGED - use github actions concurrency to reduce outdated runs (#1691) +* feat: always rebuild `Trace.java` files (#1696) +* 1679 blockhash update (#1681) +* fix: constraints update --- back to master (#1687) +* Fix for TX_INIT + TX_FINL + TX_SKIP + some bug fixing + coinbase shenanigans (#1657) +* feat: improve slack report for daily blockchain tests (#1677) +* feat: use informative names for temporary lt files (#1673) +* fix: constraints commit catch up (#1675) +* 1627 blockdata redesign (#1630) +* fix: use self hosted runner for blockchain tests (#1620) +* Update Linea Besu to 24.12-delivery41 (#1668) +* Update constraints to latest master (#1666) +* fix: `EXTCODECOPY` requires the `CFI` as its `MMU_SRC_ID` only for addresses not currently under deployment (#1665) +* Various `SELFDESTRUCT` related fixes (#1661) +* Fix inherited `REVERT_STAMP` of context that `GET_REVERTED` but don't `SELF_REVERT` + some `SSTORE` and `SLOAD` fixes for the `DOM/SUB` stamps (#1659) +* `PUSHVALUE` fix for exceptional `PUSH`es (#1658) +* test: program invoking all OpCodes (#1647) +* test: extend INVALID opcode (#1645) +* fix: constraints commit update (#1656) +* fix: `TX_WARM` fix for addresses which don't exist in the state (#1655) +* fix: converting from long to int may reveal unintended valid jump destinations (#1654) +* Fine tune dependencies (#1653) +* Remove extra `MISC` row for calls to the `IDENTITY` precompile of the `FAILURE_KNOWN_TO_HUB` variety +* Fixing the 3rd account rows for CREATE's of the FAILURE_WILL_REVERT variety (#1649) +* Move plugins into a separate project (#1637) +* ras: constraints update (#1641) +* CREATE debugging continued (#1635) +* `HUB -> ROM` lookup fix (#1640) +* test(mxp): improving naming (#1606) +* add trivial change clause to contributing md (#1633) +* upgrade version only (#1634) +* update to 24.12 besu (#1624) + ## 0.8.0-rc8 * upgrade linea-besu dependency * deactivate MMIO constraints diff --git a/gradle.properties b/gradle.properties index 0fa57a119..38bc4b7a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -releaseVersion=0.8.0-rc8 +releaseVersion=beta-v1.2.0-rc0 besuVersion=25.1-delivery42 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer From ccd28eca292f0541f91f3065985076c3ffcfeab1 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 16 Jan 2025 09:04:00 +1300 Subject: [PATCH 20/54] update `release` action to install `corset` (#1706) This updates the release action so that it installs `corset`. This is required now, since we use `corset` to rebuild the `Trace.java` files from scratch. --- .github/workflows/release.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d2fafdca..1431d6ec1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,13 +11,10 @@ jobs: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 + - name: Setup Environment + uses: ./.github/actions/setup-environment with: - java-version: 21 - distribution: temurin - cache: 'gradle' + rust-corset: true - name: Grant execute permission for gradlew run: chmod +x gradlew From 2046ad2e47ccfd98d6152e1d2f2d95b3af8db1f8 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 16 Jan 2025 09:36:35 +1300 Subject: [PATCH 21/54] Add actions/checkout to release.yml (#1708) Apparently this is required in order to reuse an action in the repository. --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1431d6ec1..2e16516bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,11 @@ jobs: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: false + - name: Setup Environment uses: ./.github/actions/setup-environment with: From 699a8910bb2ab71713f942ee166ec6d7e2c56d94 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 16 Jan 2025 11:21:42 +1300 Subject: [PATCH 22/54] fix location of distribution for release (#1710) This fixes the location of the distribution for the release workflow. Specifically, since the plugins have been pulled out of arithmetization, the location has changed to be within the plugins/ directory. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e16516bc..410c9ab73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./arithmetization/build/libs/linea-tracer-${{ steps.get_version.outputs.VERSION }}.jar + asset_path: ./plugins/build/libs/linea-tracer-${{ steps.get_version.outputs.VERSION }}.jar asset_name: linea-tracer-${{ steps.get_version.outputs.VERSION }}.jar asset_content_type: application/octet-stream @@ -63,7 +63,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./arithmetization/build/distributions/linea-tracer-${{ steps.get_version.outputs.VERSION }}.zip + asset_path: ./plugins/build/distributions/linea-tracer-${{ steps.get_version.outputs.VERSION }}.zip asset_name: linea-tracer-${{ steps.get_version.outputs.VERSION }}.zip asset_content_type: application/octet-stream From 1fdd2b9cd03c9689d43b8ebb6a2858c12aa1e9de Mon Sep 17 00:00:00 2001 From: DavePearce Date: Thu, 16 Jan 2025 11:41:14 +1300 Subject: [PATCH 23/54] fix cloudsmith publish This fixes part of `release.yml` which publishes to cloudsmith. --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 410c9ab73..7ce79779d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,11 +79,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 + - name: Setup Environment + uses: ./.github/actions/setup-environment with: - java-version: 21 - distribution: temurin + rust-corset: true - name: Publish Java artifacts run: ./gradlew publish From 513d0f108353b366495cce201a811a8bea10d9ac Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 16 Jan 2025 14:20:41 +1300 Subject: [PATCH 24/54] Tweak publish task (#1713) This tweaks the publish task so that it doesn't include the arithmetization project. This is because the plugins/ project is where all the publishing action happens now. --- arithmetization/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/arithmetization/build.gradle b/arithmetization/build.gradle index 691616ed8..5882835df 100644 --- a/arithmetization/build.gradle +++ b/arithmetization/build.gradle @@ -73,5 +73,3 @@ jar { ) } } - -apply from: rootProject.file("gradle/publishing.gradle") From 58cbb940f3c872c9316a0465ff2a40ee09b7b7e6 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Thu, 16 Jan 2025 18:01:41 +0100 Subject: [PATCH 25/54] Update actions/upload-artifact to v4 since v3 is deprecated and breaks CI (#1718) Signed-off-by: Fabio Di Fabio --- .github/workflows/gradle-nightly-tests.yml | 2 +- .github/workflows/gradle-tests.yml | 10 +++++----- .github/workflows/gradle-weekly-tests.yml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index 30e99b142..eb4db3d95 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -32,7 +32,7 @@ jobs: - name: Upload test report if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: nightly-tests-report path: build/reports/tests/**/* diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index 2ca42c2d8..2a3ee383a 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -44,7 +44,7 @@ jobs: JAVA_OPTS: -Xmx2g -Dorg.gradle.daemon=false - name: Store distribution artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: distributions path: arithmetization/build/libs @@ -79,7 +79,7 @@ jobs: - name: Upload test report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: corset-unit-test-report path: arithmetization/build/reports/tests/**/* @@ -110,7 +110,7 @@ jobs: - name: Upload test report if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: go-corset-unit-tests-report path: arithmetization/build/reports/tests/**/* @@ -142,7 +142,7 @@ jobs: - name: Upload test report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: replay-test-report path: arithmetization/build/reports/tests/**/* @@ -172,7 +172,7 @@ jobs: - name: Upload test report if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: go-corset-replay-tests-report path: arithmetization/build/reports/tests/**/* diff --git a/.github/workflows/gradle-weekly-tests.yml b/.github/workflows/gradle-weekly-tests.yml index da5927964..e81d8a0c2 100644 --- a/.github/workflows/gradle-weekly-tests.yml +++ b/.github/workflows/gradle-weekly-tests.yml @@ -33,7 +33,7 @@ jobs: - name: Upload test report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: nightly-tests-report path: build/reports/tests/**/* From 52ecc2c9de03de8627c30e79de91a1cab055c4e3 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Thu, 16 Jan 2025 21:56:27 +0100 Subject: [PATCH 26/54] Fix Java jars publication and remove redundant upload to Cloudsmith (#1716) Signed-off-by: Fabio Di Fabio --- .github/workflows/release.yml | 9 --------- arithmetization/build.gradle | 2 ++ gradle/publishing.gradle | 9 --------- scripts/cloudsmith-upload.sh | 18 ------------------ 4 files changed, 2 insertions(+), 36 deletions(-) delete mode 100755 scripts/cloudsmith-upload.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ce79779d..dfa24df35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,12 +89,3 @@ jobs: env: CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }} CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} - - - name: Publish distribution artifacts - run: | - sudo apt update - sudo apt install -y python3 python3-pip python3-venv - ./gradlew cloudsmithUpload - env: - CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }} - CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} diff --git a/arithmetization/build.gradle b/arithmetization/build.gradle index 5882835df..691616ed8 100644 --- a/arithmetization/build.gradle +++ b/arithmetization/build.gradle @@ -73,3 +73,5 @@ jar { ) } } + +apply from: rootProject.file("gradle/publishing.gradle") diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index 61f4e5ad8..a31be155e 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -73,12 +73,3 @@ publishing { } } -tasks.register('cloudsmithUpload') { - doLast { - exec { - executable rootProject.file("scripts/cloudsmith-upload.sh") - args rootProject.version, project.layout.buildDirectory.get() - } - } -} - diff --git a/scripts/cloudsmith-upload.sh b/scripts/cloudsmith-upload.sh deleted file mode 100755 index bbb983cd4..000000000 --- a/scripts/cloudsmith-upload.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -euo pipefail - -VERSION=${1:?Must specify Linea Arithmetization version} -BUILD_DIR=${2:?Must specify Linea Tracer module build directory} - -ENV_DIR=./build/tmp/cloudsmith-env -if [[ -d ${ENV_DIR} ]] ; then - source ${ENV_DIR}/bin/activate -else - python3 -m venv ${ENV_DIR} - source ${ENV_DIR}/bin/activate -fi - -python3 -m pip install --upgrade cloudsmith-cli - -echo ">>>>>>>>>>>>>> Uploading Maven Artifact for linea-tracer-${VERSION} to Cloudsmith ..." -cloudsmith push maven consensys/linea-arithmetization ${BUILD_DIR}/libs/linea-tracer-${VERSION}.jar --pom-file ${BUILD_DIR}/publications/mavenJava/pom-default.xml From 4ace8db4e607bb60996e5987980c2bca4b68d7c3 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 17 Jan 2025 12:05:36 +0100 Subject: [PATCH 27/54] Improve the copy local Besu distribution archive when the download fails (#1720) Signed-off-by: Fabio Di Fabio --- gradle/dist.gradle | 50 +++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/gradle/dist.gradle b/gradle/dist.gradle index 926b08e2a..98cea081f 100644 --- a/gradle/dist.gradle +++ b/gradle/dist.gradle @@ -15,35 +15,39 @@ import de.undercouch.gradle.tasks.download.Download def lineaBesuDistTar = new File(new File(buildDir, "downloads"), rootProject.besuFilename) -tasks.register('downloadLineaBesu', Download) { - src rootProject.besuUrl - dest lineaBesuDistTar - onlyIfModified true -} - -tasks.register('copyLocalLineaBesu', Copy) { - onlyIf { - downloadLineaBesu.state.failure - } - def localLineaBesuDir = - project.hasProperty('useLocalLineaBesuDir') - ? file("${findProperty('useLocalLineaBesuDir')}".replaceFirst('^~', System.getProperty('user.home'))) - : new File(projectDir, "../../linea-besu") - - def localLineaBesuFile = new File("${localLineaBesuDir.absoluteFile}/build/distributions/${rootProject.besuFilename}") - doFirst { - if (!file(localLineaBesuFile).exists()) { - throw new GradleException("Could not download Linea Besu distribution from: " + rootProject.besuUrl + - ", and could not find it locally at ${localLineaBesuFile} either") +task downloadLineaBesu { + outputs.file(lineaBesuDistTar) + doLast { + try { + download.run { + src rootProject.besuUrl + dest lineaBesuDistTar + onlyIfModified true + } + } catch (Exception e) { + def localLineaBesuDir = + project.hasProperty('useLocalLineaBesuDir') + ? file("${findProperty('useLocalLineaBesuDir')}".replaceFirst('^~', System.getProperty('user.home'))) + : new File(projectDir, "../../linea-besu") + + def localLineaBesuFile = new File("${localLineaBesuDir.canonicalPath}/build/distributions/${rootProject.besuFilename}") + + logger.warn("Could not download " + rootProject.besuUrl + " trying local copy from " + localLineaBesuFile + " as fallback") + if (!file(localLineaBesuFile).exists()) { + throw new GradleException("Could not download Linea Besu distribution from: " + rootProject.besuUrl + + ", and could not find it locally at ${localLineaBesuFile} either") + } + + copy { + from localLineaBesuFile + into lineaBesuDistTar.parentFile + } } } - from localLineaBesuFile - into lineaBesuDistTar.parentFile } task unTarLineaBesu(type: Copy) { dependsOn downloadLineaBesu - dependsOn copyLocalLineaBesu from tarTree(lineaBesuDistTar) into lineaBesuDistTar.parentFile From c6a6114bcbbf4ba9a44fefef659d8184d82daac8 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Sat, 18 Jan 2025 08:16:14 +1300 Subject: [PATCH 28/54] feat: go-corset front end integration (#1689) * Use `go-corset` front-end This puts through some changes to use the new `go-corset` front end. 1) This updates the gradle-tests action to use the `go-corset` front-end instead of the original. Provided this works, other actions will need to be updated accordingly. 2) This updates the version of `go-corset` used in `linea-tracer`. This is necessary because only the latest version of `go-corset` is capable of compiling the constraints. 3) This makes relevant changes to ensure go-corset can compile the zkevm.bin file as necessary for the reference tests. 4) This updates the corset version to incorporate a minor fix relating to coalescing of i8 and byte columns. --- .github/actions/setup-go-corset/action.yml | 2 +- .github/actions/setup-rust-corset/action.yml | 2 +- .github/workflows/gradle-ethereum-tests.yml | 5 +- .github/workflows/gradle-nightly-tests.yml | 5 +- .github/workflows/gradle-tests.yml | 6 ++- .github/workflows/gradle-weekly-tests.yml | 3 +- .../workflows/reference-blockchain-tests.yml | 15 +++--- arithmetization/build.gradle | 2 +- gradle/corset.gradle | 46 +++++++++++++------ gradle/tests.gradle | 12 ++++- gradle/trace-files.gradle | 2 +- linea-constraints | 2 +- reference-tests/build.gradle | 11 +++-- 13 files changed, 70 insertions(+), 43 deletions(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index 3b1f5c784..f692e575b 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@5cb0c28 + run: go install github.com/consensys/go-corset/cmd/go-corset@f89cf145 diff --git a/.github/actions/setup-rust-corset/action.yml b/.github/actions/setup-rust-corset/action.yml index b9e5b52ba..a608c65d2 100644 --- a/.github/actions/setup-rust-corset/action.yml +++ b/.github/actions/setup-rust-corset/action.yml @@ -9,7 +9,7 @@ inputs: # Corresponds to the corset release tag for the desired version. description: 'Corset tag to use' required: false - default: 'v9.7.17' + default: 'v9.7.18' asset_id: # Corresponds to the Github asset id for the asset published as part # of the release. Specifically, it should be the id for the asset diff --git a/.github/workflows/gradle-ethereum-tests.yml b/.github/workflows/gradle-ethereum-tests.yml index 7465dbb0f..bdddebbc4 100644 --- a/.github/workflows/gradle-ethereum-tests.yml +++ b/.github/workflows/gradle-ethereum-tests.yml @@ -72,14 +72,15 @@ jobs: run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.caching=true env: JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: fields,expand,expand,expand + ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" - name: Run General State Reference Tests run: GOMEMLIMIT=64GiB ./gradlew -Dblockchain=Ethereum referenceGeneralStateTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air + ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" - name: Upload test report if: always() diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index eb4db3d95..ad98f0c6b 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -24,11 +24,12 @@ jobs: go-corset: true - name: Run Nightly tests - run: GOMEMLIMIT=96GiB ./gradlew nightlyTests + run: GOMEMLIMIT=64GiB ./gradlew nightlyTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --mir + ZKEVM_BIN: "zkevm.go.bin" - name: Upload test report if: ${{ always() }} diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index 2a3ee383a..ce43aca1e 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -105,8 +105,9 @@ jobs: env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -b1024 -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air UNIT_TESTS_PARALLELISM: 1 + ZKEVM_BIN: "zkevm.go.bin" - name: Upload test report if: ${{ always() }} @@ -168,7 +169,8 @@ jobs: env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -b1024 -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air + ZKEVM_BIN: "zkevm.go.bin" - name: Upload test report if: ${{ always() }} diff --git a/.github/workflows/gradle-weekly-tests.yml b/.github/workflows/gradle-weekly-tests.yml index e81d8a0c2..d3bab4fee 100644 --- a/.github/workflows/gradle-weekly-tests.yml +++ b/.github/workflows/gradle-weekly-tests.yml @@ -67,7 +67,8 @@ jobs: env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air + ZKEVM_BIN: "zkevm.go.bin" - name: Failure Notification if: ${{ failure() || cancelled() }} diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 696272226..23c81569e 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -39,20 +39,16 @@ jobs: id: extract_branch run: | echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: 21 - distribution: temurin - - name: Setup Go Corset - uses: ./.github/actions/setup-go-corset + - name: Setup Test Environment + uses: ./.github/actions/setup-environment + with: + go-corset: true - name: Generate block chain reference tests run: ./gradlew :reference-tests:generateBlockchainReferenceTests -Dorg.gradle.caching=true env: JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: fields,expand,expand,expand - name: Download artifact uses: dawidd6/action-download-artifact@v6 @@ -75,7 +71,8 @@ jobs: REFERENCE_TESTS_PARALLELISM: 2 JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -wd --ansi-escapes=false --report --air + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air + ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" FAILED_TEST_JSON_DIRECTORY: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/ FAILED_MODULE: ${{ inputs.failed_module || '' }} FAILED_CONSTRAINT: ${{ inputs.failed_constraint || '' }} diff --git a/arithmetization/build.gradle b/arithmetization/build.gradle index 691616ed8..76fa0dcec 100644 --- a/arithmetization/build.gradle +++ b/arithmetization/build.gradle @@ -25,7 +25,7 @@ version = rootProject.version apply from: rootProject.file("gradle/java.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") -apply from: rootProject.file('gradle/common-dependencies.gradle') +apply from: rootProject.file("gradle/common-dependencies.gradle") apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/tests.gradle") apply from: rootProject.file("gradle/build-aliases.gradle") diff --git a/gradle/corset.gradle b/gradle/corset.gradle index c9ff1a184..5891e6b8c 100644 --- a/gradle/corset.gradle +++ b/gradle/corset.gradle @@ -19,21 +19,30 @@ tasks.register('corsetExists') { commandLine "corset", "-V" } if (result.getExitValue() != 0){ - throw new GradleException('Corset not found, skipping corsetTests') + throw new GradleException('Corset not found!') } } } +// Allowing overriding the default zkevm.bin file. +def ZKEVM_BIN = System.getenv("ZKEVM_BIN") ?: "zkevm.bin" + tasks.register('buildZkevmBin', Exec) { workingDir "${project.rootDir}/linea-constraints/" - commandLine 'make', 'zkevm.bin' - // sanity check target chain - def chain = System.getProperty('blockchain') - // note: null indicates the default (which is Linea). - if(chain != null && chain != "Linea") { - println("*** incorrect target chain (expected 'Linea' was '" + chain + "')\n\n") - assert false + // Sanity check executing this makes sense. + doFirst { + // Record zkevm.bin for CorsetValidator + environment.put("ZKEVM_BIN", ZKEVM_BIN) + // sanity check target chain + def chain = System.getProperty('blockchain') + // note: null indicates the default (which is Linea). + if(chain != null && chain != "Linea") { + println("*** incorrect target chain (expected 'Linea' was '" + chain + "')\n\n") + assert false + } } + // + commandLine 'make', ZKEVM_BIN // store the output instead of printing to the console standardOutput = new ByteArrayOutputStream() ext.output = { @@ -41,16 +50,23 @@ tasks.register('buildZkevmBin', Exec) { } } +// Allowing overriding the default zkevm.bin file. +def ZKEVM_REFTESTS_BIN = System.getenv("ZKEVM_BIN") ?: "zkevm_for_reference_tests.bin" + tasks.register('buildReferenceTestsZkevmBin', Exec) { workingDir "${project.rootDir}/linea-constraints/" - commandLine 'make', 'zkevm_for_reference_tests.bin' - // sanity check target chain - def chain = System.getProperty('blockchain') + // Sanity check executing this makes sense. + doFirst { + // sanity check target chain + def chain = System.getProperty('blockchain') + // + if(chain != "Ethereum") { + println("*** incorrect target chain (expected 'Ethereum' was '" + chain + "')\n\n") + assert false + } + } // - if(chain != "Ethereum") { - println("*** incorrect target chain (expected 'Ethereum' was '" + chain + "')\n\n") - assert false - } + commandLine 'make', ZKEVM_REFTESTS_BIN // Store the output instead of printing to the console standardOutput = new ByteArrayOutputStream() ext.output = { diff --git a/gradle/tests.gradle b/gradle/tests.gradle index 185c8d970..af924a17f 100644 --- a/gradle/tests.gradle +++ b/gradle/tests.gradle @@ -41,8 +41,6 @@ apply plugin: 'com.adarshr.test-logger' * - 'root.log.level' and 'evm.log.level': allow to control the log level used during the tests. */ tasks.withType(Test).configureEach { - dependsOn 'buildZkevmBin' - minHeapSize = "4g" maxHeapSize = "8g" @@ -118,6 +116,8 @@ tasks.withType(Test).configureEach { } tasks.test.configure { + dependsOn(buildZkevmBin) + systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent") @@ -133,6 +133,8 @@ tasks.test.configure { } tasks.register("fastReplayTests", Test) { + dependsOn(buildZkevmBin) + if (System.getenv().containsKey("REPLAY_TESTS_PARALLELISM")) { systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") @@ -149,6 +151,8 @@ tasks.register("fastReplayTests", Test) { } tasks.register("nightlyReplayTests", Test) { + dependsOn(buildZkevmBin) + boolean isCiServer = System.getenv().containsKey("CI") maxHeapSize = isCiServer ? "32g" : "8g" @@ -168,6 +172,8 @@ tasks.register("nightlyReplayTests", Test) { } tasks.register("nightlyTests", Test) { + dependsOn(buildZkevmBin) + boolean isCiServer = System.getenv().containsKey("CI") maxHeapSize = isCiServer ? "32g" : "8g" @@ -184,6 +190,8 @@ tasks.register("nightlyTests", Test) { } tasks.register("weeklyTests", Test) { + dependsOn(buildZkevmBin) + systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent") diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index 64cac5c29..e089ccbb7 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -108,7 +108,7 @@ tasks.register('binreftable', TraceFilesTask) { ['txndata'].each {moduleName -> tasks.register(moduleName, TraceFilesTask) { group "Trace files generation" - dependsOn corsetExists + dependsOn corsetExists module = moduleName files = ["${moduleName}/columns.lisp", "constants/constants.lisp", "${moduleName}/constants.lisp"] } diff --git a/linea-constraints b/linea-constraints index b2730fcaf..24c71a551 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit b2730fcaf1e9ae339471bbec8d43f302ad73d371 +Subproject commit 24c71a551721e588aefe774850aec50f7702ecc5 diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index 5189e0940..47d1b5ab3 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -19,7 +19,6 @@ plugins { apply from: rootProject.file("gradle/corset.gradle") apply from: rootProject.file("gradle/java.gradle") -apply from: rootProject.file("gradle/trace-files.gradle") apply from: rootProject.file("gradle/dependency-management.gradle") apply from: rootProject.file('gradle/common-dependencies.gradle') apply from: rootProject.file("gradle/lint.gradle") @@ -55,6 +54,7 @@ tasks.register("generateGeneralStateReferenceTests", RefTestGenerationTask) { } tasks.register('referenceBlockchainTests', Test) { + dependsOn(buildReferenceTestsZkevmBin) description = 'Runs ETH reference blockchain tests.' dependsOn generateBlockchainReferenceTests environment.put("REFERENCE_TEST_OUTCOME_OUTPUT_FILE", "BlockchainReferenceTestOutcome.json") @@ -69,9 +69,10 @@ tasks.register('referenceBlockchainTests', Test) { } tasks.register('referenceGeneralStateTests', Test) { + dependsOn(buildReferenceTestsZkevmBin) description = 'Runs ETH reference general state tests.' dependsOn generateGeneralStateReferenceTests - + // Record zkevm.bin for CorsetValidator environment.put("REFERENCE_TEST_OUTCOME_OUTPUT_FILE", "GeneralStateReferenceTestOutcome.json") useJUnitPlatform { @@ -88,9 +89,9 @@ tasks.register('referenceGeneralStateTests', Test) { tasks.named("referenceBlockchainTests"), ].forEach { it.configure { - dependsOn buildReferenceTestsZkevmBin - environment.put("ZKEVM_BIN", "zkevm_for_reference_tests.bin") - + // Record zkevm.bin for CorsetValidator + environment.put("ZKEVM_BIN", System.getenv("ZKEVM_BIN") ?: "zkevm_for_reference_tests.bin") + // Configure parallelism systemProperty("junit.jupiter.execution.timeout.default", "15 m") // 5 minutes systemProperty("junit.jupiter.execution.parallel.enabled", "true") systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") From 18aa4098d711468624e86dde589b745543d63af2 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Wed, 22 Jan 2025 22:06:40 +1300 Subject: [PATCH 29/54] fix: update `go-corset` to latest (#1726) This updates `go-corset` to its latest commit to ensure a bug fix is incorporated into the CI pipeline for `linea-tracer`. --- .github/actions/setup-go-corset/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index f692e575b..35871c393 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@f89cf145 + run: go install github.com/consensys/go-corset/cmd/go-corset@77d304f From 18eaeb47bf0251ae21d90f6f67dc8891b8fd6807 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 22 Jan 2025 16:34:04 +0100 Subject: [PATCH 30/54] Update Linea Besu to 25.1-develop-448d1a9 (#1722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Linea Besu to 25.1-develop-448d1a9 Signed-off-by: Fabio Di Fabio * Use new version of `traceStartBlock` Signed-off-by: Fabio Di Fabio * update to reflect new interface of GasCalculator.transactionIntrinsicGasCost method * spotless fixes * Update Reaper.java * Update arithmetization/src/main/java/net/consensys/linea/blockcapture/reapers/Reaper.java Removing resolved comment --------- Signed-off-by: Fabio Di Fabio Co-authored-by: Daniel Lehrner Co-authored-by: Olivier Bégassat <38285177+OlivierBBB@users.noreply.github.com> --- .../java/net/consensys/linea/blockcapture/BlockCapturer.java | 5 +++-- .../net/consensys/linea/blockcapture/reapers/Reaper.java | 5 +++-- .../linea/zktracer/types/TransactionProcessingMetadata.java | 4 +++- gradle.properties | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java index 17548d9f6..f3fde8172 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java @@ -69,8 +69,9 @@ public void traceStartConflation(long numBlocksInConflation) {} public void traceEndConflation(WorldView state) {} @Override - public void traceStartBlock(BlockHeader blockHeader, BlockBody blockBody) { - this.reaper.enterBlock(blockHeader, blockBody); + public void traceStartBlock( + BlockHeader blockHeader, BlockBody blockBody, Address miningBeneficiary) { + this.reaper.enterBlock(blockHeader, blockBody, miningBeneficiary); } @Override diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/reapers/Reaper.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/reapers/Reaper.java index ed7057237..50bdbb515 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/reapers/Reaper.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/reapers/Reaper.java @@ -69,10 +69,11 @@ public class Reaper { /** Collect the account address read / written by the current transaction */ private AddressReaper txAddresses = null; - public void enterBlock(final BlockHeader header, final BlockBody body) { + public void enterBlock( + final BlockHeader header, final BlockBody body, final Address miningBeneficiary) { this.blocks.add( BlockSnapshot.of((org.hyperledger.besu.ethereum.core.BlockHeader) header, body)); - this.conflationAddresses.touch(header.getCoinbase()); + this.conflationAddresses.touch(miningBeneficiary); txIndex = 0; // reset } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java index fa217365f..5bf97d409 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java @@ -144,8 +144,10 @@ public TransactionProcessingMetadata( // Note: Besu's dataCost computation contains // - the 21_000 transaction cost (we deduce it) // - the contract creation cost in case of deployment (we set deployment to false to not add it) + // - the baseline gas (gas for access lists and 7702 authorizations) is set to zero, because we + // only consider the cost of the transaction payload dataCost = - ZkTracer.gasCalculator.transactionIntrinsicGasCost(besuTransaction.getPayload(), false) + ZkTracer.gasCalculator.transactionIntrinsicGasCost(besuTransaction.getPayload(), false, 0) - GAS_CONST_G_TRANSACTION; accessListCost = besuTransaction.getAccessList().map(ZkTracer.gasCalculator::accessListGasCost).orElse(0L); diff --git a/gradle.properties b/gradle.properties index 38bc4b7a2..8c7d78b9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=beta-v1.2.0-rc0 -besuVersion=25.1-delivery42 +besuVersion=25.1-develop-448d1a9 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ From b0a80267e4fa9afbda4072b8e9d4b145cea289f1 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 23 Jan 2025 22:43:41 +1300 Subject: [PATCH 31/54] update `go-corset` to latest version (#1732) This version includes a small number of optimisations which may improve overall performance. --- .github/actions/setup-go-corset/action.yml | 2 +- .github/workflows/reference-blockchain-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index 35871c393..e009396e3 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@77d304f + run: go install github.com/consensys/go-corset/cmd/go-corset@fe70003 diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 23c81569e..4775c9e74 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -71,7 +71,7 @@ jobs: REFERENCE_TESTS_PARALLELISM: 2 JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air + GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" FAILED_TEST_JSON_DIRECTORY: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/ FAILED_MODULE: ${{ inputs.failed_module || '' }} From 40d16080ea15737ec77bec4dfb54eb5b370125e3 Mon Sep 17 00:00:00 2001 From: amkCha <29160563+amkCha@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:30:04 +0100 Subject: [PATCH 32/54] Fix/refacto blockdata files (#1724) * fix(blockdata): update gradle trace file * fix(blockdata): add global constants in traces eth and linea generation * fix(blockdata): update constraints * fix(blockdata): fix unit test import --- .../linea/zktracer/module/blockdata/GasLimitTest.java | 3 ++- gradle/trace-files.gradle | 10 +++++----- linea-constraints | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java index 7a7e160af..93e2d3eb4 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java @@ -16,7 +16,8 @@ import static net.consensys.linea.zktracer.MultiBlockUtils.multiBlocksTest; import static net.consensys.linea.zktracer.module.blockdata.NextGasLimitScenario.*; -import static net.consensys.linea.zktracer.module.blockdata.Trace.*; +import static net.consensys.linea.zktracer.module.blockdata.Trace.GAS_LIMIT_MAXIMUM; +import static net.consensys.linea.zktracer.module.blockdata.Trace.GAS_LIMIT_MINIMUM; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; import java.util.ArrayList; diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index e089ccbb7..6dbd1ad6f 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -41,14 +41,14 @@ tasks.register("blockdataEthereum", TraceFilesTask) { group "Trace files generation" dependsOn corsetExists module = 'blockdata' - files = ['blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/constants-ethereum.lisp'] + files = ['constants/constants.lisp', 'blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/ethereum.lisp'] } tasks.register("blockdataLinea", TraceFilesTask) { group "Trace files generation" dependsOn corsetExists module = 'blockdata' - files = ['blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/constants-linea.lisp'] + files = ['constants/constants.lisp', 'blockdata/constants.lisp', 'blockdata/columns.lisp', 'blockdata/processing/gaslimit/linea.lisp'] } // @@ -145,15 +145,15 @@ tasks.register('buildTracer') { dependsOn 'mmu', 'blake2fmodexpdata', 'oob', 'exp', 'rlptxrcpt', 'rlpaddr', 'shakiradata', 'mxp', 'ecdata' dependsOn 'txndata' dependsOn 'constants' - + def chain = System.getProperty('blockchain') // Conditional dependsOn if(chain == null || chain == "Linea") { print("Building for Linea...\n") - dependsOn 'blockdataLinea' + dependsOn 'blockdataLinea' } else if(chain == "Ethereum") { dependsOn 'blockdataEthereum' - print("Building for Ethereum...\n") + print("Building for Ethereum...\n") } else { // Force build failure if unknown chain. println("*** unknown target chain. Try '-Dblockchain=Linea' or '-Dblockchain=Ethereum'\n\n") diff --git a/linea-constraints b/linea-constraints index 24c71a551..e0a8b82ef 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 24c71a551721e588aefe774850aec50f7702ecc5 +Subproject commit e0a8b82ef8c43bff72c9924224b764398cc6ec3d From 6b7248e1b42170b2ef7ec9ec78d4c9b56d367dd4 Mon Sep 17 00:00:00 2001 From: Luis Pinto Date: Fri, 24 Jan 2025 15:02:32 +0000 Subject: [PATCH 33/54] Use both traceStartBlock method calls wherever suitable (#1711) --- .../consensys/linea/blockcapture/BlockCapturer.java | 2 +- .../zktracer/ConflationAwareOperationTracer.java | 6 ++++++ .../java/net/consensys/linea/zktracer/ZkTracer.java | 11 +++++++++++ .../consensys/linea/zktracer/module/DebugMode.java | 6 +++++- .../linea/GeneralStateReferenceTestTools.java | 2 +- .../linea/testing/GeneralStateReferenceTestTools.java | 2 +- .../linea/testing/ReplayExecutionEnvironment.java | 2 +- 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java index f3fde8172..ea5fb4912 100644 --- a/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java +++ b/arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java @@ -70,7 +70,7 @@ public void traceEndConflation(WorldView state) {} @Override public void traceStartBlock( - BlockHeader blockHeader, BlockBody blockBody, Address miningBeneficiary) { + BlockHeader blockHeader, BlockBody blockBody, final Address miningBeneficiary) { this.reaper.enterBlock(blockHeader, blockBody, miningBeneficiary); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java index 01fc47f79..913592431 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java @@ -80,6 +80,12 @@ public void traceEndConflation(WorldView state) { this.tracers.forEach(tracer -> tracer.traceEndConflation(state)); } + public void traceStartBlock( + final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) { + this.tracers.forEach( + tracer -> tracer.traceStartBlock(blockHeader, blockBody, miningBeneficiary)); + } + public void traceStartBlock( final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) { this.tracers.forEach( diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java index 0edc2be74..d89766c53 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java @@ -183,6 +183,17 @@ public void traceStartBlock( } } + @Override + public void traceStartBlock( + final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) { + try { + this.hub.traceStartBlock(blockHeader, miningBeneficiary); + this.debugMode.ifPresent(x -> x.traceStartBlock(blockHeader, blockBody, miningBeneficiary)); + } catch (final Exception e) { + this.tracingExceptions.add(e); + } + } + @Override public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { try { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/DebugMode.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/DebugMode.java index e4ccf4f63..dc8824163 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/DebugMode.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/DebugMode.java @@ -23,6 +23,7 @@ import net.consensys.linea.zktracer.opcode.OpCode; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.DelegatingBytes; +import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Quantity; import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.evm.frame.MessageFrame; @@ -159,7 +160,10 @@ public void traceEndConflation() { log.info("=== Stop conflation ==="); } - public void traceStartBlock(ProcessableBlockHeader processableBlockHeader, final BlockBody body) { + public void traceStartBlock( + ProcessableBlockHeader processableBlockHeader, + final BlockBody body, + final Address miningBeneficiary) { if (!this.l.doBlock()) { return; } diff --git a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java index c3e9058b2..6098bf4e9 100644 --- a/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java @@ -178,7 +178,7 @@ public static void executeTest(final GeneralStateTestCaseEipSpec spec) { final ZkTracer zkTracer = new ZkTracer(); zkTracer.traceStartConflation(1); - zkTracer.traceStartBlock(blockHeader, blockHeader.getCoinbase()); + zkTracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase()); final TransactionProcessingResult result = processor.processTransaction( diff --git a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java index 772a816b0..cf913ff50 100644 --- a/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java +++ b/testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java @@ -93,7 +93,7 @@ public static void executeTest( .blobGasPricePerGas(blockHeader.getExcessBlobGas().orElse(BlobGas.ZERO)); tracer.traceStartConflation(1); - tracer.traceStartBlock(blockHeader, blockHeader.getCoinbase()); + tracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase()); TransactionProcessingResult result = null; for (Transaction transaction : blockBody.getTransactions()) { // Several of the GeneralStateTests check if the transaction could potentially diff --git a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java index f2c3cdfa0..f0f95267d 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java @@ -207,7 +207,7 @@ private static void executeFrom( useCoinbaseAddressFromBlockHeader ? header.getCoinbase() : CliqueHelpers.getProposerOfBlock(header); - tracer.traceStartBlock(header, miningBeneficiary); + tracer.traceStartBlock(header, body, miningBeneficiary); for (TransactionSnapshot txs : blockSnapshot.txs()) { final Transaction tx = txs.toTransaction(); From c23befcbcc60c464fb3824a8cf8503375dcc84c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:16:04 +0100 Subject: [PATCH 34/54] release: bump version to beta-v1.2.0-rc2 and update changelog (#1735) --- CHANGELOG.md | 17 +++++++++++++++++ gradle.properties | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e77c165..39fb0fa82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## beta-v1-2.0-rc2 +* Use both traceStartBlock method calls wherever suitable (#1711) +* Fix/refacto blockdata files (#1724) +* update `go-corset` to latest version (#1732) +* Update Linea Besu to 25.1-develop-448d1a9 (#1722) +* fix: update `go-corset` to latest (#1726) +* feat: go-corset front end integration (#1689) +* Improve the copy local Besu distribution archive when the download fails (#1720) +* Fix Java jars publication and remove redundant upload to Cloudsmith (#1716) +* Update actions/upload-artifact to v4 since v3 is deprecated and breaks CI (#1718) +* Tweak publish task (#1713) +* fix cloudsmith publish +* fix location of distribution for release (#1710) +* Add actions/checkout to release.yml (#1708) +* update `release` action to install `corset` (#1706) + + ## beta-v1.2.0-rc0 * Fix: ignore `Trace.java` files and `GlobalConstants.java` + recognize 'beta*' as release tag (#1703) * init chain id in zktracer. (#1702) diff --git a/gradle.properties b/gradle.properties index 8c7d78b9b..a592e7c08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -releaseVersion=beta-v1.2.0-rc0 +releaseVersion=beta-v1.2.0-rc2 besuVersion=25.1-develop-448d1a9 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer From 8dcb89ae5b4611837e1e3e118f99b8bf01907cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:44:10 +0100 Subject: [PATCH 35/54] clean: remove dead code (#1733) Signed-off-by: F Bojarski --- .../hub/transients/OperationAncillaries.java | 155 ------------------ 1 file changed, 155 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/OperationAncillaries.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/OperationAncillaries.java index fa4aae1c8..4bd10944b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/OperationAncillaries.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/transients/OperationAncillaries.java @@ -16,18 +16,13 @@ package net.consensys.linea.zktracer.module.hub.transients; import static com.google.common.base.Preconditions.*; -import static net.consensys.linea.zktracer.module.UtilCalculator.allButOneSixtyFourth; -import static net.consensys.linea.zktracer.types.AddressUtils.isPrecompile; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import net.consensys.linea.zktracer.module.constants.GlobalConstants; import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.opcode.OpCode; -import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.Range; import org.apache.tuweni.bytes.Bytes; -import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.internal.Words; @@ -52,32 +47,6 @@ private static Bytes maybeShadowReadMemory(final Range span, final MessageFrame return frame.shadowReadMemory(span.offset(), span.size()); } - /** - * Compute the gas allowance for the child context if in a CALL, throws otherwise. - * - * @return the CALL gas allowance - */ - public long gasAllowanceForCall() { - final OpCode opCode = hub.opCode(); - - if (opCode.isCall()) { - final long gas = Words.clampedToLong(hub.messageFrame().getStackItem(0)); - EWord value = EWord.ZERO; - if (opCode == OpCode.CALL || opCode == OpCode.CALLCODE) { - value = EWord.of(hub.messageFrame().getStackItem(2)); - } - final long stipend = value.isZero() ? 0 : GlobalConstants.GAS_CONST_G_CALL_STIPEND; - final long upfrontCost = Hub.GAS_PROJECTOR.of(hub.messageFrame(), opCode).upfrontGasCost(); - return stipend - + Math.max( - Words.unsignedMin( - allButOneSixtyFourth(hub.messageFrame().getRemainingGas() - upfrontCost), gas), - 0); - } - - throw new IllegalStateException("not a CALL"); - } - /** * Returns the RAM segment of the caller containing the calldata if the {@link MessageFrame} * operation is a call, throws otherwise. @@ -177,128 +146,4 @@ public static Range returnDataRequestedSegment(final MessageFrame frame) { "returnDataRequestedSegment called outside of a *CALL"); } } - - /** - * Returns the RAM segment offered by the caller for the return data if the current operation is a - * call, throws otherwise. - * - * @return the return data target - */ - public Range returnDataRequestedSegment() { - return returnDataRequestedSegment(hub.messageFrame()); - } - - /** - * Returns the RAM segment offered by the callee for the return data if the current operation is a - * RETURN/REVERT, throws otherwise. - * - * @param frame the execution context - * @return the return data segment - */ - public static Range outputDataSpan(final MessageFrame frame) { - - if (frame.getExceptionalHaltReason().isPresent()) { - return Range.empty(); - } - - final OpCode opCode = OpCode.of(frame.getCurrentOperation().getOpcode()); - - if (opCode == OpCode.RETURN && frame.getType() == MessageFrame.Type.CONTRACT_CREATION) { - return Range.empty(); - } - - switch (opCode) { - case RETURN, REVERT -> { - long size = Words.clampedToLong(frame.getStackItem(1)); - - if (size == 0) { - return Range.empty(); - } - - long offset = Words.clampedToLong(frame.getStackItem(0)); - return Range.fromOffsetAndSize(offset, size); - } - case STOP, SELFDESTRUCT -> { - return Range.empty(); - } - - // TODO: what the case below provides isn't output data, but the return data ... - // We cannot use this method for that purpose. - case CALL, CALLCODE, DELEGATECALL, STATICCALL -> { - Address target = Words.toAddress(frame.getStackItem(1)); - if (isPrecompile(target)) { - return Range.fromOffsetAndSize(0, 0); - } - checkArgument(isPrecompile(target)); // useless (?) sanity check - // TODO: this will not work for MODEXP as return data starts at offset - // 512 - modulusByteSize - return Range.fromOffsetAndSize(0, frame.getReturnData().size()); - } - default -> throw new IllegalArgumentException( - "returnDataRequestedSegment called outside of a RETURN/REVERT"); - } - } - - /** - * Returns the RAM segment offered by the caller for the return data if the current operation is a - * call, throws otherwise. - * - * @return the return data target - */ - public Range outputDataSpan() { - return outputDataSpan(hub.messageFrame()); - } - - /** - * Return the bytes of the return data if the current operation is a call, throws otherwise. - * - * @return the return data content - */ - public Bytes outputData() { - final Range outputDataSpan = outputDataSpan(); - - // Accesses to huge offset with 0-size are valid - if (outputDataSpan.isEmpty()) { - return Bytes.EMPTY; - } - - // Besu is limited to i32 for memory offset/size - if (outputDataSpan.besuOverflow()) { - log.warn("Overflowing memory access: {}", outputDataSpan); - return Bytes.EMPTY; - } - - // TODO: this WON'T work for precompiles, they don't have memory. - return maybeShadowReadMemory(outputDataSpan, hub.messageFrame()); - } - - /** - * Return the bytes of the returndata if the current operation is a return/revert, throws - * otherwise. - * - * @param frame the execution context - * @return the returndata content - */ - public static Bytes outputData(final MessageFrame frame) { - final Range returnDataSegment = outputDataSpan(frame); - return maybeShadowReadMemory(returnDataSegment, frame); - } - - public static Range logDataSegment(final MessageFrame frame) { - long offset = Words.clampedToLong(frame.getStackItem(0)); - long length = Words.clampedToLong(frame.getStackItem(1)); - return Range.fromOffsetAndSize(offset, length); - } - - public Range logDataSegment() { - return logDataSegment(this.hub.messageFrame()); - } - - public static Bytes logData(final MessageFrame frame) { - return maybeShadowReadMemory(logDataSegment(frame), frame); - } - - public Bytes logData() { - return logData(this.hub.messageFrame()); - } } From 373efd09f824d741125757ed49cdd3e8ad1b18df Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Mon, 27 Jan 2025 11:27:37 +0100 Subject: [PATCH 36/54] Update Linea Besu to 25.1-delivery44 (#1742) Signed-off-by: Fabio Di Fabio --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a592e7c08..2a21e7fd1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=beta-v1.2.0-rc2 -besuVersion=25.1-develop-448d1a9 +besuVersion=25.1-delivery44 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ From 17c3732f237df9f5daa8252ba3f77771b4e82782 Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Mon, 27 Jan 2025 14:58:58 +0100 Subject: [PATCH 37/54] release: bump version to beta-v1.2.0-rc3 and update changelog (#1744) Signed-off-by: Lorenzo Gentile --- CHANGELOG.md | 4 ++++ gradle.properties | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39fb0fa82..eb145a8af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## beta-v1.2.0-rc3 +* Update Linea Besu to 25.1-delivery44 (#1742) +* clean: remove dead code (#1733) + ## beta-v1-2.0-rc2 * Use both traceStartBlock method calls wherever suitable (#1711) * Fix/refacto blockdata files (#1724) diff --git a/gradle.properties b/gradle.properties index 2a21e7fd1..07cab138e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -releaseVersion=beta-v1.2.0-rc2 +releaseVersion=beta-v1.2.0-rc3 besuVersion=25.1-delivery44 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer From 4cab8f746c1cf28efcb2a3a33d8eeb72ecde7e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:20:44 +0100 Subject: [PATCH 38/54] clean: don't store mmu and mxp stamps with hub and log stamps (#1747) Signed-off-by: F Bojarski --- .../linea/zktracer/module/hub/State.java | 34 +++++++++++++------ .../module/hub/fragment/TraceSubFragment.java | 2 +- .../module/hub/fragment/imc/ImcFragment.java | 6 ++-- .../module/hub/fragment/imc/MxpCall.java | 4 +-- .../module/hub/fragment/imc/mmu/MmuCall.java | 4 +-- .../module/hub/section/TraceSection.java | 4 +-- 6 files changed, 33 insertions(+), 21 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/State.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/State.java index e311d0c13..7d9972fc1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/State.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/State.java @@ -46,6 +46,24 @@ public Stamps stamps() { return this.current().stamps; } + /** Increments at commit time */ + @Getter + @Accessors(fluent = true) + private int mxpStamp = 0; + + /** Increments at commit time */ + @Getter + @Accessors(fluent = true) + private int mmuStamp = 0; + + public void incrementMmuStamp() { + mmuStamp++; + } + + public void incrementMxpStamp() { + mxpStamp++; + } + @Getter @Setter HubProcessingPhase processingPhase; @RequiredArgsConstructor @@ -149,14 +167,16 @@ TxState spinOff() { return new TxState(stamps.snapshot()); } - /** Stores all the stamps associated to the tracing of a transaction. */ + /** + * Stores the HUB and LOG stamps associated to the tracing of a transaction. As the MMU and MXP + * stamps increment only at commit time and are not required during execution, they are not part + * of this class. + */ @Accessors(fluent = true) @Getter public static class Stamps { private int hub = 0; // increments during execution private int log = 0; // increments at RunPostTx - private int mxp = 0; // increments only at commit time - private int mmu = 0; // increments only at commit time public Stamps() {} @@ -173,14 +193,6 @@ public void incrementHubStamp() { hub++; } - public void incrementMmuStamp() { - mmu++; - } - - public void incrementMxpStamp() { - mxp++; - } - public int incrementLogStamp() { return ++log; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TraceSubFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TraceSubFragment.java index 2b5c15dfa..e44a78e67 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TraceSubFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/TraceSubFragment.java @@ -23,7 +23,7 @@ default Trace trace(Trace trace) { return trace; } - default Trace trace(Trace trace, State.TxState.Stamps stamps) { + default Trace trace(Trace trace, State hubState) { return trace(trace); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java index fced974ec..55ef379f1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/ImcFragment.java @@ -140,12 +140,12 @@ public Trace trace(Trace trace) { for (TraceSubFragment subFragment : moduleCalls) { if (subFragment instanceof MmuCall) { - MmuCall mmuCall = (MmuCall) subFragment; + final MmuCall mmuCall = (MmuCall) subFragment; if (mmuCall.traceMe()) { - subFragment.trace(trace, hub.state.stamps()); + subFragment.trace(trace, hub.state); } } else { - subFragment.trace(trace, hub.state.stamps()); + subFragment.trace(trace, hub.state); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/MxpCall.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/MxpCall.java index af0efe92d..fcd9c45d6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/MxpCall.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/MxpCall.java @@ -63,8 +63,8 @@ public boolean getSize2NonZeroNoMxpx() { return !this.mxpx && !this.size2.isZero(); } - public Trace trace(Trace trace, State.TxState.Stamps stamps) { - stamps.incrementMxpStamp(); + public Trace trace(Trace trace, State hubState) { + hubState.incrementMxpStamp(); return trace .pMiscMxpFlag(true) .pMiscMxpInst(this.opCodeData.value()) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java index 0ac0d43e5..c04d70cfd 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java @@ -783,8 +783,8 @@ public static MmuCall forModexpPartialResultCopy( } @Override - public Trace trace(Trace trace, State.TxState.Stamps stamps) { - stamps.incrementMmuStamp(); + public Trace trace(Trace trace, State hubState) { + hubState.incrementMmuStamp(); return trace .pMiscMmuFlag(true) .pMiscMmuInst(instruction) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java index 6d52b069d..e974f3b8c 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java @@ -234,8 +234,8 @@ public void trace(Trace hubTrace) { commonValues, stackLineCounter, nonStackLineCounter, - hub().state.stamps().mmu(), - hub().state.stamps().mxp()); + hub().state.mmuStamp(), + hub().state.mxpStamp()); commonFragment.trace(hubTrace); hubTrace.fillAndValidateRow(); } From 0f5bbb540970c5ea349b2a960bc34fe8b954e13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:22:38 +0100 Subject: [PATCH 39/54] fix wcp line count for operations coming from block data (#1729) * fix wcp line count for operations coming from block data Signed-off-by: F Bojarski * fix: count additional rows for wcp calls from blockhash + popping addtional rows for EUC Signed-off-by: F Bojarski * ras Signed-off-by: F Bojarski * update to last master constraints Signed-off-by: F Bojarski --------- Signed-off-by: F Bojarski --- .../zktracer/module/blockdata/Blockdata.java | 66 ++++++++-------- .../module/blockdata/BlockdataOperation.java | 11 +-- .../zktracer/module/blockhash/Blockhash.java | 15 ++-- .../module/blockhash/BlockhashOperation.java | 78 +++++++------------ .../linea/zktracer/module/euc/Euc.java | 23 ++++++ 5 files changed, 100 insertions(+), 93 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java index 094b9949e..c97fb7034 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java @@ -15,7 +15,9 @@ package net.consensys.linea.zktracer.module.blockdata; +import static net.consensys.linea.zktracer.module.blockdata.Trace.GAS_LIMIT_MAXIMUM; import static net.consensys.linea.zktracer.module.blockdata.Trace.nROWS_DEPTH; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import java.math.BigInteger; import java.nio.MappedByteBuffer; @@ -30,7 +32,6 @@ import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.types.EWord; import org.apache.tuweni.bytes.Bytes; -import org.hyperledger.besu.evm.worldstate.WorldView; import org.hyperledger.besu.plugin.data.BlockBody; import org.hyperledger.besu.plugin.data.BlockHeader; @@ -41,12 +42,8 @@ public class Blockdata implements Module { private final TxnData txnData; private final Deque operations = new ArrayDeque<>(); - private static final int TIMESTAMP_BYTESIZE = 4; - private BlockHeader prevBlockHeader; - private int traceCounter = 0; private long firstBlockNumber; private Bytes chainId; - private boolean shouldBeTraced = true; final OpCode[] opCodes = { OpCode.COINBASE, @@ -69,42 +66,47 @@ public String moduleKey() { @Override public void traceStartConflation(final long blockCount) { - wcp.additionalRows.add(TIMESTAMP_BYTESIZE); // TODO: check + wcp.additionalRows.add( + LLARGE // for COINBASE + + 6 + + 6 // for TIMESTAMP + + 1 + + 6 // for NUMBER + + 1 // for DIFFICULTY + + Bytes.minimalBytes(GAS_LIMIT_MAXIMUM).size() * 4 // for GASLIMIT + + LLARGE // for CHAINID + + LLARGE // for BASEFEE + ); + + euc.additionalRows.add(8); } @Override public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { final long blockNumber = blockHeader.getNumber(); - firstBlockNumber = (traceCounter < opCodes.length) ? blockNumber : firstBlockNumber; - if (shouldBeTraced) { - for (OpCode opCode : opCodes) { - BlockdataOperation operation = - new BlockdataOperation( - txnData.hub(), - blockHeader, - prevBlockHeader, - txnData.currentBlock().getNbOfTxsInBlock(), - wcp, - euc, - chainId, - opCode, - firstBlockNumber); - operations.addLast(operation); - // Increase counter to track where we are in the conflation - traceCounter++; - } + if (operations.isEmpty()) { + firstBlockNumber = blockNumber; + } + final BlockHeader previousBlockHeader = + operations.isEmpty() ? null : operations.getLast().blockHeader(); + for (OpCode opCode : opCodes) { + final BlockdataOperation operation = + new BlockdataOperation( + txnData.hub(), + blockHeader, + previousBlockHeader, + txnData.currentBlock().getNbOfTxsInBlock(), + wcp, + euc, + chainId, + opCode, + firstBlockNumber); + operations.addLast(operation); } - prevBlockHeader = blockHeader; - shouldBeTraced = false; } @Override - public void traceEndConflation(final WorldView state) {} - - @Override - public void enterTransaction() { - shouldBeTraced = true; - } + public void enterTransaction() {} @Override public void popTransaction() {} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java index 650614a19..d15c7aa4a 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/BlockdataOperation.java @@ -142,7 +142,7 @@ private void handleCoinbase() { private void handleTimestamp() { data = EWord.of(blockHeader.getTimestamp()); - EWord prevData = + final EWord prevData = prevBlockHeader == null ? EWord.ZERO : EWord.of(prevBlockHeader.getTimestamp()); // row i @@ -182,11 +182,11 @@ private void handleGasLimit() { wcpCallToLEQ(1, data, EWord.of(Bytes.ofUnsignedLong(GAS_LIMIT_MAXIMUM))); if (!firstBlockInConflation) { - EWord prevGasLimit = EWord.of(prevBlockHeader.getGasLimit()); + final EWord prevGasLimit = EWord.of(prevBlockHeader.getGasLimit()); // row i + 2 - Bytes maxDeviation = eucCall(2, prevGasLimit, EWord.of(GAS_LIMIT_ADJUSTMENT_FACTOR)); + final Bytes maxDeviation = eucCall(2, prevGasLimit, EWord.of(GAS_LIMIT_ADJUSTMENT_FACTOR)); // row i + 3 - BigInteger safeGasLimitUpperBound = + final BigInteger safeGasLimitUpperBound = prevGasLimit.getAsBigInteger().add(maxDeviation.toUnsignedBigInteger()); wcpCallToLT(3, data, EWord.of(safeGasLimitUpperBound)); @@ -303,9 +303,6 @@ private boolean wcpCallToISZERO(int w, EWord arg1) { } private Bytes eucCall(int w, EWord arg1, EWord arg2) { - checkArgument(arg1.bitLength() / 8 <= 16); - checkArgument(arg2.bitLength() / 8 <= 16); - this.arg1[w] = arg1; this.arg2[w] = arg2; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java index 7ce39c801..ebdab0d36 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java @@ -16,6 +16,7 @@ package net.consensys.linea.zktracer.module.blockhash; import static com.google.common.base.Preconditions.checkArgument; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; import java.nio.MappedByteBuffer; import java.util.HashMap; @@ -89,12 +90,14 @@ public void resolvePostExecution( Hub hub, MessageFrame frame, Operation.OperationResult operationResult) { final OpCode opCode = OpCode.of(frame.getCurrentOperation().getOpcode()); - if (opCode == OpCode.BLOCKHASH) { - final Bytes32 blockhashRes = Bytes32.leftPad(frame.getStackItem(0)); - operations.add(new BlockhashOperation(relBlock, absBlock, blockhashArg, blockhashRes, wcp)); - if (blockhashRes != Bytes32.ZERO) { - blockHashMap.put(blockhashArg, blockhashRes); - } + checkArgument(opCode == OpCode.BLOCKHASH); + final Bytes32 blockhashRes = Bytes32.leftPad(frame.getStackItem(0)); + operations.add(new BlockhashOperation(relBlock, absBlock, blockhashArg, blockhashRes, wcp)); + // We have 4 LLARGE and one OLI call to WCP, made at the end of the conflation, so we need to + // add line count to WCP + wcp.additionalRows.add(4 * LLARGE + 1); + if (blockhashRes != Bytes32.ZERO) { + blockHashMap.put(blockhashArg, blockhashRes); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java index f0285cb51..2fcd634a9 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/BlockhashOperation.java @@ -17,10 +17,7 @@ import static net.consensys.linea.zktracer.module.blockhash.Trace.BLOCKHASH_DEPTH; import static net.consensys.linea.zktracer.module.blockhash.Trace.nROWS_PRPRC; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_EQ; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.EVM_INST_LT; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; -import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WCP_INST_LEQ; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -60,36 +57,30 @@ public BlockhashOperation( } void handlePreprocessing(Bytes32 prevBlockhashArg) { - final Bytes prevBHArgHi = prevBlockhashArg.slice(0, LLARGE); - final Bytes prevBHArgLo = prevBlockhashArg.slice(LLARGE, LLARGE); - final Bytes currBHArgHi = blockhashArg.slice(0, LLARGE); - final Bytes curBHArgLo = blockhashArg.slice(LLARGE, LLARGE); // NOTE: w goes from 0 to 4 because it refers to the array // however, rows go from i+1 to i+5 because it refers the MACRO row (index i) // row i + 1 - wcpCallToLEQ(0, prevBHArgHi, prevBHArgLo, currBHArgHi, curBHArgLo); + wcpCallToLEQ(0, prevBlockhashArg, blockhashArg); // row i + 2 - boolean sameBHArg = wcpCallToEQ(1, prevBHArgHi, prevBHArgLo, currBHArgHi, curBHArgLo); + wcpCallToEQ(1, prevBlockhashArg, blockhashArg); // row i + 3 - boolean res3 = + final boolean blockNumberGreaterThan256 = wcpCallToLEQ( - 2, Bytes.of(0), Bytes.ofUnsignedInt(256), Bytes.of(0), Bytes.ofUnsignedLong(absBlock)); - long minimalReachable = 0; - if (res3) { - minimalReachable = absBlock - 256; - } + 2, + Bytes32.leftPad(Bytes.minimalBytes(BLOCKHASH_MAX_HISTORY)), + Bytes32.leftPad(Bytes.ofUnsignedLong(absBlock))); + final long minimalReachable = blockNumberGreaterThan256 ? absBlock - BLOCKHASH_MAX_HISTORY : 0; // row i + 4 - boolean upperBoundOk = - wcpCallToLT(3, currBHArgHi, curBHArgLo, Bytes.of(0), Bytes.ofUnsignedLong(absBlock)); + final boolean upperBoundOk = + wcpCallToLT(3, blockhashArg, Bytes32.leftPad(Bytes.ofUnsignedLong(absBlock))); // row i + 5 - boolean lowerBoundOk = - wcpCallToLEQ( - 4, Bytes.of(0), Bytes.ofUnsignedLong(minimalReachable), currBHArgHi, curBHArgLo); + final boolean lowerBoundOk = + wcpCallToLEQ(4, Bytes32.leftPad(Bytes.ofUnsignedLong(minimalReachable)), blockhashArg); } @Override @@ -132,42 +123,33 @@ public void tracePreprocessing(Trace trace) { } // WCP calls - private boolean wcpCallToLT( - int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + private boolean wcpCallToLT(int w, Bytes32 exoArg1, Bytes32 exoArg2) { this.exoInst[w] = EVM_INST_LT; - this.exoArg1Hi[w] = exoArg1Hi; - this.exoArg1Lo[w] = exoArg1Lo; - this.exoArg2Hi[w] = exoArg2Hi; - this.exoArg2Lo[w] = exoArg2Lo; - this.exoRes[w] = - wcp.callLT( - Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + this.exoArg1Hi[w] = exoArg1.slice(0, LLARGE); + this.exoArg1Lo[w] = exoArg1.slice(LLARGE, LLARGE); + this.exoArg2Hi[w] = exoArg2.slice(0, LLARGE); + this.exoArg2Lo[w] = exoArg2.slice(LLARGE, LLARGE); + this.exoRes[w] = wcp.callLT(exoArg1, exoArg2); return this.exoRes[w]; } - private boolean wcpCallToLEQ( - int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + private boolean wcpCallToLEQ(int w, Bytes32 exoArg1, Bytes32 exoArg2) { this.exoInst[w] = WCP_INST_LEQ; - this.exoArg1Hi[w] = exoArg1Hi; - this.exoArg1Lo[w] = exoArg1Lo; - this.exoArg2Hi[w] = exoArg2Hi; - this.exoArg2Lo[w] = exoArg2Lo; - this.exoRes[w] = - wcp.callLEQ( - Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + this.exoArg1Hi[w] = exoArg1.slice(0, LLARGE); + this.exoArg1Lo[w] = exoArg1.slice(LLARGE, LLARGE); + this.exoArg2Hi[w] = exoArg2.slice(0, LLARGE); + this.exoArg2Lo[w] = exoArg2.slice(LLARGE, LLARGE); + this.exoRes[w] = wcp.callLEQ(exoArg1, exoArg2); return this.exoRes[w]; } - private boolean wcpCallToEQ( - int w, Bytes exoArg1Hi, Bytes exoArg1Lo, Bytes exoArg2Hi, Bytes exoArg2Lo) { + private boolean wcpCallToEQ(int w, Bytes32 exoArg1, Bytes32 exoArg2) { this.exoInst[w] = EVM_INST_EQ; - this.exoArg1Hi[w] = exoArg1Hi; - this.exoArg1Lo[w] = exoArg1Lo; - this.exoArg2Hi[w] = exoArg2Hi; - this.exoArg2Lo[w] = exoArg2Lo; - this.exoRes[w] = - wcp.callEQ( - Bytes.concatenate(exoArg1Hi, exoArg1Lo), Bytes.concatenate(exoArg2Hi, exoArg2Lo)); + this.exoArg1Hi[w] = exoArg1.slice(0, LLARGE); + this.exoArg1Lo[w] = exoArg1.slice(LLARGE, LLARGE); + this.exoArg2Hi[w] = exoArg2.slice(0, LLARGE); + this.exoArg2Lo[w] = exoArg2.slice(LLARGE, LLARGE); + this.exoRes[w] = wcp.callEQ(exoArg1, exoArg2); return this.exoRes[w]; } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/euc/Euc.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/euc/Euc.java index 3ad5932b2..500af4264 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/euc/Euc.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/euc/Euc.java @@ -26,6 +26,7 @@ import lombok.experimental.Accessors; import net.consensys.linea.zktracer.ColumnHeader; import net.consensys.linea.zktracer.container.module.OperationSetModule; +import net.consensys.linea.zktracer.container.stacked.CountOnlyOperation; import net.consensys.linea.zktracer.container.stacked.ModuleOperationStackedSet; import net.consensys.linea.zktracer.module.wcp.Wcp; import org.apache.tuweni.bytes.Bytes; @@ -39,11 +40,26 @@ public class Euc implements OperationSetModule { private final ModuleOperationStackedSet operations = new ModuleOperationStackedSet<>(); + /** count the number of rows that could be added after the sequencer counts the number of line */ + public final CountOnlyOperation additionalRows = new CountOnlyOperation(); + @Override public String moduleKey() { return "EUC"; } + @Override + public void enterTransaction() { + OperationSetModule.super.enterTransaction(); + additionalRows.lineCount(); + } + + @Override + public void popTransaction() { + OperationSetModule.super.popTransaction(); + additionalRows.pop(); + } + @Override public List columnsHeaders() { return Trace.headers(this.lineCount()); @@ -57,6 +73,13 @@ public void commit(List buffers) { } } + @Override + public int lineCount() { + return operations.conflationFinished() + ? operations.lineCount() + : operations().lineCount() + additionalRows.lineCount(); + } + public EucOperation callEUC(final Bytes dividend, final Bytes divisor) { final BigInteger dividendBI = dividend.toUnsignedBigInteger(); final BigInteger divisorBI = divisor.toUnsignedBigInteger(); From 29b18f35f43b6ce9eaa433ce166855c853cd3072 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Fri, 31 Jan 2025 09:36:47 +1300 Subject: [PATCH 40/54] update `go-corset` to latest (#1739) This also updates `linea-constraints` to latest master. --- .github/actions/setup-go-corset/action.yml | 2 +- linea-constraints | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index e009396e3..8b63e68d7 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@fe70003 + run: go install github.com/consensys/go-corset/cmd/go-corset@e5e0938 diff --git a/linea-constraints b/linea-constraints index e0a8b82ef..e23c58aca 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit e0a8b82ef8c43bff72c9924224b764398cc6ec3d +Subproject commit e23c58acafdc6ace630ef41d20aaea3958a7ff5a From dadff1ec5202c9a4fb86b7b6af812eecd7fdb741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Fri, 31 Jan 2025 11:28:00 +0100 Subject: [PATCH 41/54] fix: blockdata line counting & traceEndBlock trigger in ref tests (#1751) * blockdata fix: missing one count for traxce limit Signed-off-by: F Bojarski * update blockdata constraints Signed-off-by: F Bojarski * fix: calling twice traceEndBlock for ref tests Signed-off-by: F Bojarski --------- Signed-off-by: F Bojarski --- .../zktracer/module/blockdata/Blockdata.java | 22 +-- .../linea/zktracer/module/hub/Hub.java | 4 +- .../MessageCallTests.java | 2 +- .../RootOfMessageCallTests.java | 2 +- .../todo.md | 0 .../CallArguments.java | 2 +- .../CallArgumentsMaybeRedundant.java | 2 +- .../ReturnRevertArguments.java | 2 +- .../module/rlptxn/TestRandomTxns.java | 165 ------------------ .../linea/BlockchainReferenceTestTools.java | 3 +- 10 files changed, 21 insertions(+), 183 deletions(-) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ContextFamilyTests => contextFamily}/MessageCallTests.java (97%) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ContextFamilyTests => contextFamily}/RootOfMessageCallTests.java (93%) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ContextFamilyTests => contextFamily}/todo.md (100%) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ZeroSizeTests => zeroSize}/CallArguments.java (97%) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ZeroSizeTests => zeroSize}/CallArgumentsMaybeRedundant.java (98%) rename arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/{ZeroSizeTests => zeroSize}/ReturnRevertArguments.java (99%) delete mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java index c97fb7034..a0b9d88a6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockdata/Blockdata.java @@ -19,7 +19,6 @@ import static net.consensys.linea.zktracer.module.blockdata.Trace.nROWS_DEPTH; import static net.consensys.linea.zktracer.module.constants.GlobalConstants.LLARGE; -import java.math.BigInteger; import java.nio.MappedByteBuffer; import java.util.*; @@ -30,8 +29,8 @@ import net.consensys.linea.zktracer.module.txndata.TxnData; import net.consensys.linea.zktracer.module.wcp.Wcp; import net.consensys.linea.zktracer.opcode.OpCode; -import net.consensys.linea.zktracer.types.EWord; import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.evm.worldstate.WorldView; import org.hyperledger.besu.plugin.data.BlockBody; import org.hyperledger.besu.plugin.data.BlockHeader; @@ -40,12 +39,14 @@ public class Blockdata implements Module { private final Wcp wcp; private final Euc euc; private final TxnData txnData; + private final Bytes chainId; - private final Deque operations = new ArrayDeque<>(); + private final List operations = new ArrayList<>(); private long firstBlockNumber; - private Bytes chainId; - final OpCode[] opCodes = { + private boolean conflationFinished = false; + + private static final OpCode[] opCodes = { OpCode.COINBASE, OpCode.TIMESTAMP, OpCode.NUMBER, @@ -55,10 +56,6 @@ public class Blockdata implements Module { OpCode.BASEFEE }; - public void setChainId(BigInteger chainId) { - this.chainId = EWord.of(chainId).lo(); - } - @Override public String moduleKey() { return "BLOCK_DATA"; @@ -81,6 +78,11 @@ public void traceStartConflation(final long blockCount) { euc.additionalRows.add(8); } + @Override + public void traceEndConflation(final WorldView state) { + conflationFinished = true; + } + @Override public void traceEndBlock(final BlockHeader blockHeader, final BlockBody blockBody) { final long blockNumber = blockHeader.getNumber(); @@ -113,7 +115,7 @@ public void popTransaction() {} @Override public int lineCount() { - final int numberOfBlock = (operations.size() / opCodes.length); + final int numberOfBlock = (operations.size() / opCodes.length) + (conflationFinished ? 0 : 1); return numberOfBlock * nROWS_DEPTH; } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index cc8d20533..2f783739c 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -113,6 +113,7 @@ import net.consensys.linea.zktracer.runtime.stack.StackContext; import net.consensys.linea.zktracer.runtime.stack.StackLine; import net.consensys.linea.zktracer.types.Bytecode; +import net.consensys.linea.zktracer.types.EWord; import net.consensys.linea.zktracer.types.MemoryRange; import net.consensys.linea.zktracer.types.TransactionProcessingMetadata; import org.apache.tuweni.bytes.Bytes; @@ -388,8 +389,7 @@ public Hub(final Address l2l1ContractAddress, final Bytes l2l1Topic, final BigIn l2L1Logs = new L2L1Logs(l2Block); keccak = new Keccak(ecRecoverEffectiveCall, l2Block); shakiraData = new ShakiraData(wcp, sha256Blocks, keccak, ripemdBlocks); - blockdata = new Blockdata(wcp, euc, txnData); - blockdata.setChainId(chainId); + blockdata = new Blockdata(wcp, euc, txnData, EWord.of(chainId)); mmu = new Mmu(euc, wcp); mmio = new Mmio(mmu); diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/MessageCallTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/MessageCallTests.java similarity index 97% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/MessageCallTests.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/MessageCallTests.java index ff873d57c..7734b5fbe 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/MessageCallTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/MessageCallTests.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.instructionprocessing.ContextFamilyTests; +package net.consensys.linea.zktracer.instructionprocessing.contextFamily; import static net.consensys.linea.zktracer.instructionprocessing.utilities.Calls.appendCall; import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.keyPair; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/RootOfMessageCallTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/RootOfMessageCallTests.java similarity index 93% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/RootOfMessageCallTests.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/RootOfMessageCallTests.java index c3b5224a1..c159edb15 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/RootOfMessageCallTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/RootOfMessageCallTests.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.instructionprocessing.ContextFamilyTests; +package net.consensys.linea.zktracer.instructionprocessing.contextFamily; import static net.consensys.linea.zktracer.instructionprocessing.utilities.MultiOpCodeSmcs.allContextOpCodes; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/todo.md b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/todo.md similarity index 100% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ContextFamilyTests/todo.md rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/contextFamily/todo.md diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArguments.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArguments.java similarity index 97% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArguments.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArguments.java index 6c8f92a87..bd29f5282 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArguments.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArguments.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.instructionprocessing.ZeroSizeTests; +package net.consensys.linea.zktracer.instructionprocessing.zeroSize; import static net.consensys.linea.zktracer.instructionprocessing.utilities.Calls.*; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArgumentsMaybeRedundant.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java similarity index 98% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArgumentsMaybeRedundant.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java index 6f5ec84ab..b5b5c27b1 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/CallArgumentsMaybeRedundant.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.instructionprocessing.ZeroSizeTests; +package net.consensys.linea.zktracer.instructionprocessing.zeroSize; import java.util.List; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/ReturnRevertArguments.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/ReturnRevertArguments.java similarity index 99% rename from arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/ReturnRevertArguments.java rename to arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/ReturnRevertArguments.java index 7a87e7789..4f0a10a91 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/ZeroSizeTests/ReturnRevertArguments.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/ReturnRevertArguments.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.zktracer.instructionprocessing.ZeroSizeTests; +package net.consensys.linea.zktracer.instructionprocessing.zeroSize; import static com.google.common.base.Preconditions.checkArgument; import static net.consensys.linea.zktracer.instructionprocessing.utilities.MonoOpCodeSmcs.keyPair; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java deleted file mode 100644 index 883e84a89..000000000 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/rlptxn/TestRandomTxns.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright Consensys Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package net.consensys.linea.zktracer.module.rlptxn; - -import java.util.Random; - -class TestRandomTxns { - private final Random rnd = new Random(666); - private static final int TEST_TX_COUNT = 200; - - // @Test - // void test() { - // OpCodes.load(); - // ToyWorld.ToyWorldBuilder world = ToyWorld.builder(); - // List txList = new ArrayList<>(); - // - // for (int i = 0; i < TEST_TX_COUNT; i++) { - // KeyPair keyPair = new SECP256K1().generateKeyPair(); - // Address senderAddress = - // Address.extract(Hash.hash(keyPair.getPublicKey().getEncodedBytes())); - // ToyAccount senderAccount = randToyAccount(senderAddress); - // ToyAccount receiverAccount = receiverAccount(); - // - // world.account(senderAccount).account(receiverAccount); - // txList.add(randTx(senderAccount, keyPair, receiverAccount)); - // } - // ToyExecutionEnvironment.builder() - // .toyWorld(world.build()) - // .transactions(txList) - // - // .transactionProcessingResultValidator(TransactionProcessingResultValidator.EMPTY_VALIDATOR) - // .build() - // .run(); - // } - // - // final Transaction randTx(ToyAccount senderAccount, KeyPair keyPair, ToyAccount - // receiverAccount) { - // - // int txType = rnd.nextInt(0, 6); - // - // return switch (txType) { - // case 0 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.FRONTIER) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randBigInt(true))) - // .payload(randData(false)) - // .build(); - // - // case 1 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.FRONTIER) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randBigInt(true))) - // .to(receiverAccount) - // .payload(randData(false)) - // .build(); - // - // case 2 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.ACCESS_LIST) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randLong())) - // .payload(randData(false)) - // .accessList(randAccessList()) - // .build(); - // - // case 3 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.ACCESS_LIST) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randLong())) - // .to(receiverAccount) - // .payload(randData(false)) - // .accessList(randAccessList()) - // .build(); - // - // case 4 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.EIP1559) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randLong())) - // .payload(randData(false)) - // .accessList(randAccessList()) - // .build(); - // - // case 5 -> ToyTransaction.builder() - // .sender(senderAccount) - // .keyPair(keyPair) - // .transactionType(TransactionType.EIP1559) - // .gasLimit(rnd.nextLong(21000, 0xfffffffffffffL)) - // .value(Wei.of(randLong())) - // .to(receiverAccount) - // .payload(randData(false)) - // .accessList(randAccessList()) - // .build(); - // - // default -> throw new IllegalStateException("Unexpected value: " + txType); - // }; - // } - // - // final List randAccessList() { - // List accessList = new ArrayList<>(); - // boolean entries = rnd.nextBoolean(); - // if (entries) { - // for (int i = 1; i < 25; i++) { - // accessList.add(randAccessListEntry()); - // } - // } - // return accessList; - // } - // - // final AccessListEntry randAccessListEntry() { - // List keyList = new ArrayList<>(); - // boolean key = rnd.nextBoolean(); - // if (key) { - // for (int nKey = 1; nKey < rnd.nextInt(1, 20); nKey++) { - // keyList.add(Bytes32.random(rnd)); - // } - // } - // return new AccessListEntry(Address.wrap(Bytes.random(20, rnd)), keyList); - // } - // - // final ToyAccount receiverAccount() { - // - // return ToyAccount.builder() - // .balance(Wei.v_ONE) - // .nonce(6) - // .address(Address.wrap(Bytes.random(20, rnd))) - // .code( - // BytecodeCompiler.newProgram() - // .push(32, 0xbeef) - // .push(32, 0xdead) - // .op(OpCode.ADD) - // .compile()) - // .build(); - // } - // - // final ToyAccount randToyAccount(Address senderAddress) { - // - // return ToyAccount.builder() - // .balance(Wei.wrap(Bytes.random(16, rnd))) - // .nonce(randLong()) - // .address(senderAddress) - // .build(); - // } -} diff --git a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java index 31075c397..d4abd565c 100644 --- a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java @@ -412,6 +412,8 @@ public static void executeTest(final BlockchainReferenceTestCaseSpec spec) { ? HeaderValidationMode.LIGHT : HeaderValidationMode.FULL; + // Note: somehow this function is calling traceEndBlock through + // blockValidator.validateAndProcessBlock final BlockImportResult importResult = blockImporter.importBlock(context, block, validationMode, validationMode); log.info( @@ -425,7 +427,6 @@ public static void executeTest(final BlockchainReferenceTestCaseSpec spec) { importResult.isImported(), candidateBlock.isValid()); - zkTracer.traceEndBlock(block.getHeader(), block.getBody()); } catch (final RLPException e) { log.info("caught RLP exception, checking it's invalid {}", candidateBlock.isValid()); assertThat(candidateBlock.isValid()).isFalse(); From 77582d7f697cb6ef4299d4aafedc70a17035f7f3 Mon Sep 17 00:00:00 2001 From: David Pearce Date: Mon, 3 Feb 2025 22:37:29 +1300 Subject: [PATCH 42/54] fix: nightly tests (#1755) This fixes issues with the nightly tests failing. Since the `HUB` constraints were introduced, these have been consistently failing. The problem is the amount of work / time required for them. This PR addresses this in two ways: firstly, the longest running nigntly tests are marked `@Disabled` for now; secondly, the abstraction level used for `go-corset check` is raised from `air` (lowest) to `hir` (highest). This means `go-corset` has less work to do checking the constraints. But it also means the checking is not as complete. --- .github/workflows/gradle-nightly-tests.yml | 7 +-- .gitignore | 1 + .../linea/replaytests/Issue1124Tests.java | 2 + .../linea/replaytests/Issue1126Tests.java | 44 ++++++++++--------- .../linea/testing/ExecutionEnvironment.java | 3 +- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index ad98f0c6b..12096fdea 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -8,7 +8,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: nightly-tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl @@ -24,12 +24,13 @@ jobs: go-corset: true - name: Run Nightly tests - run: GOMEMLIMIT=64GiB ./gradlew nightlyTests + run: GOMEMLIMIT=32GiB ./gradlew nightlyTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -vw --ansi-escapes=false --report --mir + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --hir ZKEVM_BIN: "zkevm.go.bin" + NIGHTLY_TESTS_PARALLELISM: 2 - name: Upload test report if: ${{ always() }} diff --git a/.gitignore b/.gitignore index 5acaa3683..81f20f7eb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.swp *.log *.out +*~ nohup.out .classpath .DS_Store diff --git a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1124Tests.java b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1124Tests.java index aaadab9f7..d76a1c7d6 100644 --- a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1124Tests.java +++ b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1124Tests.java @@ -18,6 +18,7 @@ import static net.consensys.linea.testing.ReplayExecutionEnvironment.LINEA_MAINNET; import net.consensys.linea.UnitTestWatcher; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -25,6 +26,7 @@ /** STP constraints were failing for these ranges */ @Tag("replay") @Tag("nightly") +@Disabled @ExtendWith(UnitTestWatcher.class) public class Issue1124Tests { diff --git a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1126Tests.java b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1126Tests.java index c7670efa9..4e8a520cc 100644 --- a/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1126Tests.java +++ b/arithmetization/src/test/java/net/consensys/linea/replaytests/Issue1126Tests.java @@ -18,6 +18,7 @@ import static net.consensys.linea.testing.ReplayExecutionEnvironment.LINEA_MAINNET; import net.consensys.linea.UnitTestWatcher; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -38,110 +39,111 @@ *

See https://github.com/Consensys/linea-tracer/issues/1121 */ @Tag("nightly") +@Disabled @ExtendWith(UnitTestWatcher.class) public class Issue1126Tests { @Test - void test_3108622_3108633() { + void issue_1126_3108622_3108633() { replay(LINEA_MAINNET, "3108622-3108633.mainnet.json.gz"); } @Test - void test_3175608_3175636() { + void issue_1126_3175608_3175636() { replay(LINEA_MAINNET, "3175608-3175636.mainnet.json.gz"); } @Test - void test_3432730_3432768() { + void issue_1126_3432730_3432768() { replay(LINEA_MAINNET, "3432730-3432768.mainnet.json.gz"); } @Test - void test_4392225_4392280() { + void issue_1126_4392225_4392280() { replay(LINEA_MAINNET, "4392225-4392280.mainnet.json.gz"); } @Test - void test_4477086_4477226() { + void issue_1126_4477086_4477226() { replay(LINEA_MAINNET, "4477086-4477226.mainnet.json.gz"); } @Test - void test_3290673_3290679() { + void issue_1126_3290673_3290679() { replay(LINEA_MAINNET, "3290673-3290679.mainnet.json.gz"); } @Test - void test_3290746_3290752() { + void issue_1126_3290746_3290752() { replay(LINEA_MAINNET, "3290746-3290752.mainnet.json.gz"); } @Test - void test_3315684_3315690() { + void issue_1126_3315684_3315690() { replay(LINEA_MAINNET, "3315684-3315690.mainnet.json.gz"); } @Test - void test_3374278_3374284() { + void issue_1126_3374278_3374284() { replay(LINEA_MAINNET, "3374278-3374284.mainnet.json.gz"); } @Test - void test_3385404_3385411() { + void issue_1126_3385404_3385411() { replay(LINEA_MAINNET, "3385404-3385411.mainnet.json.gz"); } @Test - void test_3410170_3410240() { + void issue_1126_3410170_3410240() { replay(LINEA_MAINNET, "3410170-3410240.mainnet.json.gz"); } @Test - void test_3423488_3423521() { + void issue_1126_3423488_3423521() { replay(LINEA_MAINNET, "3423488-3423521.mainnet.json.gz"); } @Test - void test_3424829_3424864() { + void issue_1126_3424829_3424864() { replay(LINEA_MAINNET, "3424829-3424864.mainnet.json.gz"); } @Test - void test_3429701_3429735() { + void issue_1126_3429701_3429735() { replay(LINEA_MAINNET, "3429701-3429735.mainnet.json.gz"); } @Test - void test_3431193_3431232() { + void issue_1126_3431193_3431232() { replay(LINEA_MAINNET, "3431193-3431232.mainnet.json.gz"); } @Test - void test_3431567_3431601() { + void issue_1126_3431567_3431601() { replay(LINEA_MAINNET, "3431567-3431601.mainnet.json.gz"); } @Test - void test_4323962_4324012() { + void issue_1126_4323962_4324012() { replay(LINEA_MAINNET, "4323962-4324012.mainnet.json.gz"); } @Test - void test_4343434_4343473() { + void issue_1126_4343434_4343473() { replay(LINEA_MAINNET, "4343434-4343473.mainnet.json.gz"); } @Test - void test_4519246_4519309() { + void issue_1126_4519246_4519309() { replay(LINEA_MAINNET, "4519246-4519309.mainnet.json.gz"); } @Test - void test_4556007_4556115() { + void issue_1126_4556007_4556115() { replay(LINEA_MAINNET, "4556007-4556115.mainnet.json.gz"); } @Test - void test_4583379_4583463() { + void issue_1126_4583379_4583463() { replay(LINEA_MAINNET, "4583379-4583463.mainnet.json.gz"); } } diff --git a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java index 3916c1878..16e19467a 100644 --- a/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java +++ b/testing/src/main/java/net/consensys/linea/testing/ExecutionEnvironment.java @@ -175,7 +175,8 @@ private static NodeKey createNodeKey() { */ public static String constructTestPrefix() { for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { - if (ste.getClassName().endsWith("Test")) { + String className = ste.getClassName(); + if (className.endsWith("Test") || className.endsWith("Tests")) { // Yes, it is. Now tidy up the name. String name = ste.getClassName().replace(LINEA_PACKAGE, "").replace(".", "_"); // Done From c2d05e85da31031c2c91fb8a8575302d89cbf9b3 Mon Sep 17 00:00:00 2001 From: amkCha <29160563+amkCha@users.noreply.github.com> Date: Mon, 3 Feb 2025 16:32:43 +0100 Subject: [PATCH 43/54] feat: update constraints be40337 (#1765) * feat: update constraints be40337 * fix(update): opcode type in instdecoder --- .../module/tables/instructionDecoder/InstructionDecoder.java | 3 +-- linea-constraints | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/InstructionDecoder.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/InstructionDecoder.java index 0e35bc48f..947cbe4dd 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/InstructionDecoder.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/tables/instructionDecoder/InstructionDecoder.java @@ -28,7 +28,6 @@ import net.consensys.linea.zktracer.opcode.gas.BillingRate; import net.consensys.linea.zktracer.opcode.gas.MxpType; import net.consensys.linea.zktracer.types.UnsignedByte; -import org.apache.tuweni.bytes.Bytes; public final class InstructionDecoder implements Module { private static void traceFamily(OpCodeData op, Trace trace) { @@ -126,7 +125,7 @@ public void commit(List buffers) { traceStackSettings(op, trace); traceBillingSettings(op, trace); trace - .opcode(Bytes.ofUnsignedInt(i)) + .opcode(UnsignedByte.of(i)) .isPush(op.isPush()) .isJumpdest(op.isJumpDest()) .validateRow(); diff --git a/linea-constraints b/linea-constraints index e23c58aca..be40337bd 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit e23c58acafdc6ace630ef41d20aaea3958a7ff5a +Subproject commit be40337bda0a65f271f2ed9260c29271c637cfdb From 15d7b08e8e0b4f0a56616744a17cd022da6dc9ab Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Tue, 4 Feb 2025 20:41:10 +0100 Subject: [PATCH 44/54] Update Linea Besu to 25.2-delivery46 (#1767) Signed-off-by: Fabio Di Fabio --- gradle.properties | 2 +- .../net/consensys/linea/BlockchainReferenceTestTools.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 07cab138e..9dcb75d7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=beta-v1.2.0-rc3 -besuVersion=25.1-delivery44 +besuVersion=25.2-delivery46 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-tracer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ diff --git a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java index d4abd565c..5a8518439 100644 --- a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java @@ -54,6 +54,7 @@ import org.hyperledger.besu.ethereum.referencetests.BlockchainReferenceTestCaseSpec; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestProtocolSchedules; import org.hyperledger.besu.ethereum.rlp.RLPException; +import org.hyperledger.besu.ethereum.trie.diffbased.common.provider.WorldStateQueryParams; import org.hyperledger.besu.testutil.JsonTestParameters; import org.junit.jupiter.api.Assumptions; @@ -366,8 +367,10 @@ public static void executeTest(final BlockchainReferenceTestCaseSpec spec) { final BlockHeader genesisBlockHeader = spec.getGenesisBlockHeader(); final MutableWorldState worldState = spec.getWorldStateArchive() - .getMutable(genesisBlockHeader.getStateRoot(), genesisBlockHeader.getHash()) - .get(); + .getWorldState( + WorldStateQueryParams.withStateRootAndBlockHashAndUpdateNodeHead( + genesisBlockHeader.getStateRoot(), genesisBlockHeader.getHash())) + .orElseThrow(); log.info( "checking roothash {} is {}", worldState.rootHash(), genesisBlockHeader.getStateRoot()); From 69b565f6142b1b3f2c81df953ee002ca02b55895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Wed, 5 Feb 2025 03:06:24 +0100 Subject: [PATCH 45/54] test: some more skip tests (#1734) --- .../zktracer/module/hub/AccountSnapshot.java | 22 ++-- .../module/hub/section/TxSkipSection.java | 11 +- .../zktracer/module/hub/TxSkipTests.java | 119 ++++++++++++++++++ 3 files changed, 138 insertions(+), 14 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java index a1b8330ed..8bfffef4a 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java @@ -234,15 +234,13 @@ public AccountSnapshot setWarmthTo(boolean newWarmth) { return this; } - /** - * Raises the nonce by 1. WARNING: this modifies the underlying {@link AccountSnapshot}. Be - * sure to work with a {@link AccountSnapshot#deepCopy} if necessary. - * - * @return {@code this} with nonce++ - */ public AccountSnapshot raiseNonceByOne() { - this.nonce(nonce + 1); - return this; + return this.nonce(nonce + 1); + } + + public AccountSnapshot decrementNonceByOne() { + checkState(nonce > 0); + return this.nonce(nonce - 1); } public AccountSnapshot setDeploymentNumber(Hub hub) { @@ -250,8 +248,12 @@ public AccountSnapshot setDeploymentNumber(Hub hub) { } public AccountSnapshot setDeploymentNumber(DeploymentInfo deploymentInfo) { - this.deploymentNumber(deploymentInfo.deploymentNumber(address)); - return this; + return this.deploymentNumber(deploymentInfo.deploymentNumber(address)); + } + + public AccountSnapshot decrementDeploymentNumberByOne() { + checkState(deploymentNumber > 0); + return this.deploymentNumber(deploymentNumber - 1); } public AccountSnapshot setDeploymentInfo(Hub hub) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java index ae27c4aaf..6cc3c72df 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java @@ -112,14 +112,14 @@ public void resolveAtEndTransaction( // may have to be modified in case of address collision senderNew = canonical(hub, world, sender.address(), isPrecompile(sender.address())); recipientNew = canonical(hub, world, recipient.address(), isPrecompile(recipient.address())); - coinbaseNew = canonical(hub, world, coinbase.address(), isPrecompile(recipient.address())); + coinbaseNew = canonical(hub, world, coinbase.address(), isPrecompile(coinbase.address())); final Wei value = (Wei) txMetadata.getBesuTransaction().getValue(); if (senderAddressCollision()) { - BigInteger gasUsed = BigInteger.valueOf(txMetadata.getGasUsed()); - BigInteger gasPrice = BigInteger.valueOf(txMetadata.getEffectiveGasPrice()); - BigInteger gasCost = gasUsed.multiply(gasPrice); + final BigInteger gasUsed = BigInteger.valueOf(txMetadata.getGasUsed()); + final BigInteger gasPrice = BigInteger.valueOf(txMetadata.getEffectiveGasPrice()); + final BigInteger gasCost = gasUsed.multiply(gasPrice); senderNew = sender .deepCopy() @@ -135,6 +135,9 @@ public void resolveAtEndTransaction( if (recipientIsCoinbase()) { recipientNew = coinbaseNew.deepCopy().decrementBalanceBy(txMetadata.getCoinbaseReward()); recipient = recipientNew.deepCopy().decrementBalanceBy(value); + if (txMetadata.isDeployment()) { + recipient.decrementNonceByOne().decrementDeploymentNumberByOne(); + } } } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java index 35adea4b7..269b64eef 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java @@ -16,6 +16,7 @@ package net.consensys.linea.zktracer.module.hub; import static net.consensys.linea.testing.ToyExecutionEnvironmentV2.DEFAULT_COINBASE_ADDRESS; +import static net.consensys.linea.zktracer.types.AddressUtils.getCreateRawAddress; import java.util.List; @@ -320,4 +321,122 @@ void senderIsCoinbaseIsReceiver() { .build() .run(); } + + @Test + void skipMessageCallCoinbaseIsPrecompile() { + final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount = + ToyAccount.builder().balance(Wei.fromEth(0xffff)).nonce(128).address(senderAddress).build(); + + final Address receiverAddress = + Address.fromHexString("0xffffffffffffffffffffffffffffffffffffff"); + + final ToyAccount receiverAccount = + ToyAccount.builder() + .balance(Wei.fromEth(0xffffee)) + .nonce(18) + .address(receiverAddress) + .build(); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .value(Wei.of(123)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .coinbase(Address.BLAKE2B_F_COMPRESSION) + .build() + .run(); + } + + @Test + void skippedDepSenderIsCoinbase() { + final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount = + ToyAccount.builder().balance(Wei.fromEth(0xffff)).nonce(128).address(senderAddress).build(); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .keyPair(senderKeyPair) + .value(Wei.of(123)) + .gasLimit(100000L) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .coinbase(senderAddress) + .build() + .run(); + } + + @Test + void skippedDepDeploymentAddressIsCoinbase() { + final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + final int nonce = 632; + final ToyAccount senderAccount = + ToyAccount.builder() + .balance(Wei.fromEth(0xffff)) + .nonce(nonce) + .address(senderAddress) + .build(); + + final Address depAddress = Address.extract(getCreateRawAddress(senderAddress, nonce)); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .keyPair(senderKeyPair) + .value(Wei.of(123)) + .gasLimit(100000L) + .nonce((long) nonce) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .coinbase(depAddress) + .build() + .run(); + } + + @Test + void skippedDepCoinbaseIsPrecompile() { + final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + final ToyAccount senderAccount = + ToyAccount.builder().balance(Wei.fromEth(0xffff)).nonce(128).address(senderAddress).build(); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .keyPair(senderKeyPair) + .value(Wei.of(123)) + .gasLimit(100000L) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .coinbase(Address.RIPEMD160) + .build() + .run(); + } } From 013b406e30bd2c8d00ad978405f364432cca9d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:25:53 +0100 Subject: [PATCH 46/54] add TX_WARM and TX_FINAL tests (#1743) --- .../zktracer/module/hub/TxFinalTest.java | 145 ++++++++++++ .../zktracer/module/hub/TxSkipTests.java | 2 +- .../linea/zktracer/module/hub/TxWarmTest.java | 224 ++++++++++++++++++ 3 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxFinalTest.java create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxWarmTest.java diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxFinalTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxFinalTest.java new file mode 100644 index 000000000..dcd17e449 --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxFinalTest.java @@ -0,0 +1,145 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.hub; + +import static net.consensys.linea.zktracer.types.AddressUtils.getCreateRawAddress; + +import java.util.List; + +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyExecutionEnvironmentV2; +import net.consensys.linea.testing.ToyTransaction; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.apache.tuweni.bytes.Bytes; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Hash; +import org.hyperledger.besu.datatypes.Wei; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.junit.jupiter.api.Test; + +public class TxFinalTest { + + // sender account + private static final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + private static final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + private static final ToyAccount senderAccount = + ToyAccount.builder().balance(Wei.fromEth(123)).nonce(12).address(senderAddress).build(); + + // receiver account: dummy SMC account + private static final ToyAccount receiverAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .address(Address.fromHexString("0xdead000000000000000000000000000beef")) + .code(BytecodeCompiler.newProgram().push(12).push(35).op(OpCode.SGT).compile()) + .build(); + + private static final Bytes initCode = + BytecodeCompiler.newProgram().push(12).push(13).push(24).op(OpCode.ADDMOD).compile(); + + final Address depAddress = + Address.extract(getCreateRawAddress(senderAddress, senderAccount.getNonce())); + + // TODO: add smcCallSenderIsRecipient() {}, not possible before EIP-7702 + + @Test + void smcCallSenderIsCoinbase() { + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .coinbase(senderAddress) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void smcCallRecipientIsCoinbase() { + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .coinbase(receiverAccount.getAddress()) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + // TODO: add smcCallTripleCollision() {}, not possible before EIP-7702 + + // good luck for finding the right nonce ;) deploymentSenderIsRecipient() {} + + @Test + void deploymentSenderIsCoinbase() { + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .payload(initCode) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .coinbase(senderAddress) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void deploymentRecipientIsCoinbase() { + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .payload(initCode) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .coinbase(depAddress) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + // good luck for finding the right nonce ;) deploymentTripleCollision() {} +} diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java index 269b64eef..203ae881c 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxSkipTests.java @@ -40,7 +40,7 @@ public class TxSkipTests { @Test - void test() { + void testUselessAccessListForTxSkip() { final ToyAccount receiverAccount = ToyAccount.builder() .balance(Wei.fromEth(1)) diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxWarmTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxWarmTest.java new file mode 100644 index 000000000..a59aa1fdc --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/hub/TxWarmTest.java @@ -0,0 +1,224 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.hub; + +import static net.consensys.linea.testing.ToyExecutionEnvironmentV2.DEFAULT_COINBASE_ADDRESS; +import static net.consensys.linea.zktracer.types.AddressUtils.getCreateRawAddress; + +import java.util.ArrayList; +import java.util.List; + +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.ToyAccount; +import net.consensys.linea.testing.ToyExecutionEnvironmentV2; +import net.consensys.linea.testing.ToyTransaction; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; +import org.hyperledger.besu.crypto.KeyPair; +import org.hyperledger.besu.crypto.SECP256K1; +import org.hyperledger.besu.datatypes.*; +import org.hyperledger.besu.ethereum.core.Transaction; +import org.junit.jupiter.api.Test; + +public class TxWarmTest { + + private static final List NO_STORAGE_KEYS = List.of(); + private static final Address OxO_ADDRESS = Address.fromHexString("0x0"); + private static final Address FIXED_ADDRESS = Address.fromHexString("0xdeadbeef"); + private static final Bytes32 FIXED_STORAGE_KEYS = + Bytes32.fromHexString("0x0011223344556677889900112233445566778899001122334455667788990011"); + + // sender account + private static final KeyPair senderKeyPair = new SECP256K1().generateKeyPair(); + private static final Address senderAddress = + Address.extract(Hash.hash(senderKeyPair.getPublicKey().getEncodedBytes())); + private static final ToyAccount senderAccount = + ToyAccount.builder().balance(Wei.fromEth(123)).nonce(12).address(senderAddress).build(); + + // receiver account: 0+1 SMC account + private static final ToyAccount receiverAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .address(Address.fromHexString("0xdead000000000000000000000000000beef")) + .code(BytecodeCompiler.newProgram().push(1).push(0).op(OpCode.ADD).compile()) + .build(); + + @Test + void inefficientAccessList() { + // inefficient access list + final List accessList = new ArrayList<>(List.of()); + + // warming a PRC wo storage keys + accessList.add(new AccessListEntry(Address.BLAKE2B_F_COMPRESSION, NO_STORAGE_KEYS)); + + // warming a PRC with storage keys + accessList.add( + new AccessListEntry(Address.MODEXP, List.of(Bytes32.random(), Bytes32.random()))); + + // warming 0x00 Address + accessList.add(new AccessListEntry(OxO_ADDRESS, NO_STORAGE_KEYS)); + accessList.add(new AccessListEntry(OxO_ADDRESS, List.of(Bytes32.ZERO, FIXED_STORAGE_KEYS))); + + // warming dead beef address + accessList.add(new AccessListEntry(FIXED_ADDRESS, NO_STORAGE_KEYS)); + + // warming dead beef address a second time + accessList.add(new AccessListEntry(FIXED_ADDRESS, NO_STORAGE_KEYS)); + + // warming dead beef address a third time, with random storage keys + accessList.add(new AccessListEntry(FIXED_ADDRESS, List.of(Bytes32.random(), Bytes32.random()))); + + // warming dead beef address a fourth time, with defined storage keys + accessList.add(new AccessListEntry(FIXED_ADDRESS, List.of(FIXED_STORAGE_KEYS))); + + // warming dead beef address a fifth time, with defined storage keys + accessList.add( + new AccessListEntry( + FIXED_ADDRESS, + List.of( + FIXED_STORAGE_KEYS, + Bytes32.random(), + Bytes32.ZERO, + Bytes32.random(), + FIXED_STORAGE_KEYS))); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(accessList) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void warmSender() { + final List accessList = new ArrayList<>(List.of()); + accessList.add(new AccessListEntry(senderAddress, List.of(FIXED_STORAGE_KEYS))); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(accessList) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void warmReceiver() { + final List accessList = new ArrayList<>(List.of()); + accessList.add( + new AccessListEntry( + receiverAccount.getAddress(), List.of(Bytes32.ZERO, FIXED_STORAGE_KEYS))); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(accessList) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void warmCoinbase() { + final List accessList = new ArrayList<>(List.of()); + accessList.add( + new AccessListEntry( + DEFAULT_COINBASE_ADDRESS, List.of(Bytes32.ZERO, FIXED_STORAGE_KEYS, Bytes32.random()))); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .to(receiverAccount) + .keyPair(senderKeyPair) + .gasLimit(300000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(accessList) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount, receiverAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } + + @Test + void warmDeploymentAddress() { + final Bytes initCode = BytecodeCompiler.newProgram().push(1).push(0).op(OpCode.SLT).compile(); + + final Address depAddress = + Address.extract(getCreateRawAddress(senderAddress, senderAccount.getNonce())); + + final List accessList = new ArrayList<>(List.of()); + accessList.add( + new AccessListEntry( + depAddress, List.of(Bytes32.ZERO, FIXED_STORAGE_KEYS, Bytes32.random()))); + + final Transaction tx = + ToyTransaction.builder() + .sender(senderAccount) + .keyPair(senderKeyPair) + .payload(initCode) + .gasLimit(300000L) + .transactionType(TransactionType.ACCESS_LIST) + .accessList(accessList) + .value(Wei.of(1000)) + .build(); + + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(senderAccount)) + .transaction(tx) + .zkTracerValidator(zkTracer -> {}) + .build() + .run(); + } +} From 5741848579b9087f51d9c2493eb151fe6b9c9477 Mon Sep 17 00:00:00 2001 From: amkCha <29160563+amkCha@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:53:06 +0100 Subject: [PATCH 47/54] Feat/sonarqube local setup (#1764) * feat(sonarqube): sonar and jacoco tasks * feat(sonarqube): xml format * feat(sonarqube): at project root * feat(sonarqube): add README and test from scratch' * feat(sonarqube): test report for test and reference test * feat(sonarqube): add jacoco step in github workflow * fix(sonarqube): jacoco ref test path * feat(sonarqube): add all src for ref test jacoco report * feat(sonarqube): add html to test report * feat(sonarqube): html required * feat(sonarqube): add lombok config * feat(sonarqube): add external class * feat(sonar): add exec ref test * feat(sonarqube): add unit exec * feat(sonarqube): update doc to concatenate 2 reports * feat(sonarqube): add properties and test concatenate task --- .github/workflows/gradle-tests.yml | 16 ++- .../workflows/reference-blockchain-tests.yml | 14 +++ build.gradle | 37 +++++++ docs/Local-test-coverage.md | 104 ++++++++++++++++++ gradle.properties | 2 + gradle/tests.gradle | 19 ++++ lombok.config | 4 + reference-tests/build.gradle | 14 +++ .../net/consensys/linea/generated/.gitkeep | 0 scripts/docker-compose.yml | 33 ++++++ 10 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 docs/Local-test-coverage.md create mode 100644 lombok.config delete mode 100644 reference-tests/src/test/java/net/consensys/linea/generated/.gitkeep create mode 100644 scripts/docker-compose.yml diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index ce43aca1e..a98f26874 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -34,7 +34,7 @@ jobs: uses: ./.github/actions/setup-environment with: rust-corset: true - + - name: Set up GCC uses: egor-tensin/setup-gcc@v1 @@ -84,6 +84,20 @@ jobs: name: corset-unit-test-report path: arithmetization/build/reports/tests/**/* + - name: Upload jacoco test coverage report + if: always() + uses: actions/upload-artifact@v4 + with: + name: jacoco-unit-tests-coverage-report + path: arithmetization/build/reports/jacoco/test/**/* + + - name: Upload jacoco exec test + if: always() + uses: actions/upload-artifact@v4 + with: + name: jacoco-unit-tests-exec-file + path: arithmetization/build/jacoco/test.exec + go-corset-unit-tests: needs: [ build ] runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 4775c9e74..6ba240543 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -92,6 +92,20 @@ jobs: name: blockchain-refrence-tests-report path: reference-tests/build/reports/tests/**/* + - name: Upload jacoco test coverage report + if: always() + uses: actions/upload-artifact@v4 + with: + name: jacoco-reference-tests-coverage-report + path: reference-tests/build/reports/jacoco/jacocoReferenceBlockchainTestsReport/**/* + + - name: Upload jacoco exec test + if: always() + uses: actions/upload-artifact@v4 + with: + name: jacoco-reference-tests-exec-file + path: reference-tests/build/jacoco/referenceBlockchainTests.exec + - name: Extract Metrics if: ${{ failure() || cancelled() }} run: | diff --git a/build.gradle b/build.gradle index 77167e6e6..5430d9578 100644 --- a/build.gradle +++ b/build.gradle @@ -8,4 +8,41 @@ buildscript { besuPluginDir = File.createTempDir("plugins") } } + +plugins { + id 'java-library' + id "org.sonarqube" version "4.3.1.3277" +} + +sonar { + def tests = System.getProperty("tests") + def xmlTestReport = "" + // Conditional xmlReportPaths based on tests property + // Default is unit tests, we account only for the Unit tests jacoco coverage report + if(tests == null || tests=="Unit") { + print("Executing Sonarqube scanner Unit tests coverage report...\n") + xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacoco/test/jacocoTestReport.xml" + // If set to Reference, we account only for the Reference tests coverage report + } else if(tests == "Reference") { + print("Executing Sonarqube scanner for Reference tests coverage report...\n") + xmlTestReport = "${project.projectDir}/reference-tests/build/reports/jacoco/jacocoReferenceBlockchainTestsReport/jacocoReferenceBlockchainTestsReport.xml" + } else if(tests == "Both") { + print("Executing Sonarqube scanner for Unit and Reference tests coverage report...\n") + xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacocoConcatenate/test/jacocoTestReport.xml" + } else { + // Force build failure if unknown concatenate value. + println("*** unknown tests property. Try '-Dconcatenate=Unit' or '-Dconcatenate=Reference' or '-Dconcatenate=Both'\n\n") + assert false + } + + properties { + property "sonar.projectKey", "linea-tracer" + property "sonar.host.url", "localhost:80" + property "sonar.login", "admin" + property "sonar.password", "Adminadmin123*" + property "sonar.coverage.exclusions", "reference-tests/**/*, testing/**/*, **/*/Trace.java" + property "sonar.coverage.jacoco.xmlReportPaths", "${xmlTestReport}" + } +} + version = project.hasProperty('releaseVersion') ? project.getProperty('releaseVersion') : 'snapshot' diff --git a/docs/Local-test-coverage.md b/docs/Local-test-coverage.md new file mode 100644 index 000000000..2550b8da8 --- /dev/null +++ b/docs/Local-test-coverage.md @@ -0,0 +1,104 @@ +# Launch test coverage with local sonarqube server + +## Development Setup + +### Install docker + +``` +brew install docker +``` + +### Install docker compose plugin + +``` +brew install docker-compose +``` + +Add to your ~/.docker/config.json + +``` + "cliPluginsExtraDirs": [ + "/opt/homebrew/lib/docker/cli-plugins" + ] +``` + +## Produce Jacoco test reports + +Sonarqube server needs a third party test coverage report to display a coverage score. This test coverage report is produced by Jacoco plugin. + +### For one report + +To produce a report, you can either + +- Run unit or reference tests tasks locally with + +``` +GOMEMLIMIT=26GiB ./gradlew :arithmetization:test +GOMEMLIMIT=26GiB ./gradlew -Dblockchain=Ethereum referenceBlockchainTests +``` + +These tasks are finalized by Jacoco test reports + +- Or get xml report from the CI pipeline in unit or reference tests actions + +Paste the xml report in the following paths : + +- for unit tests + `/arithmetization/build/reports/jacoco/test/jacocoTestReport.xml` +- or for reference tests + `/referenceBlockchainTests/build/reports/jacoco/jacocoReferenceBlockchainTestsReport/jacocoReferenceBlockchainTestsReport.xml` + +### Concatenate two Jacoco reports + +Get jacoco exec files from the CI pipeline in unit and reference tests actions + +Paste the exec files in the following paths : + +- for unit tests + `/arithmetization/build/jacoco/test.exec` +- for reference tests + `/referenceBlockchainTests/build/jacoco/referenceBlockchainTests.exec` + +Run the jacocoUnitAndReferenceTestsReport task + +``` +./gradlew jacocoUnitAndReferenceTestsReport +``` + +Note: if an xml report already exists, delete it to generate it again, else the task will be marked as Skipped. + +## Launch local Sonarqube server + +Run `docker compose up` + +Wait for following log + +``` +sonarqube-1 | 2025.01.23 16:40:21 INFO app[][o.s.a.SchedulerImpl] SonarQube is operational +``` + +Change default password to not get prompted + +``` +curl -u admin:admin -X POST "http://localhost:80/api/users/change_password?login=admin&previousPassword=admin&password=Adminadmin123*" +``` + +Go to `localhost:80` in your browser and login with the credentials `admin/Adminadmin123*` + +## Launch Sonar task with gradle + +Then run `sonar` gradle task in verification group with the corresponding property depending on the coverage score you want to display + +``` +./gradlew sonar -Dtests=Unit +./gradlew sonar -Dtests=Reference +./gradlew sonar -Dtests=Both +``` + +Go to `localhost:80/projects` in your browser and check the results + +## Exit Sonarqube server + +``` +docker compose down +``` diff --git a/gradle.properties b/gradle.properties index 9dcb75d7f..2eea07b02 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,5 @@ distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx4096m +# gradle.properties +systemProp.sonar.host.url=http://localhost:80 diff --git a/gradle/tests.gradle b/gradle/tests.gradle index af924a17f..916c5b05a 100644 --- a/gradle/tests.gradle +++ b/gradle/tests.gradle @@ -115,6 +115,12 @@ tasks.withType(Test).configureEach { useJUnitPlatform() } +jacocoTestReport { + reports { + xml.required = true + } +} + tasks.test.configure { dependsOn(buildZkevmBin) @@ -130,6 +136,7 @@ tasks.test.configure { excludeTags("replay") excludeTags("weekly") } + finalizedBy(jacocoTestReport) } tasks.register("fastReplayTests", Test) { @@ -205,3 +212,15 @@ tasks.register("weeklyTests", Test) { includeTags("weekly") } } + +// Gradle task to concatenate Unit and Reference tests exec files +tasks.register("jacocoUnitAndReferenceTestsReport", JacocoReport) { + reports { + xml.required = true + html.outputLocation = layout.buildDirectory.dir('reports/jacocoConcatenate/html') + xml.outputLocation = layout.buildDirectory.file('reports/jacocoConcatenate/jacocoUnitAndReferenceTestsReport.xml') + } + + sourceSets project(":arithmetization").sourceSets.main + executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec") +} diff --git a/lombok.config b/lombok.config new file mode 100644 index 000000000..7387b4db9 --- /dev/null +++ b/lombok.config @@ -0,0 +1,4 @@ +# This will add the @lombok.Generated annotation +# to all the code generated by Lombok, +# so it can be excluded from coverage by jacoco. +lombok.addLombokGeneratedAnnotation = true diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index 47d1b5ab3..2ed531354 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -15,6 +15,10 @@ plugins { id "common-plugins" + id 'jacoco' +} +jacoco { + toolVersion = '0.8.12' } apply from: rootProject.file("gradle/corset.gradle") @@ -55,6 +59,7 @@ tasks.register("generateGeneralStateReferenceTests", RefTestGenerationTask) { tasks.register('referenceBlockchainTests', Test) { dependsOn(buildReferenceTestsZkevmBin) + finalizedBy(jacocoReferenceBlockchainTestsReport) description = 'Runs ETH reference blockchain tests.' dependsOn generateBlockchainReferenceTests environment.put("REFERENCE_TEST_OUTCOME_OUTPUT_FILE", "BlockchainReferenceTestOutcome.json") @@ -68,6 +73,15 @@ tasks.register('referenceBlockchainTests', Test) { } } +tasks.register("jacocoReferenceBlockchainTestsReport", JacocoReport) { + reports { + xml.required = true + } + + sourceSets project(":arithmetization").sourceSets.main + executionData(referenceBlockchainTests) +} + tasks.register('referenceGeneralStateTests', Test) { dependsOn(buildReferenceTestsZkevmBin) description = 'Runs ETH reference general state tests.' diff --git a/reference-tests/src/test/java/net/consensys/linea/generated/.gitkeep b/reference-tests/src/test/java/net/consensys/linea/generated/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml new file mode 100644 index 000000000..3bf215980 --- /dev/null +++ b/scripts/docker-compose.yml @@ -0,0 +1,33 @@ +# Copyright Broadcom, Inc. All Rights Reserved. +# SPDX-License-Identifier: APACHE-2.0 + +services: + postgresql: + image: docker.io/bitnami/postgresql:17 + ports: + - '5432:5432' + volumes: + - 'postgresql_data:/bitnami/postgresql' + environment: + - 'ALLOW_EMPTY_PASSWORD=yes' + - 'POSTGRESQL_USERNAME=bn_sonarqube' + - 'POSTGRESQL_DATABASE=bitnami_sonarqube' + sonarqube: + image: docker.io/bitnami/sonarqube:25 + ports: + - '80:9000' + volumes: + - 'sonarqube_data:/bitnami/sonarqube' + depends_on: + - postgresql + environment: + - 'ALLOW_EMPTY_PASSWORD=yes' + - 'SONARQUBE_DATABASE_HOST=postgresql' + - 'SONARQUBE_DATABASE_PORT_NUMBER=5432' + - 'SONARQUBE_DATABASE_USER=bn_sonarqube' + - 'SONARQUBE_DATABASE_NAME=bitnami_sonarqube' +volumes: + postgresql_data: + driver: local + sonarqube_data: + driver: local From 3e5b3da821f14c092342c46cefed63627fc88d8d Mon Sep 17 00:00:00 2001 From: David Pearce Date: Thu, 6 Feb 2025 07:47:48 +1300 Subject: [PATCH 48/54] chore: update `go-corset` to `301d5c4` (#1774) --- .github/actions/setup-go-corset/action.yml | 2 +- .github/workflows/gradle-nightly-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index 8b63e68d7..aedcf2dc8 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@e5e0938 + run: go install github.com/consensys/go-corset/cmd/go-corset@301d5c4 diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index 12096fdea..0d566b2c9 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -28,7 +28,7 @@ jobs: env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -vw --ansi-escapes=false --report --hir + GOCORSET_FLAGS: -vw --ansi-escapes=false --report --mir ZKEVM_BIN: "zkevm.go.bin" NIGHTLY_TESTS_PARALLELISM: 2 From bbe1c1001e97e10827a8780837053e795c43b2e7 Mon Sep 17 00:00:00 2001 From: Lorenzo Gentile Date: Thu, 6 Feb 2025 10:07:23 +0100 Subject: [PATCH 49/54] test(oogx): CALL different scenarios and gas accumulator (#1515) --- .../linea/zktracer/module/hub/Hub.java | 5 + .../exceptions/OutOfGasExceptionTest.java | 214 ++++++++++++++++-- .../linea/testing/BytecodeRunner.java | 5 + 3 files changed, 205 insertions(+), 19 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index 2f783739c..d36345243 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -241,6 +241,9 @@ public int lineCount() { private final BlakeEffectiveCall blakeEffectiveCall = new BlakeEffectiveCall(); private final BlakeRounds blakeRounds = new BlakeRounds(); + // TODO: bind it to the frame so as to compute the gasCost per frame + @Getter private long gasCostAccumulator = 0; + private List precompileLimitModules() { return List.of( @@ -771,6 +774,8 @@ private void compareLineaAndBesuGasCosts( long lineaGasCostExcludingDeploymentCost = currentSection.commonValues.gasCostExcluduingDeploymentCost(); + gasCostAccumulator += besuGasCost; + if (operationResult.getHaltReason() != null) { return; diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/exceptions/OutOfGasExceptionTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/exceptions/OutOfGasExceptionTest.java index 5dbac56b3..661ce2ea0 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/exceptions/OutOfGasExceptionTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/exceptions/OutOfGasExceptionTest.java @@ -15,6 +15,15 @@ package net.consensys.linea.zktracer.exceptions; +import static net.consensys.linea.testing.ToyExecutionEnvironmentV2.DEFAULT_BLOCK_NUMBER; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_CALL_VALUE; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_COLD_ACCOUNT_ACCESS; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_COLD_SLOAD; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_NEW_ACCOUNT; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_SSET; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_TRANSACTION; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_VERY_LOW; +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.GAS_CONST_G_WARM_ACCESS; import static net.consensys.linea.zktracer.module.hub.signals.TracedException.OUT_OF_GAS_EXCEPTION; import static net.consensys.linea.zktracer.opcode.OpCodes.opCodeToOpCodeDataMap; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -24,33 +33,72 @@ import java.util.List; import java.util.stream.Stream; +import com.google.common.base.Preconditions; import net.consensys.linea.UnitTestWatcher; import net.consensys.linea.testing.BytecodeCompiler; import net.consensys.linea.testing.BytecodeRunner; +import net.consensys.linea.testing.ToyAccount; import net.consensys.linea.zktracer.opcode.OpCode; import net.consensys.linea.zktracer.opcode.OpCodeData; +import org.hyperledger.besu.datatypes.Address; +import org.hyperledger.besu.datatypes.Wei; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; @ExtendWith(UnitTestWatcher.class) public class OutOfGasExceptionTest { - // TODO: add tests when address is warm. Use constants such as G_WARM_ACCESS etc @ParameterizedTest - @MethodSource("outOfGasExceptionSource") - void outOfGasExceptionColdTest( - OpCode opCode, int staticCost, int nPushes, boolean triggersOutOfGasExceptions) { + @MethodSource("outOfGasExceptionWithEmptyAccountsAndNoMemoryExpansionCostTestSource") + void outOfGasExceptionWithEmptyAccountsAndNoMemoryExpansionCostTest( + OpCode opCode, int opCodeStaticCost, int nPushes, int cornerCase) { BytecodeCompiler program = BytecodeCompiler.newProgram(); + for (int i = 0; i < nPushes; i++) { - program.push(0); + // In order to disambiguate between empty stack items and writing a result of 0 on the stack + // we push small integers to the stack which all produce non-zero results + + int pushedValue = + switch (opCode) { + case OpCode.BLOCKHASH -> Math.toIntExact(DEFAULT_BLOCK_NUMBER) - 1; + case OpCode.EXP -> i == 0 ? 5 : 2; // EXP 2 5 (2 ** 5) + default -> 7 * i + 11; + // small integer but greater than 10, so as when it represents an address + // it is not the one of a precompile contract + }; + program.push(pushedValue); } program.op(opCode); BytecodeRunner bytecodeRunner = BytecodeRunner.of(program.compile()); - bytecodeRunner.run( - (long) 21000 + nPushes * 3L + staticCost - (triggersOutOfGasExceptions ? 1 : 0)); - if (triggersOutOfGasExceptions) { + int opCodeDynamicCost = + switch (opCode) { + case OpCode.SELFDESTRUCT -> GAS_CONST_G_NEW_ACCOUNT + + GAS_CONST_G_COLD_ACCOUNT_ACCESS; // since the account is empty + case OpCode.EXP -> 50; // since the exponent requires 1 byte + case OpCode.SLOAD -> GAS_CONST_G_COLD_SLOAD; // since the slot is cold + case OpCode.BALANCE, + OpCode.EXTCODEHASH, + OpCode.EXTCODESIZE -> GAS_CONST_G_COLD_ACCOUNT_ACCESS; // since the account is cold + case OpCode.SSTORE -> GAS_CONST_G_SSET + + GAS_CONST_G_COLD_SLOAD; // value set from zero to non-zero and slot is cold + default -> 0; + }; + + final long gasCost = + GAS_CONST_G_TRANSACTION + + (long) nPushes * GAS_CONST_G_VERY_LOW + + opCodeStaticCost + + opCodeDynamicCost; + bytecodeRunner.run(gasCost + cornerCase); + + // TODO: this is to ensure that the gas cost is correctly calculated + // this may change when the gas accumulator will be associated to the frame + assertEquals(gasCost, GAS_CONST_G_TRANSACTION + bytecodeRunner.getHub().gasCostAccumulator()); + + if (cornerCase == -1) { assertEquals( OUT_OF_GAS_EXCEPTION, bytecodeRunner.getHub().previousTraceSection().commonValues.tracedException()); @@ -61,22 +109,150 @@ void outOfGasExceptionColdTest( } } - static Stream outOfGasExceptionSource() { + static Stream outOfGasExceptionWithEmptyAccountsAndNoMemoryExpansionCostTestSource() { List arguments = new ArrayList<>(); for (OpCodeData opCodeData : opCodeToOpCodeDataMap.values()) { OpCode opCode = opCodeData.mnemonic(); - int staticCost = opCodeData.stackSettings().staticGas().cost(); - int delta = opCodeData.stackSettings().delta(); // number of items popped from the stack - // TODO: some opCodes are excluded for now because they may need to be treated differently - if (staticCost > 0 - && opCode != OpCode.MLOAD - && opCode != OpCode.MSTORE8 - && opCode != OpCode.SELFDESTRUCT - && opCode != OpCode.MSTORE) { - arguments.add(Arguments.of(opCode, staticCost, delta, true)); - arguments.add(Arguments.of(opCode, staticCost, delta, false)); + int opCodeStaticCost = opCodeData.stackSettings().staticGas().cost(); + int nPushes = opCodeData.stackSettings().delta(); // number of items popped from the stack + if (opCode != OpCode.CALLDATACOPY // CALLDATACOPY needs the memory expansion cost + && opCode != OpCode.CODECOPY // CODECOPY needs the memory expansion cost + && opCode != OpCode.EXTCODECOPY // EXTCODECOPY needs the memory expansion cost + && opCode != OpCode.INVALID // INVALID consumes all gas left + && opCode != OpCode.MLOAD // MLOAD needs the memory expansion cost + && opCode != OpCode.MSTORE // MSTORE needs the memory expansion cost + && opCode != OpCode.MSTORE8 // MSTORE8 needs the memory expansion cost + && opCode != OpCode.RETURN // RETURN needs the memory expansion cost + && opCode != OpCode.RETURNDATACOPY // RETURNDATACOPY needs the memory expansion cost + && opCode != OpCode.REVERT // REVERT needs the memory expansion cost + && opCode != OpCode.SHA3 // SHA3 needs the memory expansion cost + && opCode != OpCode.STOP // STOP does not consume gas + && !opCodeData.isCall() // CALL family is managed separately + && !opCodeData.isCreate() // CREATE needs the memory expansion cost + && !opCodeData.isLog() // LOG needs the memory expansion cost + ) { + arguments.add(Arguments.of(opCode, opCodeStaticCost, nPushes, -1)); + arguments.add(Arguments.of(opCode, opCodeStaticCost, nPushes, 0)); + arguments.add(Arguments.of(opCode, opCodeStaticCost, nPushes, 1)); + } + } + return arguments.stream(); + } + + @ParameterizedTest + @MethodSource("outOfGasExceptionCallSource") + void outOfGasExceptionCallTest( + int value, boolean targetAddressExists, boolean isWarm, int cornerCase) { + BytecodeCompiler program = BytecodeCompiler.newProgram(); + + if (targetAddressExists && isWarm) { + // Note: this is a possible way to warm the address + program.push("ca11ee").op(OpCode.BALANCE); + } + + program + .push(0) // return at capacity + .push(0) // return at offset + .push(0) // call data size + .push(0) // call data offset + .push(value) // value + .push("ca11ee") // address + .push(1000) // gas + .op(OpCode.CALL); + + BytecodeRunner bytecodeRunner = BytecodeRunner.of(program.compile()); + + long gasCost = + GAS_CONST_G_TRANSACTION + + // base gas cost + (isWarm ? GAS_CONST_G_VERY_LOW + GAS_CONST_G_COLD_ACCOUNT_ACCESS : 0) // PUSH + BALANCE + + 7 * GAS_CONST_G_VERY_LOW // 7 PUSH + + callGasCost(value != 0, targetAddressExists, isWarm); // CALL + + if (targetAddressExists) { + final ToyAccount calleeAccount = + ToyAccount.builder() + .balance(Wei.fromEth(1)) + .nonce(10) + .address(Address.fromHexString("ca11ee")) + .build(); + bytecodeRunner.run(gasCost + cornerCase, List.of(calleeAccount)); + } else { + bytecodeRunner.run(gasCost + cornerCase); + } + + if (cornerCase == -1) { + assertEquals( + OUT_OF_GAS_EXCEPTION, + bytecodeRunner.getHub().previousTraceSection().commonValues.tracedException()); + } else { + assertNotEquals( + OUT_OF_GAS_EXCEPTION, + bytecodeRunner.getHub().previousTraceSection().commonValues.tracedException()); + } + } + + static Stream outOfGasExceptionCallSource() { + List arguments = new ArrayList<>(); + for (int value : new int[] {0, 1}) { + for (int cornerCase : new int[] {-1, 0, 1}) { + arguments.add(Arguments.of(value, true, true, cornerCase)); + arguments.add(Arguments.of(value, true, false, cornerCase)); + arguments.add(Arguments.of(value, false, false, cornerCase)); } } return arguments.stream(); } + + private long callGasCost(boolean transfersValue, boolean targetAddressExists, boolean isWarm) { + Preconditions.checkArgument( + !(isWarm && !targetAddressExists), "isWarm implies targetAddressExists"); + return (transfersValue ? GAS_CONST_G_CALL_VALUE : 0) + + (targetAddressExists ? 0 : (transfersValue ? GAS_CONST_G_NEW_ACCOUNT : 0)) + + (isWarm ? GAS_CONST_G_WARM_ACCESS : GAS_CONST_G_COLD_ACCOUNT_ACCESS); + } + + /** + * We provide a non-zero value in storage so to disambiguate between writing the value in storage + * to the stack and writing 0 to the stack. + */ + @ParameterizedTest + @ValueSource(ints = {-1, 0, 1}) + void outOfGasExceptionSLoad(int cornerCase) { + BytecodeCompiler program = BytecodeCompiler.newProgram(); + + program + .push(2) // value + .push(1) // key + .op(OpCode.SSTORE); + + program + .push(1) + . // key + op(OpCode.SLOAD); + + BytecodeRunner bytecodeRunner = BytecodeRunner.of(program.compile()); + + long gasCost = + (long) GAS_CONST_G_TRANSACTION + + (long) 2 * GAS_CONST_G_VERY_LOW // 2 PUSH + + GAS_CONST_G_SSET + // SSTORE cost since current_value == original_value + // and original_value == 0 (20000) + + GAS_CONST_G_COLD_SLOAD // SSTORE cost since slot is cold (2100) + + (long) GAS_CONST_G_VERY_LOW // PUSH + + GAS_CONST_G_WARM_ACCESS; // SLOAD (100) + + bytecodeRunner.run(gasCost + cornerCase); + + if (cornerCase == -1) { + assertEquals( + OUT_OF_GAS_EXCEPTION, + bytecodeRunner.getHub().previousTraceSection().commonValues.tracedException()); + } else { + assertNotEquals( + OUT_OF_GAS_EXCEPTION, + bytecodeRunner.getHub().previousTraceSection().commonValues.tracedException()); + } + } } diff --git a/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java b/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java index f38dbf78c..d04c23733 100644 --- a/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java +++ b/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java @@ -87,6 +87,11 @@ public void run(List additionalAccounts) { this.run(Wei.fromEth(1), (long) GlobalConstants.LINEA_BLOCK_GAS_LIMIT, additionalAccounts); } + // Ad-hoc gasLimit and accounts + public void run(Long gasLimit, List additionalAccounts) { + this.run(Wei.fromEth(1), gasLimit, additionalAccounts); + } + // Ad-hoc senderBalance, gasLimit and accounts public void run(Wei senderBalance, Long gasLimit, List additionalAccounts) { checkArgument(byteCode != null, "byteCode cannot be empty"); From 1f032b9b1763950e53436eff1b57be0143e0db0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Thu, 6 Feb 2025 23:11:56 +0100 Subject: [PATCH 50/54] `HUB` consistency arguments (#1746) --- .github/actions/setup-go-corset/action.yml | 2 +- .github/workflows/gradle-ethereum-tests.yml | 53 +----------- .github/workflows/gradle-nightly-tests.yml | 2 +- .github/workflows/gradle-tests.yml | 82 +------------------ .github/workflows/gradle-weekly-tests.yml | 7 +- .../workflows/reference-blockchain-tests.yml | 1 - .../linea/corset/GoCorsetValidator.java | 3 +- .../linea/corset/RustCorsetValidator.java | 2 +- .../zktracer/module/hub/AccountSnapshot.java | 11 +-- .../linea/zktracer/module/hub/Hub.java | 15 ++-- .../zktracer/module/hub/TransactionStack.java | 2 +- .../AfterTransactionFinalizationDefer.java | 29 +++++++ .../module/hub/defer/DeferRegistry.java | 41 +++++++--- ...ionDefer.java => EndTransactionDefer.java} | 6 +- .../hub/fragment/DomSubStampsSubFragment.java | 6 +- .../hub/fragment/account/AccountFragment.java | 20 +++-- .../module/hub/fragment/imc/mmu/MmuCall.java | 4 +- .../module/hub/section/CreateSection.java | 2 +- .../module/hub/section/LogSection.java | 4 +- .../module/hub/section/TraceSection.java | 2 +- .../hub/section/TxFinalizationSection.java | 6 +- .../hub/section/TxInitializationSection.java | 10 ++- .../module/hub/section/TxSkipSection.java | 6 +- .../module/hub/section/call/CallSection.java | 30 ++++--- .../hub/section/halt/ReturnSection.java | 4 +- .../hub/section/halt/SelfdestructSection.java | 52 ++++++------ .../module/hub/section/halt/StopSection.java | 4 +- .../zktracer/runtime/callstack/CallFrame.java | 11 +-- .../linea/zktracer/runtime/stack/Stack.java | 13 +-- .../types/TransactionProcessingMetadata.java | 30 ++++++- .../complexTargets/FailureWillRevertTest.java | 42 ++++++++-- ...peatedSelfDestructsOfSameAccountTests.java | 22 +++++ .../zeroSize/CallArgumentsMaybeRedundant.java | 26 ++++-- .../module/blockdata/GasLimitTest.java | 4 +- gradle/trace-files.gradle | 11 ++- linea-constraints | 2 +- reference-tests/build.gradle | 1 + .../linea/BlockchainReferenceTestTools.java | 53 ++++++++++++ .../linea/testing/BytecodeRunner.java | 2 +- 39 files changed, 350 insertions(+), 273 deletions(-) create mode 100644 arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/AfterTransactionFinalizationDefer.java rename arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/{PostTransactionDefer.java => EndTransactionDefer.java} (87%) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index aedcf2dc8..1bbb9baf2 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@301d5c4 + run: go install github.com/consensys/go-corset/cmd/go-corset@latest diff --git a/.github/workflows/gradle-ethereum-tests.yml b/.github/workflows/gradle-ethereum-tests.yml index bdddebbc4..bbe7b60cf 100644 --- a/.github/workflows/gradle-ethereum-tests.yml +++ b/.github/workflows/gradle-ethereum-tests.yml @@ -8,54 +8,9 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: ethereum-tests: - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup Test Environment - uses: ./.github/actions/setup-environment - with: - rust-corset: true - - - name: Generate General State Reference Tests - run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true - env: - JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: fields,expand,expand,expand - - - name: Run General State Reference Tests - run: ./gradlew -Dblockchain=Ethereum referenceGeneralStateTests - env: - REFERENCE_TESTS_PARALLELISM: 10 - JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: fields,expand,expand,expand - - - name: Upload test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: ethereum-tests-report - path: | - reference-tests/build/reports/tests/**/* - tmp/local/* - - - name: Failure Notification - if: ${{ failure() || cancelled() }} - uses: slackapi/slack-github-action@v2.0.0 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: webhook-trigger - payload: | - name: "Daily State Tests (Rust Corset)" - status: "${{ job.status }}" - - ethereum-tests-go-corset: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl steps: - name: Checkout repository @@ -72,21 +27,19 @@ jobs: run: ./gradlew generateGeneralStateReferenceTests -Dorg.gradle.caching=true env: JAVA_OPTS: -Dorg.gradle.daemon=false - ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" - name: Run General State Reference Tests run: GOMEMLIMIT=64GiB ./gradlew -Dblockchain=Ethereum referenceGeneralStateTests env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air - ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" + GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --air - name: Upload test report if: always() uses: actions/upload-artifact@v4 with: - name: ethereum-tests-go-corset-report + name: ethereum-tests-report path: | reference-tests/build/reports/tests/**/* tmp/local/* diff --git a/.github/workflows/gradle-nightly-tests.yml b/.github/workflows/gradle-nightly-tests.yml index 0d566b2c9..36db471d7 100644 --- a/.github/workflows/gradle-nightly-tests.yml +++ b/.github/workflows/gradle-nightly-tests.yml @@ -29,7 +29,7 @@ jobs: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable GOCORSET_FLAGS: -vw --ansi-escapes=false --report --mir - ZKEVM_BIN: "zkevm.go.bin" + ZKEVM_BIN: "zkevm.bin" NIGHTLY_TESTS_PARALLELISM: 2 - name: Upload test report diff --git a/.github/workflows/gradle-tests.yml b/.github/workflows/gradle-tests.yml index a98f26874..a6be68459 100644 --- a/.github/workflows/gradle-tests.yml +++ b/.github/workflows/gradle-tests.yml @@ -55,50 +55,7 @@ jobs: # ================================================================== # Unit Tests # ================================================================== - corset-unit-tests: - needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: false - - - name: Setup Test Environment - uses: ./.github/actions/setup-environment - with: - enable-ssh: ${{ inputs.tests-with-ssh }} - rust-corset: true - - - name: Run unit tests - run: ./gradlew :arithmetization:test --stacktrace - env: - JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: trace-span=3,fields,expand,expand,expand - UNIT_TESTS_PARALLELISM: 2 - - - name: Upload test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: corset-unit-test-report - path: arithmetization/build/reports/tests/**/* - - - name: Upload jacoco test coverage report - if: always() - uses: actions/upload-artifact@v4 - with: - name: jacoco-unit-tests-coverage-report - path: arithmetization/build/reports/jacoco/test/**/* - - - name: Upload jacoco exec test - if: always() - uses: actions/upload-artifact@v4 - with: - name: jacoco-unit-tests-exec-file - path: arithmetization/build/jacoco/test.exec - - go-corset-unit-tests: + unit-tests: needs: [ build ] runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl continue-on-error: true @@ -121,48 +78,18 @@ jobs: CORSET_FLAGS: disable GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air UNIT_TESTS_PARALLELISM: 1 - ZKEVM_BIN: "zkevm.go.bin" - name: Upload test report if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: go-corset-unit-tests-report + name: unit-tests-report path: arithmetization/build/reports/tests/**/* # ================================================================== # Fast Replay Tests # ================================================================== - corset-replay-tests: - needs: [ build ] - runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: false - - - name: Setup Environment - uses: ./.github/actions/setup-environment - with: - enable-ssh: ${{ inputs.tests-with-ssh }} - rust-corset: true - - - name: Run Replay tests - run: ./gradlew :arithmetization:fastReplayTests --stacktrace - env: - JAVA_OPTS: -Dorg.gradle.daemon=false - CORSET_FLAGS: trace-span=3,fields,expand,expand,expand - REPLAY_TESTS_PARALLELISM: 2 - - - name: Upload test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: replay-test-report - path: arithmetization/build/reports/tests/**/* - - go-corset-replay-tests: + replay-tests: needs: [ build ] runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl continue-on-error: true @@ -184,11 +111,10 @@ jobs: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air - ZKEVM_BIN: "zkevm.go.bin" - name: Upload test report if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: go-corset-replay-tests-report + name: replay-tests-report path: arithmetization/build/reports/tests/**/* diff --git a/.github/workflows/gradle-weekly-tests.yml b/.github/workflows/gradle-weekly-tests.yml index d3bab4fee..18048a298 100644 --- a/.github/workflows/gradle-weekly-tests.yml +++ b/.github/workflows/gradle-weekly-tests.yml @@ -9,7 +9,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med @@ -48,7 +48,7 @@ jobs: name: "Weekly (Go-Corset)" status: "${{ job.status }}" - go-corset-tests: + weekly-tests: runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-xxl continue-on-error: true steps: @@ -67,8 +67,7 @@ jobs: env: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable - GOCORSET_FLAGS: -vw --ansi-escapes=false --report --air - ZKEVM_BIN: "zkevm.go.bin" + GOCORSET_FLAGS: -vw -b1024 --ansi-escapes=false --report --air - name: Failure Notification if: ${{ failure() || cancelled() }} diff --git a/.github/workflows/reference-blockchain-tests.yml b/.github/workflows/reference-blockchain-tests.yml index 6ba240543..4a96c49bb 100644 --- a/.github/workflows/reference-blockchain-tests.yml +++ b/.github/workflows/reference-blockchain-tests.yml @@ -72,7 +72,6 @@ jobs: JAVA_OPTS: -Dorg.gradle.daemon=false CORSET_FLAGS: disable GOCORSET_FLAGS: -b1024 -vw --ansi-escapes=false --report --air - ZKEVM_BIN: "zkevm_for_reference_tests.go.bin" FAILED_TEST_JSON_DIRECTORY: ${{ github.workspace }}/tmp/${{ steps.extract_branch.outputs.branch }}/ FAILED_MODULE: ${{ inputs.failed_module || '' }} FAILED_CONSTRAINT: ${{ inputs.failed_constraint || '' }} diff --git a/arithmetization/src/main/java/net/consensys/linea/corset/GoCorsetValidator.java b/arithmetization/src/main/java/net/consensys/linea/corset/GoCorsetValidator.java index 3bfdeb41d..a83489eaa 100644 --- a/arithmetization/src/main/java/net/consensys/linea/corset/GoCorsetValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/corset/GoCorsetValidator.java @@ -95,7 +95,8 @@ private void configGoCorset() { private List buildCommandLine(Path traceFile, String zkEvmBin) { ArrayList options = new ArrayList<>(); // Determine options to use (either default or override) - String flags = System.getenv().getOrDefault("GOCORSET_FLAGS", "-w --air"); + String flags = + System.getenv().getOrDefault("GOCORSET_FLAGS", "-w --report --report-context 2 --hir "); // Specify corset binary options.add("go-corset"); // Specify corset "check" command. diff --git a/arithmetization/src/main/java/net/consensys/linea/corset/RustCorsetValidator.java b/arithmetization/src/main/java/net/consensys/linea/corset/RustCorsetValidator.java index 79cb2a6fe..1dda2c3bd 100644 --- a/arithmetization/src/main/java/net/consensys/linea/corset/RustCorsetValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/corset/RustCorsetValidator.java @@ -80,7 +80,7 @@ public class RustCorsetValidator extends AbstractExecutable { @Getter private boolean active = false; public RustCorsetValidator() { - initCorset(); + // initCorset(); configCorset(); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java index 8bfffef4a..2e274fcac 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/AccountSnapshot.java @@ -156,17 +156,10 @@ public AccountSnapshot deepCopy() { address, nonce, balance, isWarm, code, deploymentNumber, deploymentStatus); } - public AccountSnapshot wipe(DeploymentInfo deploymentInfo) { + public void wipe(DeploymentInfo deploymentInfo) { final boolean deploymentStatus = deploymentInfo.getDeploymentStatus(address); checkArgument(!deploymentStatus); - return new AccountSnapshot( - address, - 0, - Wei.of(0), - isWarm, - Bytecode.EMPTY, - deploymentInfo.deploymentNumber(address), - deploymentStatus); + this.nonce(0).balance(Wei.ZERO).code(Bytecode.EMPTY).setDeploymentInfo(deploymentInfo); } /** diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java index d36345243..f393bc610 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java @@ -537,9 +537,9 @@ public void traceEndTransaction( // TODO: add the following resolution this.defers.resolvePostRollback(this, ... - txStack.current().completeLineaTransaction(this, isSuccessful, logs, selfDestructs); - + txStack.current().completeLineaTransaction(this, world, isSuccessful, logs, selfDestructs); defers.resolveAtEndTransaction(this, world, tx, isSuccessful); + defers.resolveAfterTransactionFinalization(this, world); // Warn: we need to call MMIO after resolving the defers for (Module m : modules) { @@ -736,8 +736,6 @@ public void tracePostExecution(MessageFrame frame, Operation.OperationResult ope if (isExceptional()) { this.currentTraceSection() .exceptionalContextFragment(ContextFragment.executionProvidesEmptyReturnData(this)); - this.squashCurrentFrameOutputData(); - this.squashParentFrameReturnData(); } defers.resolvePostExecution(this, frame, operationResult); @@ -748,7 +746,10 @@ public void tracePostExecution(MessageFrame frame, Operation.OperationResult ope if (frame.getDepth() == 0 && (isExceptional() || opCode().isHalt())) { this.state.setProcessingPhase(TX_FINL); - coinbaseWarmthAtTransactionEnd = frame.isAddressWarm(coinbaseAddress); + coinbaseWarmthAtTransactionEnd = + isExceptional() || opCode() == REVERT + ? txStack.current().coinbaseWarmthAfterTxInit(this) + : frame.isAddressWarm(coinbaseAddress); } if (frame.getDepth() == 0 && (isExceptional() || opCode() == REVERT)) { @@ -869,7 +870,7 @@ private void exitDeploymentFromDeploymentInfoPov(MessageFrame frame) { transients.conflation().deploymentInfo().markAsNotUnderDeployment(bytecodeAddress); } - public int getCfiByMetaData( + public int getCodeFragmentIndexByMetaData( final Address address, final int deploymentNumber, final boolean deploymentStatus) { return this.romLex() .getCodeFragmentIndexByMetadata( @@ -1105,7 +1106,7 @@ public void squashCurrentFrameOutputData() { } public void squashParentFrameReturnData() { - callStack.parentCallFrame().outputDataRange(MemoryRange.EMPTY); + callStack.parentCallFrame().returnDataRange(MemoryRange.EMPTY); } public CallFrame getLastChildCallFrame(final CallFrame parentFrame) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java index ab14be2df..4f24f8b59 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/TransactionStack.java @@ -79,7 +79,7 @@ public void setCodeFragmentIndex(Hub hub) { for (TransactionProcessingMetadata tx : transactions) { final int cfi = tx.requiresCfiUpdate() - ? hub.getCfiByMetaData( + ? hub.getCodeFragmentIndexByMetaData( tx.getEffectiveRecipient(), tx.getUpdatedRecipientAddressDeploymentNumberAtTransactionStart(), tx.isUpdatedRecipientAddressDeploymentStatusAtTransactionStart()) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/AfterTransactionFinalizationDefer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/AfterTransactionFinalizationDefer.java new file mode 100644 index 000000000..cfc50fd6f --- /dev/null +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/AfterTransactionFinalizationDefer.java @@ -0,0 +1,29 @@ +/* + * Copyright Consensys Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package net.consensys.linea.zktracer.module.hub.defer; + +import net.consensys.linea.zktracer.module.hub.Hub; +import org.hyperledger.besu.evm.worldstate.WorldView; + +/** + * Actions which get deferred to {@link AfterTransactionFinalizationDefer} are those actions that + * should be performed after the TX_FINL phase of transaction processing. These include + * + *

- the account wiping of successful SELFDESTRUCT's + */ +public interface AfterTransactionFinalizationDefer { + + void resolveAfterTransactionFinalization(Hub hub, WorldView view); +} diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java index d196d7336..254573663 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/DeferRegistry.java @@ -34,7 +34,8 @@ public class DeferRegistry ContextEntryDefer, ContextExitDefer, PostRollbackDefer, - PostTransactionDefer, + EndTransactionDefer, + AfterTransactionFinalizationDefer, PostConflationDefer { /** A list of actions deferred until the end of the current opcode execution */ @@ -50,7 +51,11 @@ public class DeferRegistry private final Map> contextReEntryDefers = new HashMap<>(); /** A list of actions deferred to the end of the current transaction */ - private final List postTransactionDefers = new ArrayList<>(); + private final List endTransactionDefers = new ArrayList<>(); + + /** A list of actions deferred to after the TX_FINL phase of the current transaction */ + private final List afterTransactionFinalizationDefers = + new ArrayList<>(); /** A list of actions deferred until the end of the current conflation execution */ private final List postConflationDefers = new ArrayList<>(); @@ -81,8 +86,13 @@ public void scheduleForContextExit(ContextExitDefer defer, Integer callFrameId) } /** Schedule an action to be executed at the end of the current transaction. */ - public void scheduleForEndTransaction(PostTransactionDefer defer) { - postTransactionDefers.add(defer); + public void scheduleForEndTransaction(EndTransactionDefer defer) { + endTransactionDefers.add(defer); + } + + /** Schedule an action to be executed after TX_FINL. */ + public void scheduleForAfterTransactionFinalization(AfterTransactionFinalizationDefer defer) { + afterTransactionFinalizationDefers.add(defer); } /** Schedule an action to be executed at the end of the current transaction. */ @@ -119,16 +129,23 @@ public void scheduleForPostRollback(PostRollbackDefer defer, CallFrame callFrame @Override public void resolveAtEndTransaction( Hub hub, WorldView world, Transaction tx, boolean isSuccessful) { - final List postTransactionDefersFirstRound = - new ArrayList<>(postTransactionDefers); - postTransactionDefers.clear(); - for (PostTransactionDefer defer : postTransactionDefersFirstRound) { + final List endTransactionDefersFirstRound = + new ArrayList<>(endTransactionDefers); + endTransactionDefers.clear(); + for (EndTransactionDefer defer : endTransactionDefersFirstRound) { defer.resolveAtEndTransaction(hub, world, tx, isSuccessful); } - for (PostTransactionDefer defer : postTransactionDefers) { + for (EndTransactionDefer defer : endTransactionDefers) { defer.resolveAtEndTransaction(hub, world, tx, isSuccessful); } - postTransactionDefers.clear(); + endTransactionDefers.clear(); + } + + public void resolveAfterTransactionFinalization(Hub hub, WorldView worldView) { + for (AfterTransactionFinalizationDefer defer : afterTransactionFinalizationDefers) { + defer.resolveAfterTransactionFinalization(hub, worldView); + } + afterTransactionFinalizationDefers.clear(); } /** @@ -225,7 +242,7 @@ public void unscheduleForContextReEntry(ContextReEntryDefer defer, CallFrame cal contextReEntryDefers.get(callFrame).remove(defer); } - public void unscheduleForPostTransaction(PostTransactionDefer defer) { - postTransactionDefers.remove(defer); + public void unscheduleForPostTransaction(EndTransactionDefer defer) { + endTransactionDefers.remove(defer); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/EndTransactionDefer.java similarity index 87% rename from arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java rename to arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/EndTransactionDefer.java index ed665f0f6..f7fe98fc4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/PostTransactionDefer.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/defer/EndTransactionDefer.java @@ -20,10 +20,10 @@ import org.hyperledger.besu.evm.worldstate.WorldView; /** - * A TransactionDefer represents an object, whose execution will be deferred until after the current - * transaction has been executed. + * A {@link EndTransactionDefer} represents an object, whose execution will be deferred until after + * the current transaction has been executed. */ -public interface PostTransactionDefer { +public interface EndTransactionDefer { /** * This method will be triggered as soon as the current transaction has finished its execution. * diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/DomSubStampsSubFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/DomSubStampsSubFragment.java index 8222da6c5..ae458fbea 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/DomSubStampsSubFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/DomSubStampsSubFragment.java @@ -91,7 +91,7 @@ public static DomSubStampsSubFragment selfdestructDomSubStamps(Hub hub, int hubS public int domStamp() { switch (type) { case STANDARD -> { - return MULTIPLIER___DOM_SUB_STAMPS * hubStamp + this.domOffset; + return MULTIPLIER___DOM_SUB_STAMPS * hubStamp + domOffset; } case REVERTS_WITH_CURRENT -> { return MULTIPLIER___DOM_SUB_STAMPS * revertStamp + DOM_SUB_STAMP_OFFSET___REVERT; @@ -110,10 +110,10 @@ public int domStamp() { public int subStamp() { switch (type) { case STANDARD -> { - return this.subOffset; + return subOffset; } case REVERTS_WITH_CURRENT, REVERTS_WITH_CHILD, SELFDESTRUCT -> { - return MULTIPLIER___DOM_SUB_STAMPS * this.hubStamp + this.subOffset; + return MULTIPLIER___DOM_SUB_STAMPS * hubStamp + subOffset; } default -> throw new RuntimeException("DomSubType not supported"); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java index 242324533..3611829e6 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/account/AccountFragment.java @@ -32,8 +32,8 @@ import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.Trace; import net.consensys.linea.zktracer.module.hub.defer.DeferRegistry; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.defer.PostConflationDefer; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TraceFragment; import net.consensys.linea.zktracer.module.hub.section.halt.EphemeralAccount; @@ -46,7 +46,7 @@ @Accessors(fluent = true) public final class AccountFragment - implements TraceFragment, PostTransactionDefer, PostConflationDefer { + implements TraceFragment, EndTransactionDefer, PostConflationDefer { @Getter private final AccountSnapshot oldState; @Getter private final AccountSnapshot newState; @@ -154,8 +154,8 @@ public Trace trace(Trace trace) { .pAccountMarkedForSelfdestruct(markedForSelfDestruct) .pAccountMarkedForSelfdestructNew(markedForSelfDestructNew) .pAccountDeploymentNumber(oldState.deploymentNumber()) - .pAccountDeploymentNumberNew(newState.deploymentNumber()) .pAccountDeploymentStatus(oldState.deploymentStatus()) + .pAccountDeploymentNumberNew(newState.deploymentNumber()) .pAccountDeploymentStatusNew(newState.deploymentStatus()) .pAccountDeploymentNumberInfty(deploymentNumberInfinity) .pAccountDeploymentStatusInfty(existsInfinity) @@ -186,10 +186,14 @@ public void resolveAtEndTransaction( public void resolvePostConflation(Hub hub, WorldView world) { deploymentNumberInfinity = hub.deploymentNumberOf(newState.address()); existsInfinity = world.get(newState.address()) != null; - codeFragmentIndex = - requiresRomlex - ? hub.getCfiByMetaData( - newState.address(), newState.deploymentNumber(), newState.deploymentStatus()) - : 0; + try { + codeFragmentIndex = + hub.getCodeFragmentIndexByMetaData( + newState.address(), newState.deploymentNumber(), newState.deploymentStatus()); + } catch (RuntimeException e) { + // getCfi should NEVER throw en exception when requiresRomLex ≡ true + checkState(!requiresRomlex); + codeFragmentIndex = 0; + } } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java index c04d70cfd..71a98b21b 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java @@ -41,7 +41,7 @@ import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.State; import net.consensys.linea.zktracer.module.hub.Trace; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.TraceSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.imc.mmu.opcode.*; import net.consensys.linea.zktracer.module.hub.fragment.scenario.PrecompileScenarioFragment; @@ -68,7 +68,7 @@ @Setter @Getter @Accessors(fluent = true) -public class MmuCall implements TraceSubFragment, PostTransactionDefer { +public class MmuCall implements TraceSubFragment, EndTransactionDefer { protected boolean traceMe = true; protected int instruction = 0; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java index 28fce8e42..63cb92787 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/CreateSection.java @@ -58,7 +58,7 @@ public class CreateSection extends TraceSection ContextEntryDefer, PostRollbackDefer, ContextReEntryDefer, - PostTransactionDefer { + EndTransactionDefer { private final Address creatorAddress; private final Address createeAddress; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java index 19b4d4b98..cf6edc2c9 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/LogSection.java @@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.*; import net.consensys.linea.zktracer.module.hub.Hub; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.imc.ImcFragment; import net.consensys.linea.zktracer.module.hub.fragment.imc.MxpCall; @@ -28,7 +28,7 @@ import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.evm.worldstate.WorldView; -public class LogSection extends TraceSection implements PostTransactionDefer { +public class LogSection extends TraceSection implements EndTransactionDefer { private MmuCall mmuCall; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java index e974f3b8c..cfd68df68 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TraceSection.java @@ -127,7 +127,7 @@ public void seal() { commonValues.codeFragmentIndex( currentPhase == TX_EXEC ? hub() - .getCfiByMetaData( + .getCodeFragmentIndexByMetaData( commonValues.callFrame().byteCodeAddress(), commonValues.callFrame().byteCodeDeploymentNumber(), commonValues.callFrame().isDeployment()) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java index 58ed063fa..eb23fd7c2 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxFinalizationSection.java @@ -22,7 +22,7 @@ import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TransactionFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -34,7 +34,7 @@ import org.hyperledger.besu.evm.tracing.OperationTracer; import org.hyperledger.besu.evm.worldstate.WorldView; -public class TxFinalizationSection extends TraceSection implements PostTransactionDefer { +public class TxFinalizationSection extends TraceSection implements EndTransactionDefer { private final TransactionProcessingMetadata txMetadata; private AccountSnapshot senderGasRefund; @@ -123,7 +123,7 @@ private void setSnapshots(Hub hub, WorldView world) { senderGasRefundNew = senderIsCoinbase(hub) ? coinbaseGasRefund.deepCopy() - : AccountSnapshot.canonical(hub, world, senderAddress); + : AccountSnapshot.canonical(hub, world, senderAddress).turnOnWarmth(); senderGasRefund = senderGasRefundNew.deepCopy().decrementBalanceBy(txMetadata.getGasRefundInWei()); } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java index 6ccdee5a6..dce5d32c1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxInitializationSection.java @@ -21,7 +21,7 @@ import lombok.Getter; import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TransactionFragment; @@ -37,7 +37,7 @@ import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.worldstate.WorldView; -public class TxInitializationSection extends TraceSection implements PostTransactionDefer { +public class TxInitializationSection extends TraceSection implements EndTransactionDefer { @Getter private final int hubStamp; final AccountFragment.AccountFragmentFactory accountFragmentFactory; @@ -202,6 +202,12 @@ public void resolveAtEndTransaction( recipientUndoingValueReceptionNew = recipientValueReception.deepCopy().setDeploymentNumber(hub).turnOnWarmth(); + if (tx.getTo().isEmpty()) { + recipientUndoingValueReception + .deploymentStatus(true) + .code(recipientValueReceptionNew.code()); + } + final int revertStamp = hub.currentFrame().revertStamp(); this.addFragment( // ACC i + 5 (sender) diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java index 6cc3c72df..489e5e821 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/TxSkipSection.java @@ -23,7 +23,7 @@ import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.TransactionFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -37,10 +37,10 @@ /** * SkippedTransaction latches data at the pre-execution of the transaction data that will be used - * later, through a {@link PostTransactionDefer}, to generate the trace chunks required for the + * later, through a {@link EndTransactionDefer}, to generate the trace chunks required for the * proving of a pure transaction. */ -public class TxSkipSection extends TraceSection implements PostTransactionDefer { +public class TxSkipSection extends TraceSection implements EndTransactionDefer { final TransactionProcessingMetadata txMetadata; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java index b426c3c6b..8aa60bc24 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/call/CallSection.java @@ -35,9 +35,9 @@ import net.consensys.linea.zktracer.module.hub.defer.ContextEntryDefer; import net.consensys.linea.zktracer.module.hub.defer.ContextExitDefer; import net.consensys.linea.zktracer.module.hub.defer.ContextReEntryDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.defer.PostOpcodeDefer; import net.consensys.linea.zktracer.module.hub.defer.PostRollbackDefer; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -85,7 +85,7 @@ public class CallSection extends TraceSection ContextExitDefer, ContextReEntryDefer, PostRollbackDefer, - PostTransactionDefer { + EndTransactionDefer { private static final Map> ADDRESS_TO_PRECOMPILE = @@ -575,11 +575,11 @@ private void completeAbortWillRevert(Hub hub) { private void completeEoaSuccessWillRevert(Hub hub) { scenarioFragment.setScenario(CALL_EOA_SUCCESS_WILL_REVERT); - callerSecond = reEntryCallerSnapshot.deepCopy().setDeploymentInfo(hub); - callerSecondNew = callerFirst.deepCopy().setDeploymentInfo(hub); + callerSecond = reEntryCallerSnapshot.deepCopy().setDeploymentNumber(hub); + callerSecondNew = callerFirst.deepCopy().setDeploymentNumber(hub); - calleeSecond = reEntryCalleeSnapshot.deepCopy().setDeploymentInfo(hub); - calleeSecondNew = calleeFirst.deepCopy().setDeploymentInfo(hub); + calleeSecond = reEntryCalleeSnapshot.deepCopy().setDeploymentNumber(hub); + calleeSecondNew = calleeFirst.deepCopy().setDeploymentNumber(hub); final AccountFragment undoingCallerAccountFragment = factory @@ -605,8 +605,14 @@ private void completeEoaSuccessWillRevert(Hub hub) { private void completeSmcFailureWillRevert(Hub hub) { scenarioFragment.setScenario(CALL_SMC_FAILURE_WILL_REVERT); - calleeThird = calleeSecondNew.deepCopy().setDeploymentNumber(hub); - calleeThirdNew = calleeFirst.deepCopy().setDeploymentNumber(hub); + if (isSelfCall()) { + calleeThird = callerSecondNew.deepCopy().setDeploymentNumber(hub); + calleeThirdNew = callerFirst.deepCopy().setDeploymentNumber(hub); + } else { + calleeThird = calleeSecondNew.deepCopy().setDeploymentNumber(hub); + calleeThirdNew = calleeFirst.deepCopy().setDeploymentNumber(hub); + } + // this (should) work for both self calls and foreign address calls final AccountFragment undoingCalleeWarmthAccountFragment = factory @@ -630,11 +636,11 @@ private void completeSmcOrPrcSuccessWillRevert(Hub hub) { scenarioFragment.setScenario(CALL_PRC_SUCCESS_WILL_REVERT); } - callerSecond = callerFirstNew.deepCopy().setDeploymentInfo(hub); - callerSecondNew = callerFirst.deepCopy().setDeploymentInfo(hub); + callerSecond = callerFirstNew.deepCopy().setDeploymentNumber(hub); + callerSecondNew = callerFirst.deepCopy().setDeploymentNumber(hub); - calleeSecond = calleeFirstNew.deepCopy().setDeploymentInfo(hub); - calleeSecondNew = calleeFirst.deepCopy().setDeploymentInfo(hub); + calleeSecond = calleeFirstNew.deepCopy().setDeploymentNumber(hub); + calleeSecondNew = calleeFirst.deepCopy().setDeploymentNumber(hub); final AccountFragment undoingCallerAccountFragment = factory diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java index 6bae39253..669d5936a 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/ReturnSection.java @@ -25,8 +25,8 @@ import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; import net.consensys.linea.zktracer.module.hub.defer.ContextReEntryDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.defer.PostRollbackDefer; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -53,7 +53,7 @@ @Getter public class ReturnSection extends TraceSection - implements ContextReEntryDefer, PostRollbackDefer, PostTransactionDefer { + implements ContextReEntryDefer, PostRollbackDefer, EndTransactionDefer { final boolean returnFromMessageCall; final boolean returnFromDeployment; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java index a1316d366..c0dad8f06 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/SelfdestructSection.java @@ -15,6 +15,7 @@ package net.consensys.linea.zktracer.module.hub.section.halt; import static com.google.common.base.Preconditions.*; +import static net.consensys.linea.zktracer.module.hub.fragment.scenario.SelfdestructScenarioFragment.SelfdestructScenario.*; import static net.consensys.linea.zktracer.module.hub.signals.Exceptions.OUT_OF_GAS_EXCEPTION; import java.util.ArrayList; @@ -24,8 +25,9 @@ import lombok.Getter; import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.defer.AfterTransactionFinalizationDefer; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.defer.PostRollbackDefer; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -43,7 +45,7 @@ import org.hyperledger.besu.evm.worldstate.WorldView; public class SelfdestructSection extends TraceSection - implements PostRollbackDefer, PostTransactionDefer { + implements PostRollbackDefer, EndTransactionDefer, AfterTransactionFinalizationDefer { final int id; final int hubStamp; @@ -89,8 +91,7 @@ public SelfdestructSection(Hub hub, MessageFrame frame) { // SCN fragment selfdestructScenarioFragment = new SelfdestructScenarioFragment(); if (Exceptions.any(exceptions)) { - selfdestructScenarioFragment.setScenario( - SelfdestructScenarioFragment.SelfdestructScenario.SELFDESTRUCT_EXCEPTION); + selfdestructScenarioFragment.setScenario(SELFDESTRUCT_EXCEPTION); } // CON fragment (1) @@ -233,8 +234,7 @@ public void resolveUponRollback(Hub hub, MessageFrame messageFrame, CallFrame ca selfDestructWasReverted = true; - selfdestructScenarioFragment.setScenario( - SelfdestructScenarioFragment.SelfdestructScenario.SELFDESTRUCT_WILL_REVERT); + selfdestructScenarioFragment.setScenario(SELFDESTRUCT_WILL_REVERT); } @Override @@ -254,11 +254,6 @@ public void resolveAtEndTransaction( checkArgument(effectiveSelfDestructMap.containsKey(ephemeralAccount)); - // We modify the account fragment to reflect the self-destruct time - final int hubStampOfTheActionableSelfDestruct = effectiveSelfDestructMap.get(ephemeralAccount); - - checkArgument(hubStamp >= hubStampOfTheActionableSelfDestruct); - // This grabs the accounts right after the coinbase and sender got their gas money back // in particular this will get the coinbase address post gas reward. accountWiping = @@ -268,18 +263,14 @@ public void resolveAtEndTransaction( .findFirst() .orElseThrow(() -> new IllegalStateException("Account not found")); - if (hubStamp == hubStampOfTheActionableSelfDestruct) { - selfdestructScenarioFragment.setScenario( - SelfdestructScenarioFragment.SelfdestructScenario - .SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED); - - hub.transients() - .conflation() - .deploymentInfo() - .deploymentUpdateForSuccessfulSelfDestruct(selfdestructor.address()); + // We modify the account fragment to reflect the self-destruct time + final int hubStampOfTheActionableSelfDestruct = effectiveSelfDestructMap.get(ephemeralAccount); + checkArgument(hubStamp >= hubStampOfTheActionableSelfDestruct); - accountWipingNew = selfdestructorNew.wipe(hub.transients().conflation().deploymentInfo()); + if (hubStamp == hubStampOfTheActionableSelfDestruct) { + selfdestructScenarioFragment.setScenario(SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED); + accountWipingNew = accountWiping.deepCopy(); // the hub's defers.resolvePostTransaction() gets called after the // hub's completeLineaTransaction which in turn calls // freshDeploymentNumberFinishingSelfdestruct() @@ -293,13 +284,24 @@ public void resolveAtEndTransaction( DomSubStampsSubFragment.selfdestructDomSubStamps(hub, hubStamp)); this.addFragment(accountWipingFragment); + this.addFragment(finalUnexceptionalContextFragment); + + hub.defers().scheduleForAfterTransactionFinalization(this); } else { - selfdestructScenarioFragment.setScenario( - SelfdestructScenarioFragment.SelfdestructScenario - .SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED); + selfdestructScenarioFragment.setScenario(SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED); + this.addFragment(finalUnexceptionalContextFragment); } + } + + @Override + public void resolveAfterTransactionFinalization(Hub hub, WorldView state) { + + hub.transients() + .conflation() + .deploymentInfo() + .deploymentUpdateForSuccessfulSelfDestruct(selfdestructor.address()); - this.addFragment(finalUnexceptionalContextFragment); + accountWipingNew.wipe(hub.transients().conflation().deploymentInfo()); } private boolean selfdestructTargetsItself() { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java index 5caf267a7..7012b55fb 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/section/halt/StopSection.java @@ -20,8 +20,8 @@ import net.consensys.linea.zktracer.module.hub.AccountSnapshot; import net.consensys.linea.zktracer.module.hub.Hub; +import net.consensys.linea.zktracer.module.hub.defer.EndTransactionDefer; import net.consensys.linea.zktracer.module.hub.defer.PostRollbackDefer; -import net.consensys.linea.zktracer.module.hub.defer.PostTransactionDefer; import net.consensys.linea.zktracer.module.hub.fragment.ContextFragment; import net.consensys.linea.zktracer.module.hub.fragment.DomSubStampsSubFragment; import net.consensys.linea.zktracer.module.hub.fragment.account.AccountFragment; @@ -36,7 +36,7 @@ import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.worldstate.WorldView; -public class StopSection extends TraceSection implements PostRollbackDefer, PostTransactionDefer { +public class StopSection extends TraceSection implements PostRollbackDefer, EndTransactionDefer { final int hubStamp; final Address address; diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/callstack/CallFrame.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/callstack/CallFrame.java index 0fc81663a..b9b494924 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/callstack/CallFrame.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/callstack/CallFrame.java @@ -78,7 +78,8 @@ public boolean isMessageCall() { public int getCodeFragmentIndex(Hub hub) { return this == CallFrame.EMPTY || type == CallFrameType.TRANSACTION_CALL_DATA_HOLDER ? 0 - : hub.getCfiByMetaData(byteCodeAddress, byteCodeDeploymentNumber, isDeployment); + : hub.getCodeFragmentIndexByMetaData( + byteCodeAddress, byteCodeDeploymentNumber, isDeployment); } @Getter @Setter private int pc; @@ -90,7 +91,7 @@ public int getCodeFragmentIndex(Hub hub) { @Getter private final MemoryRange callDataRange; // immutable @Getter private final MemoryRange returnAtRange; // immutable @Getter @Setter private MemoryRange returnDataRange = MemoryRange.EMPTY; // mutable - @Getter @Setter private MemoryRange outputDataRange = MemoryRange.EMPTY; // set at exit time + @Getter @Setter private MemoryRange outputDataRange; // set at exit time @Getter private boolean executionPaused = false; @Getter @Setter private long lastValidGasNext = 0; @@ -203,6 +204,7 @@ public void rememberGasNextBeforePausing(Hub hub) { this.parentId = parentId; this.callDataRange = callDataRange; this.returnAtRange = returnAtRange; + this.outputDataRange = new MemoryRange(contextNumber); } public boolean isRoot() { @@ -312,9 +314,4 @@ public OpCode getOpCode() { public static OpCode getOpCode(MessageFrame frame) { return OpCode.of(0xFF & frame.getCurrentOperation().getOpcode()); } - - /** Get to fucking work GitHub */ - public void squashReturnData() { - returnDataRange(MemoryRange.EMPTY); - } } diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/stack/Stack.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/stack/Stack.java index ab7965943..d3897f059 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/stack/Stack.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/runtime/stack/Stack.java @@ -153,17 +153,18 @@ private void dup(MessageFrame frame, StackContext pending) { private void swap(MessageFrame frame, StackContext pending) { int depth = currentOpcodeData.stackSettings().delta() - 1; - Bytes val1 = getStack(frame, 0); - Bytes val2 = getStack(frame, depth); + Bytes topValue = getStack(frame, 0); + Bytes botValue = getStack(frame, depth); pending.addLine( new IndexedStackOperation( - 1, StackItem.pop((short) (height - depth), val1, stackStampWithOffset(0))), - new IndexedStackOperation(2, StackItem.pop(height, val2, stackStampWithOffset(1))), + 1, StackItem.pop((short) (height - depth), botValue, stackStampWithOffset(0))), + new IndexedStackOperation(2, StackItem.pop(height, topValue, stackStampWithOffset(1))), new IndexedStackOperation( - 3, StackItem.pushImmediate((short) (height - depth), val2, stackStampWithOffset(2))), + 3, + StackItem.pushImmediate((short) (height - depth), topValue, stackStampWithOffset(2))), new IndexedStackOperation( - 4, StackItem.pushImmediate(height, val1, stackStampWithOffset(3)))); + 4, StackItem.pushImmediate(height, botValue, stackStampWithOffset(3)))); } private void log(MessageFrame frame, StackContext pending) { diff --git a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java index 5bf97d409..7149fdb04 100644 --- a/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java +++ b/arithmetization/src/main/java/net/consensys/linea/zktracer/types/TransactionProcessingMetadata.java @@ -17,6 +17,7 @@ import static net.consensys.linea.zktracer.module.constants.GlobalConstants.*; import static net.consensys.linea.zktracer.types.AddressUtils.effectiveToAddress; +import static net.consensys.linea.zktracer.types.AddressUtils.isPrecompile; import java.math.BigInteger; import java.util.HashMap; @@ -175,14 +176,16 @@ public void setPreFinalisationValues( } public void completeLineaTransaction( - Hub hub, final boolean statusCode, final List logs, final Set

selfDestructs) { + Hub hub, + WorldView world, + final boolean statusCode, + final List logs, + final Set
selfDestructs) { this.statusCode = statusCode; hubStampTransactionEnd = hub.stamp(); this.logs = logs; for (Address address : selfDestructs) { - destructedAccountsSnapshot.add( - AccountSnapshot.fromAddress( - address, true, hub.deploymentNumberOf(address), hub.deploymentStatusOf(address))); + destructedAccountsSnapshot.add(AccountSnapshot.canonical(hub, world, address)); } determineSelfDestructTimeStamp(); @@ -328,4 +331,23 @@ public void captureUpdatedInitialRecipientAddressDeploymentInfoAtTransactionStar public Bytes getTransactionCallData() { return besuTransaction.getData().orElse(Bytes.EMPTY); } + + public boolean coinbaseWarmthAfterTxInit(Hub hub) { + final Address coinbaseAddress = hub.coinbaseAddress; + final boolean coinbaseIsInAccessList = + this.getBesuTransaction() + .getAccessList() + .map( + accessList -> + accessList.stream().anyMatch(entry -> entry.address().equals(coinbaseAddress))) + .orElse(false); + final boolean coinbaseIsPrecompile = isPrecompile(coinbaseAddress); + final boolean coinbaseIsSender = this.getSender().equals(coinbaseAddress); + final boolean coinbaseIsRecipient = this.getEffectiveRecipient().equals(coinbaseAddress); + + return coinbaseIsInAccessList + || coinbaseIsPrecompile + || coinbaseIsSender + || coinbaseIsRecipient; + } } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/callTests/smc/complexTargets/FailureWillRevertTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/callTests/smc/complexTargets/FailureWillRevertTest.java index 080249b12..5c12507d2 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/callTests/smc/complexTargets/FailureWillRevertTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/callTests/smc/complexTargets/FailureWillRevertTest.java @@ -21,17 +21,19 @@ import net.consensys.linea.testing.BytecodeCompiler; import net.consensys.linea.testing.BytecodeRunner; import net.consensys.linea.zktracer.opcode.OpCode; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; -/** - * The following uses a smart contract that calls itself but stops after one iteration. At which - * point it reverts and its caller reverts, too. - */ @ExtendWith(UnitTestWatcher.class) public class FailureWillRevertTest { + /** + * The following uses a smart contract that calls itself but stops after one iteration. At which + * point it reverts and its caller reverts, too. The test modifies storage of the underlying + * account at both depths. These changes thus get reverted. + */ @ParameterizedTest @EnumSource( value = OpCode.class, @@ -53,12 +55,42 @@ public void singleSelfCallFailureWillRevertTest(OpCode callOpCode) { appendRevert(program, 13, 9); // + 5 // top is zero execution path prepareLanding(program); - selfCall(program, callOpCode, 0xffff, 0x01); + selfCall(program, callOpCode, 0xffff, 0x10); appendRevert(program, 31, 7); BytecodeRunner.of(program).run(); } + @Test + public void banalAdditionTest() { + + BytecodeCompiler program = BytecodeCompiler.newProgram(); + sloadFrom(program, 0x00); // puts 0 on stack + addX(program, 0x01); + sstoreAt(program, 0x00); + sloadFrom(program, 0x00); // puts 1 on stack + addX(program, 0x01); + sstoreAt(program, 0x00); + appendRevert(program, 31, 7); + + BytecodeRunner.of(program).run(); + } + + /** + * This test was written in the debugging of stack-consistency. It showed us that the "top" and + * "bottom" elements involved in a SWAPX operation were mixed up in the implementation (of + * the swap stack pattern.) + */ + @Test + public void banalSwapTest() { + + BytecodeCompiler program = BytecodeCompiler.newProgram(); + program.push(1).push(2).op(SWAP1).push(3).op(SWAP1); + + BytecodeRunner.of(program).run(); + } + + /** Similar to {@link #singleSelfCallFailureWillRevertTest(OpCode)} but with two self calls. */ @ParameterizedTest @EnumSource( value = OpCode.class, diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/RepeatedSelfDestructsOfSameAccountTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/RepeatedSelfDestructsOfSameAccountTests.java index 00552e20c..9f5c34185 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/RepeatedSelfDestructsOfSameAccountTests.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/selfdestructTests/RepeatedSelfDestructsOfSameAccountTests.java @@ -204,4 +204,26 @@ public void calleeThenCallerSelfDestructReverted(Heir heir) { run(heir); } + + @ParameterizedTest + @EnumSource(Heir.class) + public void basicSelfDestruct(Heir heir) { + selfDestructorAccount = basicSelfDestructor(heir); + buildToAccount(); + Transaction transaction = + ToyTransaction.builder() + .keyPair(keyPair) + .sender(userAccount) + .to(selfDestructorAccount) + .transactionType(TransactionType.FRONTIER) + .gasLimit(500_000L) + .value(Wei.of(0xeeff)) + .build(); + ToyExecutionEnvironmentV2.builder() + .accounts(List.of(userAccount, toAccount, selfDestructorAccount)) + .transaction(transaction) + .build() + .run(); + run(heir); + } } diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java index b5b5c27b1..c3860a386 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/instructionprocessing/zeroSize/CallArgumentsMaybeRedundant.java @@ -49,14 +49,17 @@ void zeroReturnAtCapacityTest() { program .push(0) // return at capacity .push("ff".repeat(32)) // return at offset - .push(0) // call data size - .push(0) // call data offset + .push(0) // cds + .push(0) // cdo .push("ca11ee") // address .push(1000) // gas .op(OpCode.STATICCALL); BytecodeCompiler calleeProgram = BytecodeCompiler.newProgram(); - calleeProgram.op(OpCode.CALLDATASIZE); + calleeProgram.op(OpCode.RETURNDATASIZE).op(OpCode.CALLDATASIZE); + // .push(0x51) // size + // .push(0x0f) // offset + // .op(OpCode.RETURN); final ToyAccount calleeAccount = ToyAccount.builder() @@ -74,16 +77,23 @@ void zeroReturnAtCapacityTest() { void zeroCallDataSizeTest() { BytecodeCompiler program = BytecodeCompiler.newProgram(); program - .push(0) // return at capacity - .push(0) // return at offset + .push(0xff) // r@c + .push(0x7f) // r@o .push(0) // call data size - .push("ff".repeat(32)) // call data offset + .push("ff".repeat(32)) // enormous call data offset .push("ca11ee") // address .push(1000) // gas - .op(OpCode.STATICCALL); + .op(OpCode.STATICCALL) + .op(OpCode.RETURNDATASIZE) + .op(OpCode.CALLDATASIZE); BytecodeCompiler calleeProgram = BytecodeCompiler.newProgram(); - calleeProgram.op(OpCode.CALLDATASIZE); + calleeProgram + .op(OpCode.RETURNDATASIZE) + .op(OpCode.CALLDATASIZE) + .push(0x51) // size + .push(0x0f) // offset + .op(OpCode.RETURN); final ToyAccount calleeAccount = ToyAccount.builder() diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java index 93e2d3eb4..2ef0ba95f 100644 --- a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/blockdata/GasLimitTest.java @@ -85,9 +85,9 @@ private static Stream blockDataVariableGasLimitTestSource() { List.of( 0L, (long) ETHEREUM_GAS_LIMIT_MINIMUM, - (long) GAS_LIMIT_MINIMUM, + (long) LINEA_GAS_LIMIT_MINIMUM, 100_000_000L, - (long) GAS_LIMIT_MAXIMUM, + (long) LINEA_GAS_LIMIT_MAXIMUM, Long.MAX_VALUE); for (Long gasLimit : gasLimits) { for (NextGasLimitScenario scenario : values()) { diff --git a/gradle/trace-files.gradle b/gradle/trace-files.gradle index 6dbd1ad6f..b7a5bed35 100644 --- a/gradle/trace-files.gradle +++ b/gradle/trace-files.gradle @@ -148,12 +148,15 @@ tasks.register('buildTracer') { def chain = System.getProperty('blockchain') // Conditional dependsOn - if(chain == null || chain == "Linea") { - print("Building for Linea...\n") + if (chain == null) { + print("No chain provided, building for Linea\n") dependsOn 'blockdataLinea' - } else if(chain == "Ethereum") { + } else if (chain == "Linea") { + print("Building for Linea\n") + dependsOn 'blockdataLinea' + } else if (chain == "Ethereum") { dependsOn 'blockdataEthereum' - print("Building for Ethereum...\n") + print("Building for Ethereum\n") } else { // Force build failure if unknown chain. println("*** unknown target chain. Try '-Dblockchain=Linea' or '-Dblockchain=Ethereum'\n\n") diff --git a/linea-constraints b/linea-constraints index be40337bd..33578bedc 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit be40337bda0a65f271f2ed9260c29271c637cfdb +Subproject commit 33578bedcf1cd77b3ca59d8a0fdbbd3f897780e2 diff --git a/reference-tests/build.gradle b/reference-tests/build.gradle index 2ed531354..158a42810 100644 --- a/reference-tests/build.gradle +++ b/reference-tests/build.gradle @@ -106,6 +106,7 @@ tasks.register('referenceGeneralStateTests', Test) { // Record zkevm.bin for CorsetValidator environment.put("ZKEVM_BIN", System.getenv("ZKEVM_BIN") ?: "zkevm_for_reference_tests.bin") // Configure parallelism + environment.put("blockchain", System.getenv("blockchain") ?: "Ethereum") systemProperty("junit.jupiter.execution.timeout.default", "15 m") // 5 minutes systemProperty("junit.jupiter.execution.parallel.enabled", "true") systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") diff --git a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java index 5a8518439..a8f77e378 100644 --- a/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java +++ b/reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java @@ -292,6 +292,59 @@ public class BlockchainReferenceTestTools { // module in existence PARAMS.ignore("CallContractFromNotBestBlock_London\\[London\\]"); PARAMS.ignore("RPC_API_Test_London\\[London\\]"); + + // the following tests blow up due monetary creation pre PoS where the COINBASE would get paid 2 + // Eth at the end of every block + // TODO: re-enable post Paris + PARAMS.ignore("correct_London\\[London\\]"); + PARAMS.ignore("incorrectUncleTimestamp4_London\\[London\\]"); + PARAMS.ignore("incorrectUncleTimestamp5_London\\[London\\]"); + PARAMS.ignore("timestampTooHigh_London\\[London\\]"); + PARAMS.ignore("timestampTooLow_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestamp3_London\\[London\\]"); + PARAMS.ignore("wrongStateRoot_London\\[London\\]"); + PARAMS.ignore("besuBaseFeeBug_London\\[London\\]"); + PARAMS.ignore("burnVerifyLondon_London\\[London\\]"); + PARAMS.ignore("highDemand_London\\[London\\]"); + PARAMS.ignore("intrinsic_London\\[London\\]"); + PARAMS.ignore("intrinsicTip_London\\[London\\]"); + PARAMS.ignore("medDemand_London\\[London\\]"); + PARAMS.ignore("tipsLondon_London\\[London\\]"); + PARAMS.ignore("transType_London\\[London\\]"); + PARAMS.ignore("highGasUsage_London\\[London\\]"); + PARAMS.ignore("blockhashNonConstArg_London\\[London\\]"); + PARAMS.ignore("blockhashTests_London\\[London\\]"); + PARAMS.ignore("extcodehashEmptySuicide_London\\[London\\]"); + PARAMS.ignore("logRevert_London\\[London\\]"); + PARAMS.ignore("multimpleBalanceInstruction_London\\[London\\]"); // typo intended + PARAMS.ignore("refundReset_London\\[London\\]"); + PARAMS.ignore("simpleSuicide_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestamp2_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestampDifficultyDrop_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestampDifficultyDrop2_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestampDifficultyDrop3_London\\[London\\]"); + PARAMS.ignore("futureUncleTimestampDifficultyDrop4_London\\[London\\]"); + PARAMS.ignore("uncleBloomNot0_2_London\\[London\\]"); + PARAMS.ignore("uncleBloomNot0_London\\[London\\]"); + PARAMS.ignore("oneUncle_London\\[London\\]"); + PARAMS.ignore("oneUncleGeneration2_London\\[London\\]"); + PARAMS.ignore("oneUncleGeneration3_London\\[London\\]"); + PARAMS.ignore("oneUncleGeneration4_London\\[London\\]"); + PARAMS.ignore("uncleBloomNot0_3_London\\[London\\]"); + PARAMS.ignore("oneUncleGeneration5_London\\[London\\]"); + PARAMS.ignore("oneUncleGeneration6_London\\[London\\]"); + PARAMS.ignore("twoUncle_London\\[London\\]"); + PARAMS.ignore("uncleHeaderAtBlock2_London\\[London\\]"); + PARAMS.ignore("RecallSuicidedContract_London\\[London\\]"); + PARAMS.ignore("RecallSuicidedContractInOneBlock_London\\[London\\]"); + PARAMS.ignore("timeDiff12_London\\[London\\]"); + PARAMS.ignore("timeDiff13_London\\[London\\]"); + PARAMS.ignore("timeDiff14_London\\[London\\]"); + PARAMS.ignore("wallet2outOf3txs_London\\[London\\]"); + PARAMS.ignore("wallet2outOf3txs2_London\\[London\\]"); + PARAMS.ignore("wallet2outOf3txsRevoke_London\\[London\\]"); + PARAMS.ignore("wallet2outOf3txsRevokeAndConfirmAgain_London\\[London\\]"); + PARAMS.ignore("walletReorganizeOwners_London\\[London\\]"); } private BlockchainReferenceTestTools() { diff --git a/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java b/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java index d04c23733..6d3cc0dcd 100644 --- a/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java +++ b/testing/src/main/java/net/consensys/linea/testing/BytecodeRunner.java @@ -116,7 +116,7 @@ public void run(Wei senderBalance, Long gasLimit, List additionalAcc ToyTransaction.builder() .sender(senderAccount) .to(receiverAccount) - .value(Wei.of(69)) + .value(Wei.of(272)) // 256 + 16, easier for debugging .keyPair(keyPair) .gasLimit(selectedGasLimit) .gasPrice(Wei.of(8)) From ac2728c58213cb4dcf9d21fbfcfa1eba6746230e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20B=C3=A9gassat?= <38285177+OlivierBBB@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:38:20 +0100 Subject: [PATCH 51/54] feat: point to master of constraints (#1782) --- linea-constraints | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linea-constraints b/linea-constraints index 33578bedc..c2bf8fa16 160000 --- a/linea-constraints +++ b/linea-constraints @@ -1 +1 @@ -Subproject commit 33578bedcf1cd77b3ca59d8a0fdbbd3f897780e2 +Subproject commit c2bf8fa169453319b753a8f1b4c06ef3ce30ba01 From 08f29956cfeb8d3db2bb2800492e54f0fb5671ee Mon Sep 17 00:00:00 2001 From: David Pearce Date: Fri, 7 Feb 2025 12:49:52 +1300 Subject: [PATCH 52/54] chore: update `go-corset` to latest commit (#1781) This updates `go-corset` to `75a88c5` as this contains some performance optimisations of interest. Specifically, simplification of inverse columns. --- .github/actions/setup-go-corset/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-go-corset/action.yml b/.github/actions/setup-go-corset/action.yml index 1bbb9baf2..473506e60 100644 --- a/.github/actions/setup-go-corset/action.yml +++ b/.github/actions/setup-go-corset/action.yml @@ -12,4 +12,4 @@ runs: - name: Install Go Corset shell: bash - run: go install github.com/consensys/go-corset/cmd/go-corset@latest + run: go install github.com/consensys/go-corset/cmd/go-corset@75a88c5 From 9c1f3c32efeca684b65195efde836ade5849fef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bojarski?= <54240434+letypequividelespoubelles@users.noreply.github.com> Date: Fri, 7 Feb 2025 10:54:37 +0100 Subject: [PATCH 53/54] test: add SHAKIRA tests (#1762) * test: add SHAKIRA tests Signed-off-by: F Bojarski * test: fix return case Signed-off-by: F Bojarski --------- Signed-off-by: F Bojarski --- .../shakira/ShakiraInputsExtensiveTests.java | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 arithmetization/src/test/java/net/consensys/linea/zktracer/module/shakira/ShakiraInputsExtensiveTests.java diff --git a/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shakira/ShakiraInputsExtensiveTests.java b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shakira/ShakiraInputsExtensiveTests.java new file mode 100644 index 000000000..c9997dd2d --- /dev/null +++ b/arithmetization/src/test/java/net/consensys/linea/zktracer/module/shakira/ShakiraInputsExtensiveTests.java @@ -0,0 +1,162 @@ +/* + * Copyright ConsenSys Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package net.consensys.linea.zktracer.module.shakira; + +import static net.consensys.linea.zktracer.module.constants.GlobalConstants.WORD_SIZE; +import static net.consensys.linea.zktracer.opcode.OpCode.*; +import static net.consensys.linea.zktracer.types.Utils.rightPadTo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.stream.Stream; + +import net.consensys.linea.UnitTestWatcher; +import net.consensys.linea.testing.BytecodeCompiler; +import net.consensys.linea.testing.BytecodeRunner; +import net.consensys.linea.zktracer.opcode.OpCode; +import org.apache.tuweni.bytes.Bytes; +import org.apache.tuweni.bytes.Bytes32; +import org.hyperledger.besu.datatypes.Address; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@ExtendWith(UnitTestWatcher.class) +public class ShakiraInputsExtensiveTests { + + private final Random SEED = new Random(666); + private final List SIZE = + List.of(0, 1, 2, 8, 15, 16, 17, 31, 32, 33, 254, 255, 256, 257, 258, 259); + private final List OFFSET = + List.of(0, 1, 2, 15, 16, 17, 23, 31, 32, 33, 255, 256, 257, 65535, 65535, 65537); + private final List INSTRUCTION = + List.of(CALL, CALLCODE, STATICCALL, DELEGATECALL, SHA3, CREATE2, RETURN); + + private static final short CREATE_OPCODE_LENGTH = 21; + + @Tag("Weekly") + @ParameterizedTest + @MethodSource("inputs") + void shakiraInputTesting(final int size, final int offset, final OpCode instruction) { + BytecodeRunner.of( + BytecodeCompiler.newProgram() + .op(CALLDATASIZE) + .push(0) + .push(0) + .op(CALLDATACOPY) + .immediate(instructionSpecificBytecode(size, offset, instruction)) + .compile()) + .run(); + } + + private Stream inputs() { + final List inputs = new ArrayList<>(); + for (int size : SIZE) { + for (int offset : OFFSET) { + inputs.add( + Arguments.of(size, offset, INSTRUCTION.get(SEED.nextInt(0, INSTRUCTION.size())))); + } + } + return inputs.stream(); + } + + private Bytes instructionSpecificBytecode(int size, int offset, OpCode instruction) { + switch (instruction) { + case CALL, CALLCODE: + { + return BytecodeCompiler.newProgram() + .push(SEED.nextInt(WORD_SIZE)) + .push(0) + .push(size) + .push(offset) + .push(0) + .push(Address.SHA256) + .push(1000000) + .op(instruction) + .compile(); + } + case STATICCALL, DELEGATECALL: + { + return BytecodeCompiler.newProgram() + .push(SEED.nextInt(WORD_SIZE)) + .push(0) + .push(size) + .push(offset) + .push(Address.SHA256) + .push(1000000) + .op(instruction) + .compile(); + } + case SHA3: + { + return BytecodeCompiler.newProgram().push(size).push(offset).op(SHA3).compile(); + } + case RETURN: + { + return BytecodeCompiler.newProgram() + .push( + rightPadTo( + Bytes.concatenate( + // size + Bytes.of(CALLDATASIZE.byteValue()), + Bytes.of(PUSH2.byteValue()), + Bytes.ofUnsignedShort(CREATE_OPCODE_LENGTH), + Bytes.of(SUB.byteValue()), + // offset + Bytes.of(PUSH2.byteValue()), + Bytes.ofUnsignedShort(CREATE_OPCODE_LENGTH), + // destOffset + Bytes.of(PUSH2.byteValue()), + Bytes.ofUnsignedShort(0), + Bytes.of(CALLDATACOPY.byteValue()), + Bytes.of(PUSH2.byteValue()), + Bytes.ofUnsignedShort(size), + Bytes.of(PUSH4.byteValue()), + Bytes.ofUnsignedInt(offset), + Bytes.of(RETURN.byteValue())), + WORD_SIZE)) + .push(0) + .op(MSTORE) + .op(CALLDATASIZE) + .push(0) + .push(CREATE_OPCODE_LENGTH) + .op(CALLDATACOPY) + .op(MSIZE) // size + .push(0) // offset + .push(0) // value + .op(CREATE) + .compile(); + } + case CREATE2: + { + return BytecodeCompiler.newProgram() + .push(Bytes32.random(SEED)) + .push(size) + .push(offset) + .push(12) // value + .op(CREATE2) + .compile(); + } + default: + throw new IllegalArgumentException("Unsupported instruction: " + instruction); + } + } +} From fc4e83fbe990cfd895495cb17784b815f0c11473 Mon Sep 17 00:00:00 2001 From: FlorianHuc Date: Fri, 7 Feb 2025 12:54:43 +0100 Subject: [PATCH 54/54] Fix/parsing constraint failed (#1760) * parse new responses format * add class name * add class name --- .../test/java/net/consensys/linea/ReferenceTestWatcher.java | 4 +++- .../net/consensys/linea/reporting/TestOutcomeWriterTool.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/reference-tests/src/test/java/net/consensys/linea/ReferenceTestWatcher.java b/reference-tests/src/test/java/net/consensys/linea/ReferenceTestWatcher.java index f1fa4534b..23721b9eb 100644 --- a/reference-tests/src/test/java/net/consensys/linea/ReferenceTestWatcher.java +++ b/reference-tests/src/test/java/net/consensys/linea/ReferenceTestWatcher.java @@ -24,6 +24,8 @@ public class ReferenceTestWatcher extends LineaTestWatcher { @Override public String getTestName(ExtensionContext context) { - return context.getDisplayName().split(": ")[1]; + return context.getTestClass().map(c -> c.getSimpleName()).orElse("") + + ":" + + context.getDisplayName().split(": ")[1]; } } diff --git a/testing/src/main/java/net/consensys/linea/reporting/TestOutcomeWriterTool.java b/testing/src/main/java/net/consensys/linea/reporting/TestOutcomeWriterTool.java index 0c5d08e6b..cf2660540 100644 --- a/testing/src/main/java/net/consensys/linea/reporting/TestOutcomeWriterTool.java +++ b/testing/src/main/java/net/consensys/linea/reporting/TestOutcomeWriterTool.java @@ -134,6 +134,7 @@ public static Map> extractConstraints(String message) { String failingConstraints = line.substring(line.indexOf("failing constraint") + "failing constraint".length()) .replace(':', ' '); + getPairFromString(failingConstraints, pairs); } } @@ -188,6 +189,8 @@ private static void getPairFromString(String constraint, Map String[] pair; if (constraint.contains("-into-")) { pair = constraint.split("-into-"); + } else if (constraint.contains("---")) { + pair = constraint.split("---"); } else { pair = constraint.split("\\."); }