EPF update 3

TLDR

  1. I reviewed @Vid documents about rust implementation on aa-bundler and put some comments.
  2. Reviewed EIP-4337 deep again with Vid docs.
  3. start to review the nethermind IL-evm pr
  4. Trying to understand EVM opcodes and MSIL opcodes and build relations.

Plan Next Week:

  1. Figure out pattern compile EVM-opcodes to IL-opcodes
  2. Wrote the benchmark for current IL-Evm
  3. Discuss with @Vid on my coding task in AA-bundler

Details

Details for IL-EVM

This week, I start to get myself totally into the IL-EVM pr. I got a good prgress on the c# and dotnet because Microsoft keeps a very good document. I can find almost everything I don't know in their documents.

However on the contrary, MSIL is a giant beast I need to fight with.

I read some basic doc from microsoft. The doc contains an example how to use IL-generator to define a type and the method of the type. The example seems easy to understand. I tried to tweak around the example. It worked fine.

Then I went back to the IL-EVM pr. Currently the most important thing I need to know is

  1. How does EVM in nethermind work right now?
  2. How is IL-EVM going to fit in nethermind original EVM codes?
  3. How to compile evm op-codes to MSIL-op-codes?

1. How does evm in nethermind work right now?

  1. TransactionProcessor.cs::Execute is the main entrypoint of transaction execution. The processor would do a lot of sanity check(like Eip-1559 check, account check, balance check and etc).
  2. And it would get the EVM bytescode in CodeInfo initialize(This is an important step which is the injection of MSIL compilation).
  3. Then EVM would execute the bytescode against the EVM state.
  4. EVM execute the bytescode
  5. return exception(outOfGas and etc.) or success at the end

2. How is IL-EVM going to fit in nethermind original EVM codes?

It looks like the VirtualMachine.cs made a lot of changes in the IL-EVM pr. But actually, most of the codes are just reformatting the codes.

The key codes are just two places.

  1. Adding a new BuildILForNext flag and the EVM would compile EVN opcodes into IL opcodes when it is true.
  2. Execute IL-op codes when the CodeInfo.Data is ILDelegate.

3. How to compile EVM op-codes to MSIL-op-codes?

Well, I haven't got a very good answer for this. This is what I am going to do next. Currently, I read PC Opcode to IL-opcodes from the pr but I could not really understand why.

I am trying that using tools like ildasm against some simple codes with GUI ILSpy and try to understand IL-opcodes better.

I am also looking for articles like understand-evm-bytecode-part-1 could walk me through some easy IL-opcodes.

Next week, I would also try to write the benchmark codes for the pr to compare IL-Evm with pure Evm though the pr auther got some benchmark examples.

Details for Rust AA-Bundler

Time spent on this is relatively less. I reviewed @Vid documents about the Rust AA-Bundler. I gave some comments and questions. Vid gave good explaination.

Next week, I would try to take some part of the codes to make some pull requests.

Reading list