evm

package
v1.10.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ErrSmartContractNotFound     = whoops.Errorf("smart contract %s was not found")
	ErrInvalidAddress            = whoops.Errorf("provided address: '%s' is not valid")
	ErrAddressNotFoundInKeyStore = whoops.Errorf("address: '%s' not found in keystore: %s")
	ErrUnsupportedMessageType    = whoops.Errorf("unsupported message type: %T")
	ErrABINotInitialized         = whoops.String("ABI is not initialized")

	ErrEvm = whoops.String("EVM related error")

	ErrNoConsensus         = whoops.String("no consensus reached")
	ErrCallAlreadyExecuted = whoops.String("message with identical ID already on target chain")

	ErrCouldntFindBlockWithTime = whoops.String("couldn't find block")
)
View Source
const (
	FieldMessageID   whoops.Field[uint64] = "message id"
	FieldMessageType whoops.Field[any]    = "message type"
)
View Source
const (
	SignedMessagePrefix = "\x19Ethereum Signed Message:\n32"
)

Variables

View Source
var ErrStartingBlockIsInTheFuture = ErrCouldntFindBlockWithTime.WrapS("starting height's block time is set in future")

Functions

func OpenKeystore

func OpenKeystore(dir string) *keystore.KeyStore

func StoredContracts

func StoredContracts() map[string]StoredContract

func TestAndVerifyConfig added in v0.8.1

func TestAndVerifyConfig(ctx context.Context, cfg config.EVM) error

Types

type Client

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

func (*Client) BalanceAt added in v0.5.0

func (c *Client) BalanceAt(ctx context.Context, address common.Address, blockHeight uint64) (*big.Int, error)

func (*Client) BlockByHash

func (c *Client) BlockByHash(ctx context.Context, blockHash common.Hash) (*ethtypes.Block, error)

func (*Client) DeployContract

func (c *Client) DeployContract(
	ctx context.Context,
	chainID *big.Int,
	rawABI string,
	bytecode,
	constructorInput []byte,
) (contractAddr common.Address, tx *ethtypes.Transaction, err error)

func (*Client) ExecuteSmartContract

func (c *Client) ExecuteSmartContract(
	ctx context.Context,
	chainID *big.Int,
	contractAbi abi.ABI,
	addr common.Address,
	useMevRelay bool,
	method string,
	arguments []any,
) (*etherumtypes.Transaction, error)

func (*Client) FilterLogs

func (c *Client) FilterLogs(ctx context.Context, fq etherum.FilterQuery, currBlockHeight *big.Int, fn func(logs []ethtypes.Log) bool) (bool, error)

FilterLogs will gather all logs given a FilterQuery. If it encounters an error saying that there are too many results in the provided block window, then it's going to try to do this using a "binary search" approach while splitting the possible set in two, recursively.

func (*Client) FindBlockNearestToTime added in v0.5.0

func (c *Client) FindBlockNearestToTime(ctx context.Context, startingHeight uint64, when time.Time) (uint64, error)

func (*Client) FindCurrentBlockNumber added in v0.11.7

func (c *Client) FindCurrentBlockNumber(ctx context.Context) (*big.Int, error)

func (Client) GetEthClient added in v1.8.0

func (c Client) GetEthClient() ethClientConn

func (*Client) LastValsetID added in v0.11.7

func (c *Client) LastValsetID(ctx context.Context, addr common.Address) (*big.Int, error)

func (*Client) TransactionByHash

func (c *Client) TransactionByHash(ctx context.Context, txHash common.Hash) (*ethtypes.Transaction, bool, error)

type CompassBinding added in v0.11.7

type CompassBindingCaller added in v0.11.7

type CompassBindingCaller interface {
	LastCheckpoint(opts *bind.CallOpts) ([32]byte, error)
	LastValsetId(opts *bind.CallOpts) (*big.Int, error)
	MessageIdUsed(opts *bind.CallOpts, arg0 *big.Int) (bool, error)
	TurnstoneId(opts *bind.CallOpts) ([32]byte, error)
}

type CompassBindingFilterer added in v0.11.7

type CompassBindingFilterer interface {
	FilterLogicCallEvent(opts *bind.FilterOpts) (*compassABI.CompassLogicCallEventIterator, error)
	FilterValsetUpdated(opts *bind.FilterOpts) (*compassABI.CompassValsetUpdatedIterator, error)
	ParseLogicCallEvent(log ethtypes.Log) (*compassABI.CompassLogicCallEvent, error)
	ParseValsetUpdated(log ethtypes.Log) (*compassABI.CompassValsetUpdated, error)
	WatchLogicCallEvent(opts *bind.WatchOpts, sink chan<- *compassABI.CompassLogicCallEvent) (event.Subscription, error)
	WatchValsetUpdated(opts *bind.WatchOpts, sink chan<- *compassABI.CompassValsetUpdated) (event.Subscription, error)
}

type CompassBindingTransactor added in v0.11.7

type CompassBindingTransactor interface {
	SubmitLogicCall(opts *bind.TransactOpts, consensus compassABI.Struct2, args compassABI.Struct3, messageId *big.Int, deadline *big.Int) (*ethtypes.Transaction, error)
	UpdateValset(opts *bind.TransactOpts, consensus compassABI.Struct2, newValset compassABI.Struct0) (*ethtypes.Transaction, error)
}

type CompassConsensus added in v0.4.0

type CompassConsensus struct {
	Valset     CompassValset
	Signatures []Signature
	// contains filtered or unexported fields
}

func BuildCompassConsensus added in v0.4.0

func BuildCompassConsensus(
	v *evmtypes.Valset,
	signatures []chain.ValidatorSignature,
) CompassConsensus

func (CompassConsensus) OriginalSignatures added in v0.4.0

func (c CompassConsensus) OriginalSignatures() [][]byte

type CompassLogicCallArgs added in v0.8.0

type CompassLogicCallArgs struct {
	Payload              []byte
	LogicContractAddress common.Address
}

type CompassTokenSendArgs added in v1.8.0

type CompassTokenSendArgs struct {
	Receiver []common.Address
	Amount   []*big.Int
}

type CompassValset added in v0.4.0

type CompassValset struct {
	ValsetId   *big.Int
	Validators []common.Address
	Powers     []*big.Int
}

func TransformValsetToCompassValset added in v0.4.0

func TransformValsetToCompassValset(val *evmtypes.Valset) CompassValset

type Factory

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

func NewFactory

func NewFactory(pc PalomaClienter) *Factory

func (*Factory) Build

func (f *Factory) Build(
	cfg config.EVM,
	chainReferenceID,
	smartContractID,
	smartContractABIJson,
	smartContractAddress string,
	chainID *big.Int,
	blockHeight int64,
	blockHeightHash common.Hash,
	minOnChainBalance *big.Int,
	mevClient mev.Client,
) (chain.Processor, error)

type PalomaClienter

type PalomaClienter interface {
	NewStatus() paloma.StatusUpdater
	AddMessageEvidence(ctx context.Context, queueTypeName string, messageID uint64, proof proto.Message) error
	SetPublicAccessData(ctx context.Context, queueTypeName string, messageID uint64, data []byte) error
	SetErrorData(ctx context.Context, queueTypeName string, messageID uint64, data []byte) error
	QueryGetEVMValsetByID(ctx context.Context, id uint64, chainID string) (*types.Valset, error)
	SendBatchSendToEVMClaim(ctx context.Context, claim gravitytypes.MsgBatchSendToEthClaim) error
	SendSendToPalomaClaim(ctx context.Context, claim gravitytypes.MsgSendToPalomaClaim) error
	QueryGetLastEventNonce(ctx context.Context, orchestrator string) (uint64, error)
	QueryBatchRequestByNonce(ctx context.Context, nonce uint64, contract string) (gravitytypes.OutgoingTxBatch, error)
	QueryGetLatestPublishedSnapshot(ctx context.Context, chainReferenceID string) (*valset.Snapshot, error)
}

type Processor

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

func (Processor) ExternalAccount

func (p Processor) ExternalAccount() chain.ExternalAccount

func (Processor) GetBatchSendEvents added in v1.8.0

func (p Processor) GetBatchSendEvents(ctx context.Context, orchestrator string) ([]chain.BatchSendEvent, error)

func (Processor) GetChainReferenceID added in v1.5.5

func (p Processor) GetChainReferenceID() string

func (Processor) GetSendToPalomaEvents added in v1.8.0

func (p Processor) GetSendToPalomaEvents(ctx context.Context, orchestrator string) ([]chain.SendToPalomaEvent, error)

func (Processor) GravityRelayBatches added in v1.8.0

func (p Processor) GravityRelayBatches(ctx context.Context, batches []chain.GravityBatchWithSignatures) error

func (Processor) GravitySignBatches added in v1.8.0

func (p Processor) GravitySignBatches(ctx context.Context, batches ...gravity.OutgoingTxBatch) ([]chain.SignedGravityOutgoingTxBatch, error)

func (Processor) HealthCheck added in v0.7.0

func (p Processor) HealthCheck(ctx context.Context) error

func (Processor) IsRightChain

func (p Processor) IsRightChain(ctx context.Context) error

func (Processor) ProcessMessages

func (p Processor) ProcessMessages(ctx context.Context, queueTypeName queue.TypeName, msgs []chain.MessageWithSignatures) error

func (Processor) ProvideEvidence added in v0.4.0

func (p Processor) ProvideEvidence(ctx context.Context, queueTypeName queue.TypeName, msgs []chain.MessageWithSignatures) error

func (Processor) SignMessages

func (p Processor) SignMessages(ctx context.Context, messages ...chain.QueuedMessage) ([]chain.SignedQueuedMessage, error)

func (Processor) SubmitBatchSendToEthClaims added in v1.8.0

func (p Processor) SubmitBatchSendToEthClaims(ctx context.Context, batchSendEvents []chain.BatchSendEvent, orchestrator string) error

func (Processor) SubmitSendToPalomaClaims added in v1.8.0

func (p Processor) SubmitSendToPalomaClaims(ctx context.Context, batchSendEvents []chain.SendToPalomaEvent, orchestrator string) error

func (Processor) SupportedQueues

func (p Processor) SupportedQueues() []string

type Signature added in v0.11.7

type Signature struct {
	V *big.Int
	R *big.Int
	S *big.Int
}

type StoredContract

type StoredContract struct {
	ABI    abi.ABI
	Source []byte
}

Directories

Path Synopsis
abi

Jump to

Keyboard shortcuts

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