---
# System prepended metadata

title: EPF Update 4
tags: [Ethereum Protocol Fellowship]

---

---
tags: Ethereum Protocol Fellowship
---

# EPF Update 4 

## Summary

1. I wrote a [IL-EVM-vs-EVM benchmark](https://github.com/zsluedem/nethermind/blob/il-vm/src/Nethermind/Nethermind.Evm.ILBenchmark/Program.cs) and put some review questions and comments in the original [IL-EVM pr](https://github.com/NethermindEth/nethermind/pull/3888#discussion_r1022296157)
2. I am reading [ECMA](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/) book which talks about the whole [CIL](https://en.wikipedia.org/wiki/Common_Intermediate_Language).
3. I reviewed the [Permit2](https://github.com/Uniswap/permit2) which could applies to AA.

## Next week

I would try to reach to @Vid and discusss on what kind of work I could do for rust aa-bundler.

I would also draft a project for IL-VM.

## IL-EVM vs EVM benchmark

The source codes are in the [IL-VM branch](https://github.com/zsluedem/nethermind/blob/il-vm/src/Nethermind/Nethermind.Evm.ILBenchmark/Program.cs). This is the first C# codes except Hello World I wrote. I am pretty sastified my journey on C# these days.Microsoft reallys keeps a very good document.

Below is the benchmark result.

| Method |             Bytecode |        Mean |     Error |   StdDev |
|------- |--------------------- |------------:|----------:|---------:|
|  ILEvm |                 5850 |    196.2 us |   3.74 us |  3.49 us |
|    Evm |                 5850 |    192.2 us |   1.57 us |  1.39 us |
|  ILEvm |           6000600157 |    194.0 us |   1.85 us |  1.73 us |
|    Evm |           6000600157 |    194.1 us |   2.05 us |  1.81 us |
|  ILEvm |               600156 |    178.3 us |   1.68 us |  1.49 us |
|    Evm |               600156 |    215.5 us |   1.59 us |  1.33 us |
|  ILEvm |           6001600157 |    176.2 us |   2.69 us |  2.39 us |
|    Evm |           6001600157 |    218.8 us |   2.73 us |  2.55 us |
|  ILEvm | 60016(...)30303 [22] |    193.0 us |   1.81 us |  1.51 us |
|    Evm | 60016(...)30303 [22] |    199.6 us |   0.74 us |  0.66 us |
|  ILEvm |         60016005575B |    190.9 us |   2.33 us |  2.06 us |
|    Evm |         60016005575B |    195.3 us |   2.36 us |  1.97 us |
|  ILEvm |           6001800350 |    193.6 us |   2.20 us |  1.84 us |
|    Evm |           6001800350 |    196.6 us |   1.93 us |  1.71 us |
|  ILEvm |         600260019003 |    190.8 us |   1.95 us |  1.73 us |
|    Evm |         600260019003 |    196.7 us |   1.16 us |  1.03 us |
|  ILEvm |             6003565B |    191.4 us |   2.53 us |  2.24 us |
|    Evm |             6003565B |    196.6 us |   1.50 us |  1.33 us |
|  ILEvm | 63000(...)55750 [30] |  6,532.3 us |  39.32 us | 34.85 us |
|    Evm | 63000(...)55750 [30] | 11,069.8 us | 112.30 us | 99.56 us |


We can tell that the ILEVM doesn't beat EVM too much on most of the simple case like simple push, sub or add. But let's focus on the last case.


Let's put it into Mnemonic which helps reading.
```
PUSH3 0x030D40
JUMPDEST
PUSH1 1
SWAP1
SUB
DUP1
PUSH1 4
JUMPI
POP
```

It is basically a loop which iterates 200000(0x030D40) times.This example IL-EVM runs one time faster the EVM. We could see the great bootup. 

On the original benchmark the IL-VM author @Scooletz wrote show different answer.

* regular VM execution took 00:00:01.3301542 taking 6,65ms per 1000 spins
* IL VM execution took 00:00:00.0881434 taking 0,44ms per 1000 spins

It shows a very different result. I think because my benchmark would do a warmsup first which make all original codes into JIT code. In this case, regular vm also shows a bootup.


I am quite satisfied I got the result right now. Next, I will read ECMA book to get better understanding dotnet runtime. The ECMA book is a big one and it is gonna to take a long time, I think.

## Permit2 (Still studying)

Permit2 consists of two main components -> [SignatureTransfer.sol](https://github.com/Uniswap/permit2/blob/main/src/SignatureTransfer.sol) and [AllowanceTransfer.sol](https://github.com/Uniswap/permit2/blob/main/src/AllowanceTransfer.sol). This could be a possible solution for abstract accounts payment.

### SignatureTransfer
1. Signer create a permits for specific `token`. 
2. Signer signs a signature for the permits based on `nonce`
3. Anyone who has the signature could perform the transfers to any address

### AllowanceTransfer
Allowance keeps track of a map of `{user: {token: {spender: allowance}}}` which user could add spender for some tokens.

### question
I am still reviewing the repo. Currently, I don't have very good understanding of every details.I might need to read for more.

## Reading list

1. [EIP-712](https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct)
2. [ECMA](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/)
3. [Uniswap V2](https://github.com/Uniswap/v2-core)
4. [Uniswap V2 periphery](https://github.com/Uniswap/v2-periphery)
5. [Foundry](https://book.getfoundry.sh/)