zkevm-circuits icon indicating copy to clipboard operation
zkevm-circuits copied to clipboard

discussion: how to reconstruct memory for precompiles?

Open lispc opened this issue 3 years ago • 1 comments

Previously we remove memory in geth trace since tracing memory can easily result gigabytes of trace json and even hang geth.

But there is one piece still missing: precompile. We did memory reconstruction for all opcodes but did not handle with precompiles.

I am considering two solutions:

(1) re-compute precompile results locally using crates like https://docs.rs/pallet-evm/latest/pallet_evm/trait.Precompile.html (in fact we already tested with this crate and it works well)

(2) use trace_call rpc to fetch return value of calls(of course including precompile contracts). It may be better for future in case we need some extra information provided by trace_call

any preference?

lispc avatar Nov 29 '22 02:11 lispc

I think @ashWhiteHat started the work on the first pre-compile. He's working on the specs now, but could be nice to also check this.

Important questions:

  • Will we have type conversion issues? (ie. implementing 1000 type conversions between pallet_evm and our repos types).
  • Does the pre-compile memory re-computation process actually return all the things we need? Will we need extra tricks? And if so, it's better to avoid having more depencencies and continue via the trace_call way. Where we're already quite experienced :slightly_smiling_face:

CPerezz avatar Nov 30 '22 14:11 CPerezz