evmprecompiles

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package evmprecompiles implements the Ethereum VM precompile contracts.

This package collects all the precompile functions into a single location for easier integration. The main functionality is implemented elsewhere. This package right now implements:

  1. ECRECOVER ✅ -- function ECRecover
  2. SHA256 ❌ -- in progress
  3. RIPEMD160 ❌ -- postponed
  4. ID ❌ -- trivial to implement without function
  5. EXPMOD ✅ -- function Expmod
  6. BN_ADD ✅ -- function ECAdd
  7. BN_MUL ✅ -- function ECMul
  8. SNARKV ✅ -- function ECPair
  9. BLAKE2F ❌ -- postponed

This package uses local representation for the arguments. It is up to the user to instantiate corresponding types from their application-specific data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ECAdd

ECAdd implements ALT_BN128_ADD precompile contract at address 0x06.

func ECMul

ECMul implements ALT_BN128_MUL precompile contract at address 0x07.

func ECPair

func ECPair(api frontend.API, P []*sw_bn254.G1Affine, Q []*sw_bn254.G2Affine)

func ECRecover

ECRecover implements ECRECOVER precompile contract at address 0x01.

func Expmod added in v0.10.0

func Expmod(api frontend.API, base, exp, modulus *emulated.Element[emparams.Mod1e4096]) *emulated.Element[emparams.Mod1e4096]

Expmod implements MODEXP precompile contract at address 0x05.

Internally, uses 4k elements for representing the base, exponent and modulus, upper bounding the sizes of the inputs. The runtime is constant regardless of the actual length of the inputs.

func GetHints

func GetHints() []solver.Hint

GetHints returns all the hints used in this package.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL