precompiled

package
v0.0.0-...-98baaec Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IV = [8]uint64{
	0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
	0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179,
}

IV is an initialization vector for BLAKE2b

Functions

func DecodeHex

func DecodeHex(str string) ([]byte, error)

DecodeHex converts a hex string to a byte array

func F

func F(h *[8]uint64, m [16]uint64, c [2]uint64, f bool, rounds uint32)

F is a compression function for BLAKE2b. It takes as an argument the state vector `h`, message block vector `m`, offset counter `t`, final block indicator flag `f`, and number of rounds `rounds`. The state vector provided as the first parameter is modified by the function.

func MustDecodeHex

func MustDecodeHex(str string) []byte

MustDecodeHex type-checks and converts a hex string to a byte array

func ReadTestCase

func ReadTestCase(t *testing.T, path string, f func(t *testing.T, c *TestCase))

Types

type Blake2f

type Blake2f struct {
}

func (*Blake2f) Gas

func (e *Blake2f) Gas(input []byte, rev evmc.Revision) uint64

func (*Blake2f) Run

func (e *Blake2f) Run(input []byte) ([]byte, error)

type Bn256Add

type Bn256Add struct {
	Precompiled
}

func (*Bn256Add) Gas

func (b *Bn256Add) Gas(input []byte, rev evmc.Revision) uint64

func (*Bn256Add) Run

func (b *Bn256Add) Run(input []byte) ([]byte, error)

type Bn256Mul

type Bn256Mul struct {
	Precompiled
}

func (*Bn256Mul) Gas

func (b *Bn256Mul) Gas(input []byte, rev evmc.Revision) uint64

func (*Bn256Mul) Run

func (b *Bn256Mul) Run(input []byte) ([]byte, error)

type Bn256Pairing

type Bn256Pairing struct {
	Precompiled
}

func (*Bn256Pairing) Gas

func (b *Bn256Pairing) Gas(input []byte, rev evmc.Revision) uint64

func (*Bn256Pairing) Run

func (b *Bn256Pairing) Run(input []byte) ([]byte, error)

type Ecrecover

type Ecrecover struct {
	Precompiled
}

func (*Ecrecover) Gas

func (e *Ecrecover) Gas(input []byte, rev evmc.Revision) uint64

func (*Ecrecover) Run

func (e *Ecrecover) Run(input []byte) ([]byte, error)

type Identity

type Identity struct {
}

func (*Identity) Gas

func (i *Identity) Gas(input []byte, rev evmc.Revision) uint64

func (*Identity) Run

func (i *Identity) Run(in []byte) ([]byte, error)

type ModExp

type ModExp struct {
	Precompiled
}

func (*ModExp) Gas

func (m *ModExp) Gas(input []byte, rev evmc.Revision) uint64

func (*ModExp) Run

func (m *ModExp) Run(input []byte) ([]byte, error)

type Precompiled

type Precompiled struct {
}

Precompiled is a helper runtime for precompiled smart contracts

type Ripemd160h

type Ripemd160h struct {
	Precompiled
}

func (*Ripemd160h) Gas

func (r *Ripemd160h) Gas(input []byte, rev evmc.Revision) uint64

func (*Ripemd160h) Run

func (r *Ripemd160h) Run(input []byte) ([]byte, error)

type Sha256h

type Sha256h struct {
}

func (*Sha256h) Gas

func (s *Sha256h) Gas(input []byte, rev evmc.Revision) uint64

func (*Sha256h) Run

func (s *Sha256h) Run(input []byte) ([]byte, error)

type TestCase

type TestCase struct {
	Name     string
	Input    []byte
	Expected []byte
	Gas      uint64
}

Jump to

Keyboard shortcuts

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