Skip to content

Specification

Motivation

Precompiled modexp

  • The precompiled modexp is enabled: modexp
    • some fixes regarding the previous version have been added
    • after a few discussions, it is decided to set the maximum input length of the base, modulus and exponent to 32 chunks of 256 bits. See link for more details
    • if input length > %MAX_SIZE_MODEXP --> zkEVM does a revert returning all the gas consumed

RIP7212: p256verify

A precompiled contract that perfoms signature verifications in the secp256r1 elliptic curve have been added: rip7212

Tags

git diff

Code changes

zkevm-rom

  • Update constant forkId:
    CONST %FORK_ID = 13
    

Modexp

p256verify

  • Add new address precompiled:
    • process-tx.zkasm:
      ; Check zero address since zero address is not a precompiled contract
          0 => B
          $                               :EQ, JMPC(callContract)
          0x100 => B
          $                               :EQ, JMPC(selectorPrecompiledP256Verify)
          10 => B
          $                               :LT,JMPC(selectorPrecompiled, callContract)
          $                               :LT, JMPC(selectorPrecompiled, callContract)
      
    • precompiled/selector.zkasm:
      selectorPrecompiledP256Verify:
                          :JMP(funcP256VERIFY)
      
  • Add pre-p256verify:
    • constants.zkasm:
      CONST %P256VERIFY_GAS = 3450 ; p256verify gas price
      
    • precompiled/pre-p256verify.zkasm: file
    • Update isColdAddress (touched.zkasm):
      ; if address is a precompiled considered as warm address
      10 => B
      $                           :LT, JMPC(finishColdPrecompiled)
      0x100 => B
      $                           :EQ, JMPC(finishColdPrecompiled)
      
    • Update counters: commit counters
  • Add p256verify: PR p256verify

zkevm-proverjs

zkevm-testvectors

  • Update tests forkId = 13
  • Update pre-revert tests (delete modexp)
  • Add tests modexp
  • Add tests p256verify
  • Update tests with 0x100 address in pre-state (ethereum-tests)
  • Update virtual counters

zkevm-commonjs

  • Update monorepo version
  • Update VCs:

fork ethereumjs-monorepo