Skip to content

Latest commit

 

History

History
403 lines (374 loc) · 13.4 KB

gas_consumption.md

File metadata and controls

403 lines (374 loc) · 13.4 KB

Gas Consumption

Disclaimer: The following values are approximate because contract calls were needed to print the values.

Verifier

Test case Gas used
new_verifier_succeeds 24308849

ecAdd

The test cases are a subset of Ethereum’s General State Tests

Test case Gas used
ecadd_0_0_0_0_21000_128 50540
ecadd_0_0_0_0_25000_0 50522
ecadd_0_0_0_0_21000_64 50540
ecadd_0_0_0_0_21000_0 50522
ecadd_0_0_0_0_21000_80 50540
ecadd_0_0_0_0_25000_128 50540
ecadd_0_0_0_0_21000_192 50540
ecadd_0_0_0_0_25000_192 50540
ecadd_0_0_0_0_25000_64 50540
ecadd_0_0_0_0_25000_80 50540
ecadd_0_0_1_2_21000_192 50930
ecadd_0_0_1_2_25000_128 50930
ecadd_0_0_1_2_21000_128 50930
ecadd_0_0_1_2_25000_192 50930
ecadd_1145_3932_1145_4651_21000_192 51050
ecadd_1145_3932_1145_4651_25000_192 51050
ecadd_1145_3932_2969_1336_25000_128 84458
ecadd_1_2_0_0_25000_128 50978
ecadd_1_2_0_0_21000_192 50978
ecadd_1145_3932_2969_1336_21000_128 84458
ecadd_1_2_0_0_21000_64 50978
ecadd_1_2_0_0_21000_128 50978
ecadd_1_2_0_0_25000_192 50978
ecadd_1_2_0_0_25000_64 50978
ecadd_1_2_1_2_21000_128 87260
ecadd_1_2_1_2_21000_192 87260
ecadd_1_2_1_2_25000_192 87260
ecadd_1_2_1_2_25000_128 87260

ecMul

The test cases are a subset of Ethereum’s General State Tests

Test case Gas used
ecmul_0_0_0_21000_96 51013
ecmul_0_0_0_21000_0 50995
ecmul_0_0_0_28000_0 50995
ecmul_0_0_0_21000_40 51013
ecmul_0_0_0_21000_128 51013
ecmul_0_0_0_21000_80 51013
ecmul_0_0_0_28000_40 51013
ecmul_0_0_0_28000_80 51013
ecmul_0_0_0_28000_96 51013
ecmul_0_0_0_28000_128 51013
ecmul_0_0_0_21000_64 51013
ecmul_0_0_1_21000_128 51013
ecmul_0_0_0_28000_64 51013
ecmul_0_0_1_21000_96 51013
ecmul_0_0_1_28000_128 51013
ecmul_0_0_1_28000_96 51013
ecmul_0_0_2_21000_128 51013
ecmul_0_0_2_21000_96 51013
ecmul_0_0_2_28000_128 51013
ecmul_0_0_2_28000_96 51013
ecmul_0_0_340282366920938463463374607431768211456_21000_128 51013
ecmul_0_0_340282366920938463463374607431768211456_21000_80 51013
ecmul_0_0_340282366920938463463374607431768211456_21000_96 51013
ecmul_0_0_340282366920938463463374607431768211456_28000_80 51013
ecmul_0_0_340282366920938463463374607431768211456_28000_128 51013
ecmul_0_0_340282366920938463463374607431768211456_28000_96 51013
ecmul_0_0_5616_21000_128 51013
ecmul_0_0_5616_21000_96 51013
ecmul_0_0_5616_28000_128 51013
ecmul_0_0_5616_28000_96 51013
ecmul_0_0_5617_21000_128 51013
ecmul_0_0_5617_21000_96 51013
ecmul_0_0_5617_28000_128 51013
ecmul_0_0_5617_28000_96 51013
ecmul_0_0_9935_21000_128 51013
ecmul_0_0_9935_21000_96 51013
ecmul_0_0_9935_28000_128 51013
ecmul_0_0_9_21000_128 51013
ecmul_0_0_9_21000_96 51013
ecmul_0_0_9_28000_128 51013
ecmul_0_0_9_28000_96 51013
ecmul_0_0_9935_28000_96 51013
ecmul_1_2_0_21000_128 51379
ecmul_1_2_0_21000_64 51379
ecmul_1_2_0_21000_80 51379
ecmul_1_2_0_21000_96 51379
ecmul_1_2_0_28000_128 51379
ecmul_1_2_0_28000_64 51379
ecmul_1_2_0_28000_96 51379
ecmul_1_2_1_21000_128 51391
ecmul_1_2_0_28000_80 51379
ecmul_1_2_1_21000_96 51391
ecmul_1_2_1_28000_128 51391
ecmul_1_2_1_28000_96 51391
ecmul_1_2_2_21000_128 87667
ecmul_1_2_2_28000_128 87667
ecmul_1_2_2_21000_96 87667
ecmul_1_2_2_28000_96 87667
ecmul_1_2_340282366920938463463374607431768211456_21000_128 191065
ecmul_1_2_340282366920938463463374607431768211456_21000_96 191065
ecmul_1_2_340282366920938463463374607431768211456_21000_80 191065
ecmul_1_2_340282366920938463463374607431768211456_28000_128 191065
ecmul_1_2_340282366920938463463374607431768211456_28000_80 191065
ecmul_1_2_5616_21000_128 404029
ecmul_1_2_340282366920938463463374607431768211456_28000_96 191065
ecmul_1_2_5616_21000_96 404029
ecmul_1_2_5616_28000_128 404029
ecmul_1_2_5617_21000_128 371839
ecmul_1_2_5617_21000_96 371839
ecmul_1_2_5617_28000_128 371839
ecmul_1_2_9935_21000_128 576133
ecmul_1_2_616_28000_96 404029
ecmul_1_2_9935_21000_96 576133
ecmul_1_2_9935_28000_128 576133
ecmul_1_2_5617_28000_96 371839
ecmul_1_2_9935_28000_96 576133
ecmul_1_2_9_21000_128 89005
ecmul_1_2_9_21000_96 89005
ecmul_1_2_9_28000_128 89005
ecmul_1_2_9_28000_96 89005
ecmul_7827_6598_0_21000_128 51379
ecmul_7827_6598_0_28000_96 51379
ecmul_7827_6598_0_21000_64 51379
ecmul_7827_6598_0_21000_80 51379
ecmul_7827_6598_0_21000_96 51379
ecmul_7827_6598_0_28000_128 51379
ecmul_7827_6598_0_28000_64 51379
ecmul_7827_6598_0_28000_80 51379
ecmul_7827_6598_1456_21000_128 190975
ecmul_7827_6598_1_21000_128 51391
ecmul_7827_6598_1456_21000_80 190975
ecmul_7827_6598_1456_21000_96 190975
ecmul_7827_6598_1456_28000_128 190975
ecmul_7827_6598_1456_28000_80 190975
ecmul_7827_6598_1456_28000_96 190975
ecmul_7827_6598_1_21000_96 51391
ecmul_7827_6598_1_28000_128 51391
ecmul_7827_6598_1_28000_96 51391
ecmul_7827_6598_2_21000_96 84751
ecmul_7827_6598_2_28000_96 84751
ecmul_7827_6598_5616_21000_128 403195
ecmul_7827_6598_2_21000_128 84751
ecmul_7827_6598_2_28000_128 84751
ecmul_7827_6598_5616_21000_96 403195
ecmul_7827_6598_5616_28000_128 403195
ecmul_7827_6598_5617_21000_128 371839
ecmul_7827_6598_5616_28000_96 403195
ecmul_7827_6598_5617_28000_128 371839
ecmul_7827_6598_5617_21000_96 371839
ecmul_7827_6598_9935_21000_128 577303
ecmul_7827_6598_5617_28000_96 371839
ecmul_7827_6598_9935_21000_96 577303
ecmul_7827_6598_9_21000_128 89431
ecmul_7827_6598_9_21000_96 89431
ecmul_7827_6598_9_28000_128 89431
ecmul_7827_6598_9935_28000_128 577303
ecmul_7827_6598_9935_28000_96 577303
ecmul_7827_6598_9_28000_96 89431
💡 *The second version of the optimization includes the usage of projective coordinates 💡 *The third version of the optimization includes the usage of wGLV multiplication (This is not a final version and is included in a development branch)

ecPairing

The test cases are a subset of Ethereum’s General State Tests

Test case Gas used
ecpairing_one_point_insufficient_gas 4911393
ecpairing_empty_data_insufficient_gas 102099
ecpairing_empty_data 102099
ecpairing_one_point_fail 4911393
ecpairing_one_point_with_g1_zero 1209280
ecpairing_one_point_with_g2_zero 103060
ecpairing_three_point_match_1 9719650
ecpairing_two_point_fail_2 9719859
ecpairing_three_point_fail_1 14527983
ecpairing_two_point_fail_1 9720543
ecpairing_two_points_with_one_g2_zero 4912120
ecpairing_two_point_match_1 9720633
ecpairing_two_point_match_2 9720633
ecpairing_two_point_match_5 1210007
ecpairing_two_point_oog 9720633
ecpairing_two_point_match_3 9719235
ecpairing_two_point_match_4 9718923

modexp

🏗️

The test cases are a subset of Ethereum’s General State Tests

The L1 gas cost is calculated using the function provided in the EIP-198.

Test case Gas used
modexp_one_limb_1_0_1 40899
modexp_one_limb_1_1_1 40899
modexp_one_limb_0_1_0 40887
modexp_one_limb_0_0_0 40887
modexp_one_limb_0_1_1 40887
modexp_one_limb_0_0_1 40887
modexp_one_limb_1_1_0 40899
modexp_one_limb_2_2_1 40899
modexp_one_limb_1_0_0 40899
modexp_one_limb_1_2_1 40899
modexp_one_limb_2_2_2 41349
modexp_15 40539
modexp_11 41274
modexp_12 40988
modexp_13 41175
modexp_0 57941725
modexp_19 41049
modexp_10 41369
modexp_14 41189
modexp_1 41071
modexp_16 548484
modexp_17 548423
modexp_18 41049
modexp_20 41049
modexp_22 41049
modexp_23 41049
modexp_21 41049
modexp_24 40976
modexp_25 1147353
modexp_30 40316
modexp_26 41274
modexp_27 3778734
modexp_28 40466
modexp_29 40316
modexp_3 2163576
modexp_31 19308920
modexp_33 5831940
modexp_32 10358168
modexp_34 10418506
modexp_36 40466
modexp_35 31935164
modexp_4 2163576
modexp_9 40539
modexp_5 40999
modexp_6 41176
modexp_7 41261
modexp_8 40999
modexp_edge_cases_1 40298
modexp_edge_cases_2 43084
modexp_edge_cases_3 43011
modexp_edge_cases_5 3703288
modexp_random_input_0 40539
modexp_edge_cases_4 40988
modexp_random_input_1 40539
modexp_tests_1 40915
modexp_tests_0 40316
modexp_tests_10 85323
modexp_tests_101 40466
modexp_tests_103 40976
modexp_tests_102 40915
modexp_tests_104 40466
modexp_tests_106 40976
modexp_tests_110 40466
modexp_tests_107 40466
modexp_tests_109 40976
modexp_tests_105 40915
modexp_tests_108 40915
modexp_tests_117 457575
modexp_tests_111 40915
modexp_tests_112 40976
modexp_tests_115 169497
modexp_tests_116 457575
modexp_tests_114 489275
modexp_tests_113 41891
modexp_tests_11 11868424
modexp_tests_118 66190
modexp_tests_120 40466
modexp_tests_122 457575
modexp_tests_121 40915
modexp_tests_119 287183
modexp_tests_124 41830
modexp_tests_123 41830
modexp_tests_126 523638
modexp_tests_17 40316
modexp_tests_125 661840
modexp_tests_19 40976
modexp_tests_23 40926
modexp_tests_20 40976
modexp_tests_24 41229
modexp_tests_18 40915
modexp_tests_2 40976
modexp_tests_21 40976
modexp_tests_22 40976
modexp_tests_25 41891
modexp_tests_26 41823
modexp_tests_27 85323
modexp_tests_34 40316
modexp_tests_3 40976
modexp_tests_38 40976
modexp_tests_36 40976
modexp_tests_39 40976
modexp_tests_35 40915
modexp_tests_37 40976
modexp_tests_28 11868424
modexp_tests_4 40976
modexp_tests_40 40976
modexp_tests_41 40926
modexp_tests_46 11868424
modexp_tests_42 41229
modexp_tests_43 41891
modexp_tests_44 41823
modexp_tests_45 85323
modexp_tests_5 40976
modexp_tests_54 40976
modexp_tests_52 40976
modexp_tests_53 40976
modexp_tests_56 40926
modexp_tests_59 41823
modexp_tests_58 41891
modexp_tests_57 41229
modexp_tests_6 40926
modexp_tests_60 85323
modexp_tests_67 40466
modexp_tests_68 40915
modexp_tests_69 40976
modexp_tests_61 11868424
modexp_tests_7 41229
modexp_tests_74 41229
modexp_tests_73 40926
modexp_tests_71 40976
modexp_tests_72 40976
modexp_tests_70 40976
modexp_tests_77 85323
modexp_tests_76 41823
modexp_tests_75 41891
modexp_tests_84 40466
modexp_tests_8 41891
modexp_tests_85 40915
modexp_tests_78 11868424
modexp_tests_86 40976
modexp_tests_9 41823
modexp_tests_89 40976
modexp_tests_90 40926
modexp_tests_87 40976
modexp_tests_88 40976
modexp_tests_92 41891
modexp_tests_93 41823
modexp_tests_91 41229
modexp_tests_94 85323
modexp_tests_95 11868424

P256VERIFY

Test case Gas used
p256verify_hash_edge_case_valid_2 1469526
p256verify_hash_edge_case_valid_6 1490682
p256verify_hash_edge_case_valid_5 138246
p256verify_hash_edge_case_valid_3 138246
p256verify_hash_edge_case_valid_4 1481322
p256verify_hash_edge_case_valid_1 1455942
p256verify_invalid_signature_one 1416222
p256verify_invalid_signature_two 833472
p256verify_valid_signature_one 1426986
p256verify_valid_signature_two 1423428
p256verify_invalid_r all
p256verify_invalid_s all
p256verify_public_key_inf all
p256verify_public_key_x_not_in_field all
p256verify_public_key_y_not_in_field all
p256verify_public_key_not_in_curve all

secp256k1VERIFY

Test case Gas used
secp256k1verify_valid_signature_one 1412080
secp256k1verify_invalid_signature 1431718
secp256k1verify_valid_signature_two 1432858
secp256k1verify_invalid_r all
secp256k1verify_invalid_s all
secp256k1verify_public_key_inf all
secp256k1verify_public_key_x_not_in_field all
secp256k1verify_public_key_y_not_in_field all
secp256k1verify_public_key_not_in_curve all