ebp

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 25 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultTxGasLimit uint64 = 1000_0000
	MaxGasPrice       uint64 = 1e19 // 10Zeniq
)
View Source
const (
	RpcRunnersIdStart int = 10000
	RpcRunnersCount   int = 256
	SMALL_BUF_SIZE    int = int(C.SMALL_BUF_SIZE)
)
View Source
const (
	EnableRWList = false
)
View Source
const (
	VRF_VERIFY_GAS uint64 = 5000
)

Variables

View Source
var AdjustGasUsed = true // It's a global variable because in tests we must change it to false to be compatible
View Source
var PredefinedContractManager map[common.Address]types.SystemContractExecutor
View Source
var (
	QueryExecutorFn C.bridge_query_executor_fn
)
View Source
var RpcRunnerLocks [RpcRunnersCount]spinLock

Its usage is similar with Runners. Runners are for transactions in block. RpcRunners are for transactions in Web3 RPC: call and estimateGas.

View Source
var Runners []*TxRunner

This is a global variable. The parameter 'collector_handler' passed to zero_depth_call_wrap is an index to select one TxRunner from this global variable.

View Source
var SEP206AddrAsZeniqOnEthereum = common.HexToAddress("0x5b52bfb8062ce664d74bbcd4cd6dc7df53fd7233")
View Source
var Sep206Address = common.HexToAddress("0x0000000000000000000000000000000000002711")

SEP206SEP

View Source
var TotalAmount [32]byte = uint256.NewInt(0).Mul(uint256.NewInt(1e18), uint256.NewInt(2100_0000)).Bytes32()

Functions

func AddCrosschain added in v0.6.4

func AddCrosschain(v *uint256.Int)

func AddSystemAccBalance

func AddSystemAccBalance(ctx *types.Context, amount *uint256.Int) error

func GetBalanceAfterTransfer added in v0.6.4

func GetBalanceAfterTransfer(ctx *types.Context, address common.Address, value [32]byte) *uint256.Int

func GetBlackHoleBalance

func GetBlackHoleBalance(ctx *types.Context) *uint256.Int

func GetSystemBalance

func GetSystemBalance(ctx *types.Context) *uint256.Int

func LogsBloom

func LogsBloom(logs []types.Log) [256]byte

func NewEbpTxExec

func NewEbpTxExec(exeRoundCount, runnerNumber, parallelNum, defaultTxListCap int,
	s gethtypes.Signer, logger log.Logger, CCRPCForkBlock int64) *txEngine

func NewFrontierWithCtxAA

func NewFrontierWithCtxAA(ctxAA []*ctxAndAccounts, addr2idx map[common.Address]int) *frontier

func RegisterPredefinedContract

func RegisterPredefinedContract(ctx *types.Context, address common.Address, executor types.SystemContractExecutor)

func ReloadQueryExecutorFn

func ReloadQueryExecutorFn(aotDir string)

func RunTxForRpc

func RunTxForRpc(currBlock *types.BlockInfo, estimateGas bool, runner *TxRunner) int64

func StatusIsFailure

func StatusIsFailure(status int) bool

func StatusToStr

func StatusToStr(status int) string

func SubSenderAccBalance

func SubSenderAccBalance(ctx *types.Context, sender common.Address, amount *uint256.Int) error

guarantee account exists externally

func SubSystemAccBalance

func SubSystemAccBalance(ctx *types.Context, amount *uint256.Int) error

func TransferFromSenderAccToBlackHoleAcc

func TransferFromSenderAccToBlackHoleAcc(ctx *types.Context, sender common.Address, amount *uint256.Int) error

Types

type Frontier

type Frontier interface {
	GetLatestNonce(addr common.Address) (nonce uint64, exist bool)
	SetLatestNonce(addr common.Address, newNonce uint64)
	GetLatestBalance(addr common.Address) (balance *uint256.Int, exist bool)
	SetLatestBalance(addr common.Address, balance *uint256.Int)
	GetLatestTotalGas(addr common.Address) (gas uint64, exist bool)
	SetLatestTotalGas(addr common.Address, gas uint64)
}

func GetEmptyFrontier

func GetEmptyFrontier() Frontier

type TxExecutor

type TxExecutor interface {
	SetAotParam(aotDir string, aotReloadInterval int64)

	//step 1: for deliverTx, collect block txs in engine.txList
	CollectTx(tx *gethtypes.Transaction)
	//step 2: for commit, check sig, insert regular txs standbyTxQ
	Prepare(reorderSeed int64, minGasPrice, maxTxGasLimit uint64) Frontier
	//step 3: for postCommit, parallel execute tx in standbyTxQ
	Execute(currBlock *types.BlockInfo)

	//set context
	SetContext(ctx *types.Context)
	Context() *types.Context

	//collect infos, not thread safe
	CollectedTxsCount() int
	CommittedTxs() []*types.Transaction
	CommittedTxIds() [][32]byte
	CommittedTxsForDB() []dbtypes.Tx
	GasUsedInfo() (gasUsed uint64, feeRefund, gasFee uint256.Int)
	StandbyQLen() int
}

type TxRange

type TxRange struct {
	// contains filtered or unexported fields
}

type TxRunner

type TxRunner struct {
	Ctx       *types.Context
	GasUsed   uint64
	FeeRefund uint256.Int
	Tx        *types.TxToRun
	Logs      []types.EvmLog
	Status    int
	OutData   []byte
	ForRpc    bool

	CreatedContractAddress common.Address

	InternalTxCalls   []types.InternalTxCall
	InternalTxReturns []types.InternalTxReturn

	RwLists *types.ReadWriteLists
}

func NewTxRunner

func NewTxRunner(ctx *types.Context, tx *types.TxToRun) *TxRunner

func (*TxRunner) GetGasFee

func (runner *TxRunner) GetGasFee() *uint256.Int

type VrfVerifyContract

type VrfVerifyContract struct{}

func (*VrfVerifyContract) RequiredGas

func (vdfc *VrfVerifyContract) RequiredGas(input []byte) uint64

func (*VrfVerifyContract) Run

func (vdfc *VrfVerifyContract) Run(input []byte) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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