evm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MalleabilityThreshold = "0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0"
	ZeroSValue            = "0x0000000000000000000000000000000000000000000000000000000000000000"
)
View Source
const DefaultEVMGasLimit = uint64(2500000)

DefaultEVMGasLimit the default gas limit to use when sending transactions to the EVM chain.

Variables

View Source
var ErrInvalid = errors.New("invalid")

Functions

func EthAddressFromSignature

func EthAddressFromSignature(hash []byte, signature []byte) (common.Address, error)

func NewEthereumSignature

func NewEthereumSignature(hash []byte, ks *keystore.KeyStore, acc accounts.Account) ([]byte, error)

NewEthereumSignature creates a new eip-191 signature over a given byte array. hash: digest to be signed over. ks: the keystore to use for the signature acc: the account in the keystore to use for the signature

func SigToVRS

func SigToVRS(sigHex string) (v uint8, r, s ethcmn.Hash, err error)

SigToVRS breaks apart a signature into its components to make it compatible with the contracts The validation done in here is defined under https://github.com/celestiaorg/orchestrator-relayer/issues/105

func ValidateEthereumSignature

func ValidateEthereumSignature(hash []byte, signature []byte, ethAddress common.Address) error

ValidateEthereumSignature takes a message, an associated signature and public key and returns an error if the signature isn't valid.

Types

type Client

type Client struct {
	Wrapper  *blobstreamwrapper.Wrappers
	Ks       *keystore.KeyStore
	Acc      *accounts.Account
	EvmRPC   string
	GasLimit uint64
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	logger tmlog.Logger,
	wrapper *blobstreamwrapper.Wrappers,
	ks *keystore.KeyStore,
	acc *accounts.Account,
	evmRPC string,
	gasLimit uint64,
) *Client

NewClient Creates a new EVM Client that can be used to deploy the Blobstream contract and interact with it. The wrapper parameter can be nil when creating the client for contract deployment.

func (*Client) DeployBlobstreamContract

func (ec *Client) DeployBlobstreamContract(
	opts *bind.TransactOpts,
	contractBackend bind.ContractBackend,
	contractInitValset types.Valset,
	contractInitNonce uint64,
	initBridge bool,
) (gethcommon.Address, *coregethtypes.Transaction, *blobstreamwrapper.Wrappers, error)

DeployBlobstreamContract Deploys the Blobstream contract and initializes it with the provided valset. The waitToBeMined, when set to true, will wait for the transaction to be included in a block, and log relevant information. The initBridge, when set to true, will assign the newly deployed bridge to the wrapper. This can be used later for further interactions with the new contract. Multiple calls to DeployBlobstreamContract with the initBridge flag set to true will overwrite everytime the bridge contract.

func (*Client) DeployERC1867Proxy

func (ec *Client) DeployERC1867Proxy(
	opts *bind.TransactOpts,
	backend bind.ContractBackend,
	implementationAddress gethcommon.Address,
	data []byte,
) (gethcommon.Address, *coregethtypes.Transaction, *proxywrapper.Wrappers, error)

func (*Client) NewEthClient

func (ec *Client) NewEthClient() (*ethclient.Client, error)

NewEthClient creates a new Eth client using the existing EVM RPC address. Should be closed after usage.

func (*Client) NewTransactionOpts

func (ec *Client) NewTransactionOpts(ctx context.Context) (*bind.TransactOpts, error)

NewTransactionOpts creates a new transaction Opts to be used when submitting transactions.

func (*Client) StateLastEventNonce

func (ec *Client) StateLastEventNonce(opts *bind.CallOpts) (uint64, error)

func (*Client) StateLastValidatorSetCheckpoint

func (ec *Client) StateLastValidatorSetCheckpoint(opts *bind.CallOpts) ([32]byte, error)

func (*Client) SubmitDataRootTupleRoot

func (ec *Client) SubmitDataRootTupleRoot(
	opts *bind.TransactOpts,
	tupleRoot gethcommon.Hash,
	newNonce uint64,
	currentValset types.Valset,
	sigs []blobstreamwrapper.Signature,
) (*coregethtypes.Transaction, error)

func (*Client) UpdateValidatorSet

func (ec *Client) UpdateValidatorSet(
	opts *bind.TransactOpts,
	newNonce, newThreshHold uint64,
	currentValset, newValset types.Valset,
	sigs []blobstreamwrapper.Signature,
) (*coregethtypes.Transaction, error)

func (*Client) WaitForTransaction

func (ec *Client) WaitForTransaction(
	ctx context.Context,
	backend bind.DeployBackend,
	tx *coregethtypes.Transaction,
	timeout time.Duration,
) (*coregethtypes.Receipt, error)

Jump to

Keyboard shortcuts

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