srv

package
v0.44.0-model Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWaitTimeout = 72 * time.Second
)

Variables

This section is empty.

Functions

func CheckSenderWhitelist

func CheckSenderWhitelist(db *badger.DB,
	whitelistedAddresses []common.Address,
	logger logr.Logger, txHashes *xsync.MapOf[string, OpHashes],
	entrypointAddr common.Address, chainID *big.Int) (modules.BatchHandlerFunc, func() error)

CheckSenderWhitelist is an handler that checks to limit on-chain userops to a set of addresses. These addresses must be initialized on start up and they must be a comma seperated list ERC4337_BUNDLER_ADDRESS_WHITELIST=0xAddress1,0xAddress2 If not provided, this middleware will always act as a no-op

It also returns a function that acts as a clean up operation We do not want to persist whitelisted addresses between restarts They must always come fresh from the env variable

func SimulateTxWithTenderly

func SimulateTxWithTenderly(cfg *conf.Values,
	chainCliet *ethclient.Client,
	logger logr.Logger, txHashes *xsync.MapOf[string, OpHashes],
	entrypointAddr common.Address, chainID *big.Int) modules.BatchHandlerFunc

Types

type OpHashes

type OpHashes struct {
	Solved string
	Trx    common.Hash

	// If this encountered an error earlier
	Error error
}

type Relayer

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

Relayer provides a module that can relay batches with a regular EOA. Relaying batches to the EntryPoint through a regular transaction comes with several important notes:

  • The bundler will NOT be operating as a block builder.
  • This opens the bundler up to frontrunning.

This module only works in the case of a private mempool and will not work in the P2P case where ops are propagated through the network and it is impossible to prevent collisions from multiple bundlers trying to relay the same ops.

func New

func New(
	ep common.Address,
	eoa *signer.EOA,
	eth *ethclient.Client,
	chainID *big.Int,
	beneficiary common.Address,
	l logr.Logger,
) *Relayer

New initializes a new EOA relayer for sending batches to the EntryPoint.

func (*Relayer) GetOpHashes

func (r *Relayer) GetOpHashes() *xsync.MapOf[string, OpHashes]

func (*Relayer) SendUserOperation

func (r *Relayer) SendUserOperation() modules.BatchHandlerFunc

SendUserOperation returns a BatchHandler that is used by the Bundler to send batches in a regular EOA transaction.

func (*Relayer) SetWaitTimeout

func (r *Relayer) SetWaitTimeout(timeout time.Duration)

SetWaitTimeout sets the total time to wait for a transaction to be included. When a timeout is reached, the BatchHandler will throw an error if the transaction has not been included or has been included but with a failed status.

The default value is 30 seconds. Setting the value to 0 will skip waiting for a transaction to be included.

Jump to

Keyboard shortcuts

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