- Why?
- Enable convenient way to implement cryptography related functions in EVM
- No need to add new precompiles in the future.
- No need to wait until requested precompile is on mainnet.
- To avoid implementation specific details problem as we have now when adding a new precompile. To mitigate precompile implementation specific consensus issues.
- To allow ZK and others to deliver specialized cryptography libraries available in EVM (in yul, solidity, viper languages, etc.)
- What is EVMMAX?
- EVM Modular Arithmetic Extension. Name explanation.
- It implements prime field operations (now) in EVM. Next step odd and 2^n field operation.
- Where it is in the architecture (nice diagram showing the layers.)
- The EIP link.
- Future evolution of EOF
- Issue with current solution (precompiles):
- (probably 2-3 slides) ECC bn254 point addition. nice diagram explaining what the precompile does.
- How it's used. It's supposed to be a tool to implement advanced ECC algorithms on chain.
- Problem
- Most of the computation time spent in inversion. 90% of time.
- It's not need because we want to process the result farther.
- We want to stay in projection or Jacobian coordinates. No need to go to affine and back.
- The bn254 point addition precompile is useless in this case.
- Solution. We can stay in chosen coordinates system and convert to affine if needed. If ever.
- ECC bn254 point multiplication - to be considered as a example here. ecmul
- (probably 2-3 slides) ECC bn254 point addition. nice diagram explaining what the precompile does.
- Review of the current spec
- Opcodes (Similar to EVM Summit part but shorter)
ADDMODX,SUBMODX,MULMODXSETUPX(Setup EVMMAX context, defineMODULUS, number of available slots, switch context)STOREX,LOADX(to/from Montgomery form conversion)
- Opcodes (Similar to EVM Summit part but shorter)
- Current state 6. EVMMAX opcode in evmone (simple EVMMAX bytecode generation support) 7. ecadd, ecmul (for bn curve ) implemented and benchmarked
- What to do next.
- Implement bls precompiles counterparts in EVMMAX.
- Support odd and 2^k order fields. Go beyond ECC targeted solution.
- Implement hashing functions based on this (Poseidon hash function i.e.)
- Redesign if needed. I.e. better support for control flow, new opcodes (
EQXorIS_ZEROX), enable better static analysis of the EVMMAX bytecode. - Research SIMD EVMMAX version on AVX (Advanced Vector Extension) usability and support for vectorized inputs.
- Support EVMMAX in higher level languages like yul, solidity or Huff.
- Make EVMMAX a spec language to define precompiles if they will be still needed. R&D on possible transpiler from EVMMAX to high level languages (i.e. Go, C++, JS, Java, Rust.) it would potentially enable EL clients to use the reference implementation of precompiles in EVMMAX as libraries in any language they need.