precompile

package
v1.16.33 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetVerifiedWarpMessageGas = 200_000
	SendWarpMessageGas        = 100_000
	GetBlockchainIDGas        = 10_000
)

Gas costs for warp operations

View Source
const WarpABI = `` /* 1392-byte string literal not displayed */

WarpABI is the ABI for the warp precompile

Variables

View Source
var WarpPrecompileContract = common.HexToAddress("0x0200000000000000000000000000000000000005")

WarpPrecompileContract is the precompile contract address

Functions

This section is empty.

Types

type WarpBackend

type WarpBackend interface {
	GetMessage(index uint32) (*warp.Message, error)
	AddMessage(unsignedMessage *warp.UnsignedMessage) error
	GetValidatorState() warp.ValidatorState
}

WarpBackend is the backend interface for warp operations

type WarpConfig

type WarpConfig struct {
	NetworkID         uint32
	SourceChainID     ids.ID
	BlockchainID      ids.ID
	QuorumNumerator   uint64
	QuorumDenominator uint64
}

WarpConfig is the configuration for the warp precompile

func DefaultWarpConfig

func DefaultWarpConfig(networkID uint32, chainID ids.ID) *WarpConfig

DefaultWarpConfig returns the default warp configuration

type WarpModule

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

WarpModule implements the warp precompile functionality

func NewWarpModule

func NewWarpModule(config *WarpConfig, backend WarpBackend) *WarpModule

NewWarpModule creates a new warp module

func (*WarpModule) GetBlockchainID

func (w *WarpModule) GetBlockchainID(
	evm *vm.EVM,
	caller common.Address,
	value *uint256.Int,
	readOnly bool,
) ([]byte, error)

GetBlockchainID retrieves the blockchain ID

func (*WarpModule) GetVerifiedWarpMessage

func (w *WarpModule) GetVerifiedWarpMessage(
	index uint32,
	evm *vm.EVM,
	caller common.Address,
	value *uint256.Int,
	readOnly bool,
) ([]byte, error)

GetVerifiedWarpMessage retrieves a verified warp message

func (*WarpModule) SendWarpMessage

func (w *WarpModule) SendWarpMessage(
	payload []byte,
	evm *vm.EVM,
	caller common.Address,
	value *uint256.Int,
	readOnly bool,
) ([]byte, error)

SendWarpMessage sends a warp message

type WarpPrecompile

type WarpPrecompile interface {
	GetVerifiedWarpMessage(index uint32, evm *vm.EVM, caller common.Address, value *uint256.Int, readOnly bool) ([]byte, error)
	SendWarpMessage(payload []byte, evm *vm.EVM, caller common.Address, value *uint256.Int, readOnly bool) ([]byte, error)
	GetBlockchainID(evm *vm.EVM, caller common.Address, value *uint256.Int, readOnly bool) ([]byte, error)
}

WarpPrecompile is the interface for the warp precompile contract

Jump to

Keyboard shortcuts

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