Skip to content

Commit

Permalink
updated counters (#1155)
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Staykov authored and hexoscott committed Sep 10, 2024
1 parent 62033e5 commit ff1e7d0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 69 deletions.
18 changes: 9 additions & 9 deletions core/vm/zk_counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,9 +764,9 @@ func (cc *CounterCollector) decodeChangeL2BlockTx() {
}

func (cc *CounterCollector) ecAdd() {
cc.Deduct(S, 323)
cc.Deduct(B, 33)
cc.Deduct(A, 40)
cc.Deduct(S, 800)
cc.Deduct(B, 50)
cc.Deduct(A, 50)
}

func (cc *CounterCollector) preECMul() {
Expand All @@ -779,9 +779,9 @@ func (cc *CounterCollector) preECMul() {
}

func (cc *CounterCollector) ecMul() {
cc.Deduct(S, 162890)
cc.Deduct(B, 16395)
cc.Deduct(A, 19161)
cc.Deduct(S, 175000)
cc.Deduct(B, 20000)
cc.Deduct(A, 20000)
}

func (cc *CounterCollector) preECPairing(inputsCount int) {
Expand All @@ -795,9 +795,9 @@ func (cc *CounterCollector) preECPairing(inputsCount int) {
}

func (cc *CounterCollector) ecPairing(inputsCount int) {
cc.Deduct(S, 16+inputsCount*184017+171253)
cc.Deduct(B, inputsCount*3986+650)
cc.Deduct(A, inputsCount*13694+15411)
cc.Deduct(S, 16+inputsCount*200000+175000)
cc.Deduct(B, inputsCount*4100+750)
cc.Deduct(A, inputsCount*15000+17500)
}

func (cc *CounterCollector) preModExp(callDataLength, returnDataLength, bLen, mLen, eLen int, base, exponent, modulus *big.Int) {
Expand Down
120 changes: 60 additions & 60 deletions zk/tests/testdata/geth-ecmul.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
"newStateRoot": "0x19275c111a31bc53f0a46468b0bf82bd111dcca67ee933282c300ffdd4c827bd",
"newBatchAccInputHash": "0x60accc3c72a5a592c5a944e24a65e401962fee136f18633b9e962b4805282f0b",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -341,9 +341,9 @@
"newStateRoot": "0x7eb4bf447a41e7e58ae64d889a6de29ea5dd57d1bba255a4a3687c2ebedea216",
"newBatchAccInputHash": "0x75679d17666ca566c9abfd7f266914d5d608e9ed4d324a174abf647fff555a78",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -517,9 +517,9 @@
"newStateRoot": "0xeb035702d0b2f1b0666d2101a8c4190a69f909a4dad47f9130a4b0fcfcfc6d34",
"newBatchAccInputHash": "0x24d3685d6be67c07a68ccb5af2f5d423bb562630c4ddc9aaad5ac3236fd544d8",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -693,9 +693,9 @@
"newStateRoot": "0x72d36f85e07d0cd9fc75567db9ca40e81410921ea9e16c76172a301ddcb97e0e",
"newBatchAccInputHash": "0xcea11061c18bac08bd0efc720cec0141969806a34895a6078cbdc4fcf17a1fa3",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -869,9 +869,9 @@
"newStateRoot": "0xcfda0a0766179f81ee5cdde1e970615ee6c352fa86ae5c3f0ca201c9ad98ea15",
"newBatchAccInputHash": "0x08804820a1108785df381d2539fbcd3ae0b9c7f7a5f4afc9631a0db9044e1308",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1045,9 +1045,9 @@
"newStateRoot": "0x4bf1b7a9f4dc36551c9af0e12d3cd2b15884ea383cfd6d20bf87175f7be9fb11",
"newBatchAccInputHash": "0x7605f7c0ba88b2ee44f1e9b5244cd2e4ac315b2adcf4ea7fa47bdb84da50058d",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1221,9 +1221,9 @@
"newStateRoot": "0xec812a35dc3eae58733f43913924bac38f1d41bce187bbf6bf9eb1710c3a5a89",
"newBatchAccInputHash": "0xece597accb62dbd0e2cec24c3d29023e3bd646cdab95bd9173c4b02001b21705",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1397,9 +1397,9 @@
"newStateRoot": "0x4f7ebd78085f0544ba41fde7167d22a01c76fdff44dd92dc3b6a0f71d5b5bc97",
"newBatchAccInputHash": "0xf715916ed5e8fe4167933a0893e2fff4fed47e429aca4ca637a8a13082a39598",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1573,9 +1573,9 @@
"newStateRoot": "0xc1c5eeedbca6ce7758e6a4afab23e8b008e58a57671d5b25041e3bea780d0c27",
"newBatchAccInputHash": "0x36dd195c5b543b0485f3a5c1e64054ce8484273255c9fd6ed3cc5237299e2fcd",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1749,9 +1749,9 @@
"newStateRoot": "0x3acd19a9cbab6f27f23adbc4cb34feb0b08cf22bfbe1ef9fa3cf97868c4b826d",
"newBatchAccInputHash": "0x3c4f0b506be46c76b65c8549454c240db519b77dd9a186afeff33edec7f786e3",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -1925,9 +1925,9 @@
"newStateRoot": "0x56b04b47f151a7b01880b88a03eefadd5562d6d800b58915e86c92e080894101",
"newBatchAccInputHash": "0x84dbf28820faf2cfeefc75b0ce625cbc412967d6347203ad374118e4945200aa",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2101,9 +2101,9 @@
"newStateRoot": "0x099ac25ab395105db567b5442b2a23ce53ce0e22decb88b5f5c1bba5c8816d6d",
"newBatchAccInputHash": "0xad436c99b82c476061884aa379eb10692e66faa4487a60797d582ccc5256e5ab",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2277,9 +2277,9 @@
"newStateRoot": "0x5fffb9f377c61ab2f8c1497a25823b7ee862b4e9b33cadb02959603bf9f29b5a",
"newBatchAccInputHash": "0x9a307b322eaa819f9592647f7ad3a3c7059116cbd53fa1faf6ef9a2a31943631",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2453,9 +2453,9 @@
"newStateRoot": "0x4d0e05d3aef1a4a24b9cfc6441612d7eb720dcfa91376d098d755f07b59c24ab",
"newBatchAccInputHash": "0x80739e894bf6a6c653609dbcba5704fac4b586dfbdf9f531fb5a07a9ef3217d8",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2629,9 +2629,9 @@
"newStateRoot": "0x18d66de5837a7f87c8b5211acba446dcddadc039beff8821b34c5846fbcfb9c6",
"newBatchAccInputHash": "0x47f92ebb85fb8cfda9f05bb99d3461e7b70e91829a0c99340309097dfbbee930",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2805,9 +2805,9 @@
"newStateRoot": "0x11ac1a6fa4cfd545452c53afb5cda0ee7460b8a5da98dcf414d9910bfcba77a2",
"newBatchAccInputHash": "0xd4512654fb8603f8b93ee90a5e65e1dc4de888ffd6a81a97c7901df1b8da4cce",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -2981,9 +2981,9 @@
"newStateRoot": "0x49b3ff95ee987dff042df49425fb49ed4555357ed855804f405494b4e6590b9b",
"newBatchAccInputHash": "0x4605af08fbde2988726036f8875561ae90195cdc822f0d1899bac2f797ee987a",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -3157,9 +3157,9 @@
"newStateRoot": "0x8003d17426b22713f38b45b770d7aa2b9585d33e3d660f89f3821fdb94148933",
"newBatchAccInputHash": "0x458ffbb0a296fcb2fafa7b35b53c268281ccf0d0ced9c654b8bca15839bbacc8",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -3331,9 +3331,9 @@
"newStateRoot": "0x0b2b389aaecd03e2b0d13bd60e5177b594bced4b9569056c63245729f9714dbe",
"newBatchAccInputHash": "0xff480d0771914b57e1f822af49449a5e9ce118ebaaa42fef331249dca3f9a69f",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down Expand Up @@ -3507,9 +3507,9 @@
"newStateRoot": "0x97b5fd0b875f2091cfe97ae69c42ccca3f50a15ea43d08db8573250b277779d6",
"newBatchAccInputHash": "0x4d444f626a5da967a18a58c52faec97c38a17edfecd10351282528b33f2f86a9",
"virtualCounters": {
"steps": 296341,
"arith": 20887,
"binary": 21564,
"steps": 308451,
"arith": 21726,
"binary": 25169,
"memAlign": 127,
"keccaks": 11,
"padding": 41,
Expand Down

0 comments on commit ff1e7d0

Please sign in to comment.