@@ -42,8 +42,8 @@ import {
42
42
} from '../utils' ;
43
43
import { deployZeto } from '../lib/deploy' ;
44
44
45
- const TOTAL_AMOUNT = parseInt ( process . env . TOTAL_ROUNDS || '4 ' ) ;
46
- const TX_CONCURRENCY = parseInt ( process . env . TX_CONCURRENCY || '20 ' ) ;
45
+ const TOTAL_AMOUNT = parseInt ( process . env . TOTAL_ROUNDS || '1000 ' ) ;
46
+ const TX_CONCURRENCY = parseInt ( process . env . TX_CONCURRENCY || '30 ' ) ;
47
47
48
48
describe . skip ( '(Gas cost analysis) Zeto based fungible token with anonymity using nullifiers and encryption with KYC' , function ( ) {
49
49
let deployer : Signer ;
@@ -115,28 +115,6 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
115
115
// console.log(`Deposit costs: ${depositGasCostHistory.join(',')}`);
116
116
// console.log(`Transfer costs: ${transferGasCostHistory.join(',')}`);
117
117
// console.log(`Withdraw costs: ${withdrawGasCostHistory.join(',')}`);
118
-
119
- writeGasCostsToCSV (
120
- `${ reportPrefix } mint_gas_costs.csv` ,
121
- mintGasCostHistory ,
122
- 'Mint Gas Costs'
123
- ) ;
124
- writeGasCostsToCSV (
125
- `${ reportPrefix } deposit_gas_costs.csv` ,
126
- depositGasCostHistory ,
127
- 'Deposit Gas Costs'
128
- ) ;
129
- writeGasCostsToCSV (
130
- `${ reportPrefix } transfer_gas_costs.csv` ,
131
- transferGasCostHistory ,
132
- 'Transfer Gas Costs'
133
- ) ;
134
-
135
- writeGasCostsToCSV (
136
- `${ reportPrefix } withdraw_gas_costs.csv` ,
137
- withdrawGasCostHistory ,
138
- 'Withdraw Gas Costs'
139
- ) ;
140
118
} ) ;
141
119
142
120
describe ( `Transfer ${ TOTAL_AMOUNT } tokens (half from deposit, half from mint) from single address to another` , function ( ) {
@@ -205,6 +183,10 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
205
183
if ( promises . length > 0 ) {
206
184
await Promise . all ( promises ) ;
207
185
}
186
+ writeGasCostsToCSV (
187
+ `${ reportPrefix } deposit_gas_costs.csv` ,
188
+ depositGasCostHistory
189
+ ) ;
208
190
} ) . timeout ( 6000000000000 ) ;
209
191
210
192
it ( `Zeto mint ${ atMostHalfAmount + ( TOTAL_AMOUNT % 2 ) } token to Alice in ${
@@ -255,6 +237,10 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
255
237
if ( promises . length > 0 ) {
256
238
await Promise . all ( promises ) ;
257
239
}
240
+ writeGasCostsToCSV (
241
+ `${ reportPrefix } mint_gas_costs.csv` ,
242
+ mintGasCostHistory
243
+ ) ;
258
244
} ) . timeout ( 6000000000000 ) ;
259
245
260
246
it ( `Alice transfer ${ TOTAL_AMOUNT } tokens to Bob in ${ atLeastHalfAmount } txs` , async function ( ) {
@@ -338,6 +324,10 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
338
324
if ( promises . length > 0 ) {
339
325
await Promise . all ( promises ) ;
340
326
}
327
+ writeGasCostsToCSV (
328
+ `${ reportPrefix } transfer_gas_costs.csv` ,
329
+ transferGasCostHistory
330
+ ) ;
341
331
} ) . timeout ( 6000000000000 ) ;
342
332
343
333
it ( `Bob withdraw ${ TOTAL_AMOUNT } tokens` , async function ( ) {
@@ -382,6 +372,10 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
382
372
) ;
383
373
}
384
374
}
375
+ writeGasCostsToCSV (
376
+ `${ reportPrefix } withdraw_gas_costs.csv` ,
377
+ withdrawGasCostHistory
378
+ ) ;
385
379
// Bob checks ERC20 balance
386
380
const endingBalance = await erc20 . balanceOf ( Bob . ethAddress ) ;
387
381
expect ( endingBalance - startingBalance ) . to . be . equal ( TOTAL_AMOUNT ) ;
@@ -551,19 +545,14 @@ describe.skip('(Gas cost analysis) Zeto based fungible token with anonymity usin
551
545
}
552
546
} ) ;
553
547
554
- function writeGasCostsToCSV (
555
- filename : string ,
556
- gasCosts : number [ ] ,
557
- header : string
558
- ) {
548
+ function writeGasCostsToCSV ( filename : string , gasCosts : number [ ] ) {
559
549
const filePath = path . join ( __dirname , filename ) ;
560
550
561
551
// Prepare the CSV content
562
- const csvHeader = `${ header } \n` ;
563
552
const csvData = gasCosts . join ( ',\n' ) + '\n' ; // Each value in a new line
564
553
565
554
// Write the CSV content to a file (overwrite if file exists)
566
- fs . writeFileSync ( filePath , csvHeader + csvData , 'utf8' ) ;
555
+ fs . writeFileSync ( filePath , 'gas_costs,\n' + csvData , 'utf8' ) ;
567
556
568
557
console . log ( `Gas costs written to ${ filePath } ` ) ;
569
558
}
0 commit comments