blocks

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompletionChecker = BlockHandlerFunc(
	func(ctx context.Context, node devnet.Node, block *requests.Block, transaction *jsonrpc.RPCTransaction) error {
		traceResults, err := node.TraceTransaction(transaction.Hash)

		if err != nil {
			return fmt.Errorf("Failed to trace transaction: %s: %w", transaction.Hash, err)
		}

		for _, traceResult := range traceResults {
			if traceResult.TransactionHash == transaction.Hash {
				if len(traceResult.Error) != 0 {
					return fmt.Errorf("Transaction error: %s", traceResult.Error)
				}

				break
			}
		}

		return nil
	})

Functions

func BaseFeeFromBlock

func BaseFeeFromBlock(ctx context.Context) (uint64, error)

func GenerateBlocks

func GenerateBlocks(t *testing.T, gspec *types.Genesis, blocks int, txs map[int]TxGen, txPerBlock func(int) int) (*mock.MockSentry, *core.ChainPack, error)

Types

type BlockHandler

type BlockHandler interface {
	Handle(ctx context.Context, node devnet.Node, block *requests.Block, transaction *jsonrpc.RPCTransaction) error
}

type BlockHandlerFunc

type BlockHandlerFunc func(ctx context.Context, node devnet.Node, block *requests.Block, transaction *jsonrpc.RPCTransaction) error

func (BlockHandlerFunc) Handle

func (f BlockHandlerFunc) Handle(ctx context.Context, node devnet.Node, block *requests.Block, transaction *jsonrpc.RPCTransaction) error

type BlockMap

type BlockMap map[libcommon.Hash]*requests.Block

type TxFn

type TxFn func(_ *core.BlockGen, backend bind.ContractBackend) (types.Transaction, bool)

type TxGen

type TxGen struct {
	Fn  TxFn
	Key *ecdsa.PrivateKey
}

type Waiter

type Waiter interface {
	Await(libcommon.Hash) (*requests.Block, error)
	AwaitMany(...libcommon.Hash) (BlockMap, error)
}

func BlockWaiter

func BlockWaiter(ctx context.Context, handler BlockHandler) (Waiter, context.CancelFunc)

Jump to

Keyboard shortcuts

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