proof

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: LGPL-2.1 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BEACON_STATE_GINDEX              = 11
	RECEIPTS_ROOT_GINDEX             = 6435
	BLOCK_ROOTS_GINDEX         int64 = 37
	SLOTS_PER_HISTORICAL_LIMIT       = 8192
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconClient

type BeaconClient interface {
	BeaconBlockHeader(
		ctx context.Context,
		opts *api.BeaconBlockHeaderOpts,
	) (
		*api.Response[*apiv1.BeaconBlockHeader],
		error,
	)
	BeaconState(
		ctx context.Context,
		opts *api.BeaconStateOpts,
	) (
		*api.Response[*spec.VersionedBeaconState],
		error,
	)
	SignedBeaconBlock(ctx context.Context,
		opts *api.SignedBeaconBlockOpts,
	) (
		*api.Response[*spec.VersionedSignedBeaconBlock],
		error,
	)
}

type ReceiptProver

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

func NewReceiptProver

func NewReceiptProver(txFetcher TransactionFetcher) *ReceiptProver

func (*ReceiptProver) ReceiptProof

func (p *ReceiptProver) ReceiptProof(txHash common.Hash) ([][]byte, error)

ReceiptProof calculates the Ethereum receipt proof for the specified transaction hash. The root hash of the proof is the block `receiptRoof` field.

type ReceiptRootProver

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

func NewReceiptRootProver

func NewReceiptRootProver(beaconClient BeaconClient, spec config.Spec) *ReceiptRootProver

func (*ReceiptRootProver) ReceiptsRootProof

func (p *ReceiptRootProver) ReceiptsRootProof(ctx context.Context, currentSlot *big.Int, targetSlot *big.Int) ([][]byte, error)

ReceiptRootProof returns the prove from the beacon block root to the receipt roof of the given slot. The path for the proof is beacon block -> beacon state -> block roots -> execution payload header -> receipt root.

type TransactionFetcher

type TransactionFetcher interface {
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
}

Jump to

Keyboard shortcuts

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