-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(vm): Allow caching signature verification #3505
base: main
Are you sure you want to change the base?
Conversation
baa4632
to
dc959de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR doesn't include the ability to disable signature verification in the state keeper (and maybe other places, e.g., in subsequent gas estimation / tx submission VM runs). I'd prefer for it to be implemented in a separate PR.
Locally (on an M2 Max Macbook), disabling signature verification improves performance ~2x on simple transactions, like base / ERC-20 token transfers:
fill_bootloader/transfer/1000
time: [274.78 ms 277.20 ms 281.97 ms]
thrpt: [3.5465 Kelem/s 3.6075 Kelem/s 3.6393 Kelem/s]
fill_bootloader/no_sigs/transfer/1000
time: [138.68 ms 139.63 ms 140.68 ms]
thrpt: [7.1085 Kelem/s 7.1615 Kelem/s 7.2109 Kelem/s]
Curiously, this doesn't translate to the instruction-counting bench; there, disabling signature verification only leads to ~10% instruction count / estimated cycle count improvement.
A potential alternative would be to switch the default AA for "signature-less" execution with one that skips signature verification. The downside is having to keep multiple default AA implementation, and it could have unobvious pitfalls (e.g., IIUC, the default AA bytecode hash must be the same regardless of the implementation, so for the signature-less one, it won't correspond to the actual bytecode).
What ❔
Allows caching signature verification (more precisely,
ecrecover
output for L2 transactions using the default AA) in the fast VM.Why ❔
Signature verification takes ~50% of the execution time for "simple" transactions (e.g., base token and ERC-20 token transfers), so caching it may improve performance.
Checklist
zkstack dev fmt
andzkstack dev lint
.