precompiledContracts

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

* Copyright 2020 The SealEVM Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const EthPrecompiledMaxAddr = 9
View Source
const EthPrecompiledMinAddr = 1

const ContractsMaxAddress = 16

View Source
const ExtPrecompiled2030100MaxAddr = 15

const ExtPrecompiled2030100MinAddr = 10

View Source
const ExtPrecompiled2030200MaxAddr = 1007
View Source
const ExtPrecompiled2030200MinAddr = 1000

Variables

View Source
var Contracts = map[uint64]PrecompiledContract{
	1:    &ecRecover{},
	2:    &sha256hash{},
	3:    &ripemd160hash{},
	4:    &dataCopy{},
	5:    &bigModExp{},
	6:    &bn256AddIstanbul{},
	7:    &bn256ScalarMulIstanbul{},
	8:    &bn256PairingIstanbul{},
	9:    &blake2F{},
	10:   &senderOrgId{},
	11:   &senderRole{},
	12:   &senderPk{},
	13:   &creatorOrgId{},
	14:   &creatorRole{},
	15:   &creatorPk{},
	1007: &signVerify{},
}

var Contracts = [ContractsMaxAddress]PrecompiledContract{

View Source
var ContractsNew = map[uint64]PrecompiledContract{
	1:    &ecRecover{},
	2:    &sha256hash{},
	3:    &ripemd160hash{},
	4:    &dataCopy{},
	5:    &bigModExp{},
	6:    &bn256AddIstanbul{},
	7:    &bn256ScalarMulIstanbul{},
	8:    &bn256PairingIstanbul{},
	9:    &blake2F{},
	1000: &senderOrgId{},
	1001: &senderRole{},
	1002: &senderPk{},
	1003: &creatorOrgId{},
	1004: &creatorRole{},
	1005: &creatorPk{},
	1006: &contractLog{},
	1007: &signVerify{},
}
View Source
var IV = [8]uint64{
	0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
	0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179,
}

IV is an initialization vector for BLAKE2b

View Source
var (
	// S256 is the secp256k1 elliptic curve
	S256 = btcec.S256()
)

Functions

func F added in v2.3.4

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 IsPrecompiledContract

func IsPrecompiledContract(address *evmutils.Int, version uint32) bool

Types

type PrecompiledContract

type PrecompiledContract interface {
	//SetValue(v string)
	GasCost(input []byte) uint64
	Execute(input []byte, version uint32) ([]byte, error)
}

Jump to

Keyboard shortcuts

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