hashgraph / hedera-smart-contracts

Contains Hedera Smart Contract Service supporting files
Apache License 2.0
46 stars 54 forks source link

Precompile functions usage report #987

Open natanasow opened 1 month ago

natanasow commented 1 month ago

Problem

We should investigate how many times precompile functions are used in the current mainnet contracts, and how many transactions have interacted with the current contracts.

Solution

Disassemble contracts bytecode to find out calls to the 0x167, fetch the contract results for these contracts, and get the calls generated in the fetched transactions.

First part:

Second part:

Alternatives

No response

natanasow commented 1 month ago

Here is the PoC branch https://github.com/hashgraph/hedera-smart-contracts/tree/precompile-functions-usage-report/tools/analysis/precompile-contract-functions-analyzer

Nana-EC commented 1 week ago

@natanasow this was a great effort. What's the next steps. I would suggest

  1. Paste the README result into this ticket for reference even if that branch gets deleted
  2. Open a PR for any changes to existing tools you had to make
  3. Open tickets capturing any features not supported that you had to hack together so that in future we don't have to hack anything together and we can just rerun checked in steps