Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optimization flag #176

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions .ipynb_checkpoints/test_results-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 41,
"id": "2e8df45a-6df7-40c6-9daf-481e83094e56",
"metadata": {},
"outputs": [],
"source": [
"from matplotlib import pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import glob"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "7a26728e-ea2e-488f-849d-81d47a7b338a",
"metadata": {},
"outputs": [],
"source": [
"files = glob.glob('./tests/*/*.csv')\n",
"combined_df = pd.DataFrame()"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "26550992-86e6-4e06-9eac-2f13cac64ea8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['./tests/gas_reports_2/modexp_report.csv',\n",
" './tests/gas_reports_2/ecadd_report.csv',\n",
" './tests/gas_reports_2/secp256k1verify_report.csv',\n",
" './tests/gas_reports_2/ecpairing_report.csv',\n",
" './tests/gas_reports_2/p256verify_report.csv',\n",
" './tests/gas_reports_2/ecmul_report.csv',\n",
" './tests/gas_reports_3/modexp_report.csv',\n",
" './tests/gas_reports_3/ecadd_report.csv',\n",
" './tests/gas_reports_3/secp256k1verify_report.csv',\n",
" './tests/gas_reports_3/ecpairing_report.csv',\n",
" './tests/gas_reports_3/p256verify_report.csv',\n",
" './tests/gas_reports_3/ecmul_report.csv']"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"files"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "bc1f5c52-4184-46ed-a8a7-95612976c1eb",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'test_case'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/var/folders/qq/tjw4v_0515s8j5vpc05g5hk80000gn/T/ipykernel_16452/1116867137.py\u001b[0m in \u001b[0;36m?\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mfile\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mfiles\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfile\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mskipinitialspace\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'test'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'gas'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mcombined_df\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmerge\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcombined_df\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mon\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'test_case'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'outer'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/pandas/core/reshape/merge.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate)\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0mvalidate\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvalidate\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 166\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 167\u001b[0m )\n\u001b[1;32m 168\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 169\u001b[0;31m op = _MergeOperation(\n\u001b[0m\u001b[1;32m 170\u001b[0m \u001b[0mleft_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 171\u001b[0m \u001b[0mright_df\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 172\u001b[0m \u001b[0mhow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhow\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/pandas/core/reshape/merge.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(self, left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, indicator, validate)\u001b[0m\n\u001b[1;32m 787\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mright_join_keys\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 788\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin_names\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 789\u001b[0m \u001b[0mleft_drop\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 790\u001b[0m \u001b[0mright_drop\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 791\u001b[0;31m ) = self._get_merge_keys()\n\u001b[0m\u001b[1;32m 792\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 793\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mleft_drop\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 794\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mleft\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mleft\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_drop_labels_or_levels\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mleft_drop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/pandas/core/reshape/merge.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1265\u001b[0m \u001b[0;31m# Then we're either Hashable or a wrong-length arraylike,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1266\u001b[0m \u001b[0;31m# the latter of which will raise\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1267\u001b[0m \u001b[0mrk\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mHashable\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1268\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrk\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1269\u001b[0;31m \u001b[0mright_keys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mright\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_label_or_level_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1270\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1271\u001b[0m \u001b[0;31m# work-around for merge_asof(right_index=True)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1272\u001b[0m \u001b[0mright_keys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mright\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_values\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m?\u001b[0;34m(self, key, axis)\u001b[0m\n\u001b[1;32m 1840\u001b[0m \u001b[0mvalues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mother_axes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_values\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1841\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_is_level_reference\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1842\u001b[0m \u001b[0mvalues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_level_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_values\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1843\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1844\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1845\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1846\u001b[0m \u001b[0;31m# Check for duplicates\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1847\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyError\u001b[0m: 'test_case'"
]
}
],
"source": [
"for file in files:\n",
" df = pd.read_csv(file, skipinitialspace=True)\n",
" df.columns = ['test', 'gas']\n",
" combined_df = pd.merge(combined_df, df, on='test', how='outer')"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "99b29636-d67b-4210-b96c-00c831c40959",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>test</th>\n",
" <th>gas</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>ecmul_0_0_0_21000_96</td>\n",
" <td>54546</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ecmul_0_0_0_21000_64</td>\n",
" <td>54546</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>ecmul_0_0_0_21000_0</td>\n",
" <td>54528</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>ecmul_0_0_0_21000_40</td>\n",
" <td>54546</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ecmul_0_0_0_21000_128</td>\n",
" <td>54546</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>113</th>\n",
" <td>ecmul_7827_6598_9935_28000_128</td>\n",
" <td>754734</td>\n",
" </tr>\n",
" <tr>\n",
" <th>114</th>\n",
" <td>ecmul_7827_6598_9_21000_128</td>\n",
" <td>96822</td>\n",
" </tr>\n",
" <tr>\n",
" <th>115</th>\n",
" <td>ecmul_7827_6598_9_21000_96</td>\n",
" <td>96822</td>\n",
" </tr>\n",
" <tr>\n",
" <th>116</th>\n",
" <td>ecmul_7827_6598_9_28000_128</td>\n",
" <td>96822</td>\n",
" </tr>\n",
" <tr>\n",
" <th>117</th>\n",
" <td>ecmul_7827_6598_9_28000_96</td>\n",
" <td>96822</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>118 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" test gas\n",
"0 ecmul_0_0_0_21000_96 54546\n",
"1 ecmul_0_0_0_21000_64 54546\n",
"2 ecmul_0_0_0_21000_0 54528\n",
"3 ecmul_0_0_0_21000_40 54546\n",
"4 ecmul_0_0_0_21000_128 54546\n",
".. ... ...\n",
"113 ecmul_7827_6598_9935_28000_128 754734\n",
"114 ecmul_7827_6598_9_21000_128 96822\n",
"115 ecmul_7827_6598_9_21000_96 96822\n",
"116 ecmul_7827_6598_9_28000_128 96822\n",
"117 ecmul_7827_6598_9_28000_96 96822\n",
"\n",
"[118 rows x 2 columns]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e363a524-74cc-4721-a2f4-4fd161388cf3",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
OPT ?= 3

.PHONY: setup update run test docs

setup:
Expand All @@ -15,10 +17,11 @@ copy-precompiles:

.PHONY: build-precompiles
build-precompiles: copy-precompiles
sed -i '' -e 's/--optimization [123sz]/--optimization ${OPT}/' submodules/era-test-node/etc/system-contracts/scripts/compile-yul.ts
cd submodules/era-test-node && make build-precompiles

run: build-precompiles
cd submodules/era-test-node && cargo run -- --show-calls=all --resolve-hashes run
cd submodules/era-test-node && cargo +nightly run -- --show-calls=all --resolve-hashes run

test:
cd tests && \
Expand Down
38 changes: 38 additions & 0 deletions gas_reports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3

import subprocess
import requests
import time

def main():
optimization = ["z"]

headers = {
# Already added when you pass json=
# 'content-type': 'application/json',
}

json_data = {
'jsonrpc': '2.0',
'id': 1,
'method': 'zks_L1BatchNumber',
'params': [],
}

for opt in optimization:
popen = subprocess.Popen(["make", "run", f"OPT={opt}"])
while True:
try:
response = requests.post('http://localhost:8011', headers=headers, json=json_data)
if response.status_code == 200:
break
time.sleep(5)
except:
time.sleep(5)
subprocess.run(["make", "test"])
subprocess.run(["mv", "./tests/gas_reports", f"./tests/gas_reports_{opt}"])

popen.kill()

if __name__ == '__main__':
main()
22 changes: 22 additions & 0 deletions scripts/verify_playground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
t0 = "17e2abeac82f76497d4db6d47356d29014f743e7185cd518ed3680ab0c98855f"
t1 = "f43d8c4297bbbd84ad63da6edfa2bebc1fd103f32881337f3bbd16b9b3b9875a"

t0 = "000" + bin(int(t0, 16))[2:]
t1 = bin(int(t1, 16))[2:]

print(len(t0))
print(len(t1))

print(t0)
print(t1)

for i in range(len(t0)):
print((int(t0[i]) * 2) + int(t1[i]))


21:34:25 [INFO] d466d1ccec6839e2255966b7cbe9f7163c31fdfd39c74252489115c4815256ff
21:34:25 [INFO] a90158693a6dd13f31b3c5a45d7aadc393da920bfbc7b964bd2bc952fb239729
21:34:25 [INFO] 35d402a40b6af63efda9830b825ceb1863cadbcd996e7d55020a874a5441f58b
21:34:25 [INFO] d466d1ccec6839e2255966b7cbe9f7163c31fdfd39c74252489115c4815256ff
21:34:25 [INFO] a90158693a6dd13f31b3c5a45d7aadc393da920bfbc7b964bd2bc952fb239729
21:34:25 [INFO] 35d402a40b6af63efda9830b825ceb1863cadbcd996e7d55020a874a5441f58b
2 changes: 1 addition & 1 deletion submodules/era-test-node
Submodule era-test-node updated 62 files
+5 −11 .github/workflows/checks.yaml
+13 −1 .github/workflows/docs.yaml
+16 −16 .github/workflows/release.yml
+6 −8 .github/workflows/tests.yaml
+1 −1 .vscode/launch.json
+978 −693 Cargo.lock
+14 −13 Cargo.toml
+5 −1 Makefile
+10 −0 README.md
+355 −10 SUPPORTED_APIS.md
+1 −0 docs/rustbook/.gitignore
+6 −0 docs/rustbook/book.toml
+22 −0 docs/rustbook/src/SUMMARY.md
+15 −0 docs/rustbook/src/installation.md
+10 −0 docs/rustbook/src/introduction.md
+5 −0 docs/rustbook/src/misc/contributors.md
+50 −0 docs/rustbook/src/usage/README.md
+33 −0 docs/rustbook/src/usage/basic.md
+1 −0 docs/rustbook/src/usage/bootloader.md
+24 −0 docs/rustbook/src/usage/deploy-contracts.md
+83 −0 docs/rustbook/src/usage/fork.md
+76 −0 docs/rustbook/src/usage/remote-tx.md
+145 −0 docs/rustbook/src/usage/testing.md
+2 −1 e2e-tests/.eslintrc.js
+ e2e-tests/.yarn/install-state.gz
+1 −0 e2e-tests/.yarnrc.yml
+33 −0 e2e-tests/contracts/ERC20.sol
+129 −0 e2e-tests/contracts/ERC20FixedPaymaster.sol
+33 −0 e2e-tests/contracts/ERC721.sol
+96 −0 e2e-tests/contracts/ERC721GatedPaymaster.sol
+8 −1 e2e-tests/contracts/Greeter.sol
+9 −0 e2e-tests/contracts/Return5.sol
+2 −0 e2e-tests/package.json
+93 −1 e2e-tests/test/debug-apis.test.ts
+115 −0 e2e-tests/test/erc20-fixed-paymaster.test.ts
+118 −0 e2e-tests/test/erc721-gated-paymaster.test.ts
+64 −1 e2e-tests/test/hardhat-apis.test.ts
+1 −1 e2e-tests/test/main.test.ts
+122 −2 e2e-tests/test/zks-apis.test.ts
+281 −273 e2e-tests/yarn.lock
+6 −9 src/bootloader_debug.rs
+130 −9 src/cache.rs
+62 −0 src/configuration_api.rs
+1 −1 src/console_log.rs
+285 −63 src/debug.rs
+0 −1 src/deps/system_contracts.rs
+10 −10 src/evm.rs
+4 −4 src/filters.rs
+33 −9 src/fork.rs
+25 −25 src/formatter.rs
+78 −9 src/hardhat.rs
+275 −15 src/http_fork_source.rs
+1 −0 src/lib.rs
+5 −5 src/logging_middleware.rs
+48 −82 src/main.rs
+315 −293 src/node.rs
+126 −0 src/observability.rs
+3 −1 src/system_contracts.rs
+59 −7 src/testing.rs
+79 −8 src/utils.rs
+918 −34 src/zks.rs
+135 −1 test_endpoints.http
932 changes: 932 additions & 0 deletions test_results.ipynb

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions tests/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::fs::OpenOptions;
use std::io::Write;

fn main() {
let directory = "gas_reports";
if !std::path::Path::new(&directory).exists() {
std::fs::create_dir(directory).unwrap();
}

let precompiles_report_list: Vec<String> = vec![
"modexp".to_string(),
"ecadd".to_string(),
"ecmul".to_string(),
"ecpairing".to_string(),
"p256verify".to_string(),
"secp256k1verify".to_string(),
];
precompiles_report_list
.into_iter()
.for_each(|mut precompile_name| {
let file_path = format!("{}/{}_report.csv", directory, precompile_name);
precompile_name.push_str("_report.csv");
let mut file = OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.open(file_path)
.unwrap();

writeln!(file, "test, gas").unwrap();
});
}
1 change: 1 addition & 0 deletions tests/gas_reports/ecadd_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
1 change: 1 addition & 0 deletions tests/gas_reports/ecmul_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
1 change: 1 addition & 0 deletions tests/gas_reports/ecpairing_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
1 change: 1 addition & 0 deletions tests/gas_reports/modexp_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
1 change: 1 addition & 0 deletions tests/gas_reports/p256verify_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
1 change: 1 addition & 0 deletions tests/gas_reports/secp256k1verify_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test, gas
29 changes: 29 additions & 0 deletions tests/gas_reports_2/ecadd_report.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
test, gas
ecadd_0_0_0_0_21000_0,53973
ecadd_0_0_0_0_21000_80,53991
ecadd_0_0_0_0_21000_64,53991
ecadd_0_0_0_0_25000_192,53991
ecadd_0_0_0_0_21000_192,53991
ecadd_0_0_0_0_21000_128,53991
ecadd_0_0_0_0_25000_128,53991
ecadd_0_0_0_0_25000_0,53973
ecadd_0_0_0_0_25000_80,53991
ecadd_0_0_1_2_25000_128,54465
ecadd_0_0_1_2_21000_128,54465
ecadd_0_0_1_2_21000_192,54465
ecadd_0_0_0_0_25000_64,53991
ecadd_0_0_1_2_25000_192,54465
ecadd_1145_3932_2969_1336_21000_128,90285
ecadd_1_2_0_0_21000_192,54507
ecadd_1145_3932_1145_4651_21000_192,54573
ecadd_1_2_0_0_21000_128,54507
ecadd_1145_3932_1145_4651_25000_192,54573
ecadd_1145_3932_2969_1336_25000_128,90285
ecadd_1_2_0_0_25000_128,54507
ecadd_1_2_0_0_25000_192,54507
ecadd_1_2_1_2_21000_192,92469
ecadd_1_2_0_0_21000_64,54507
ecadd_1_2_0_0_25000_64,54507
ecadd_1_2_1_2_25000_192,92469
ecadd_1_2_1_2_21000_128,92469
ecadd_1_2_1_2_25000_128,92469
Loading