DistributedCollective / oracle-based-amm

Other
11 stars 5 forks source link

Added python script to count zkSync opcodes on repo #45

Open computerphysicslab opened 3 years ago

computerphysicslab commented 3 years ago

Script to create report on bytecodes not supported by zkSync

https://github.com/DistributedCollective/Sovryn-smart-contracts/issues/285

Requires hardhat compilation of every contract.

Script results:

SOVRYN TOTAL FREQUENCIES: EXP: 242 ADDMOD: 4 SMOD: 12 MULMOD: 3 CREATE2: 10 SELFDESTRUCT: 6

AMM TOTAL FREQUENCIES: EXP: 3716 ADDMOD: 3 SMOD: 7 MULMOD: 7 CREATE2: 1 SELFDESTRUCT: 4

In-detail results => https://docs.google.com/spreadsheets/d/1SPeqBk7vRxKlSlvDqKycSRsxFjEGRUj9O-XMr-YMG_8/edit?usp=sharing

As an enhancement it has been researched to use sourcemap to get locations of the opcodes in the contract solidity files, but a big blocker (or a misunderstanding from my part) has been found: To a simple contract example having 100 opcodes is corresponding a sourcemap w/ only 20 semicolons, meaning 21 entries. So the number of codes and map entries differ by much. So it is useless to follow this route in order to trace opcodes to the source with code line accuracy.