encoding

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Evidence
	EvidenceType, _ = abi.NewType("tuple", "V1Proving.Evidence", evidenceComponents)
	EvidenceArgs    = abi.Arguments{{Name: "Evidence", Type: EvidenceType}}
)
View Source
var (
	TaikoL1ABI *abi.ABI
	TaikoL2ABI *abi.ABI
)

Contract ABIs.

Functions

func BloomToBytes

func BloomToBytes(bloom types.Bloom) [8][32]byte

BloomToBytes converts a types.Bloom to [8][32]byte slice.

func BytesToBloom added in v0.1.5

func BytesToBloom(b [8][32]byte) types.Bloom

BytesToBloom converts a [8][32]byte slice to types.Bloom.

func EncodeBlockMetadata

func EncodeBlockMetadata(meta *bindings.LibDataBlockMetadata) ([]byte, error)

EncodeBlockMetadata performs the solidity `abi.encode` for the given blockMetadata.

func EncodeCommitHash

func EncodeCommitHash(beneficiary common.Address, txListHash [32]byte) []byte

EncodeCommitHash performs the solidity `abi.encodePacked` for the given commitHash components.

func EncodeEvidence

func EncodeEvidence(e *TaikoL1Evidence) ([]byte, error)

EncodeEvidence performs the solidity `abi.encode` for the given evidence.

func EncodeProposeBlockInput

func EncodeProposeBlockInput(meta *bindings.LibDataBlockMetadata, txListBytes []byte) ([][]byte, error)

EncodeProposeBlockInput encodes the input params for TaikoL1.proposeBlock.

func EncodeProveBlockInput

func EncodeProveBlockInput(
	evidence *TaikoL1Evidence,
	anchorTx *types.Transaction,
	anchorReceipt *types.Receipt,
) ([][]byte, error)

EncodeProveBlockInput encodes the input params for TaikoL1.proveBlock.

func EncodeProveBlockInvalidInput

func EncodeProveBlockInvalidInput(
	evidence *TaikoL1Evidence,
	target *bindings.LibDataBlockMetadata,
	receipt *types.Receipt,
) ([][]byte, error)

EncodeProveBlockInvalidInput encodes the input params for TaikoL1.proveBlockInvalid.

func ToExecutableDataV1 added in v0.1.5

func ToExecutableDataV1(header *types.Header) *beacon.ExecutableDataV1

ToExecutableDataV1 converts a GETH *types.Header to *beacon.ExecutableDataV1.

func ToGethHeader added in v0.1.5

func ToGethHeader(header *BlockHeader) *types.Header

ToGethHeader converts a *BlockHeader to GETH *types.Header.

func UnpackTxListBytes

func UnpackTxListBytes(txData []byte) ([]byte, error)

UnpackTxListBytes unpacks the input data of a TaikoL1.proposeBlock transaction, and returns the txList bytes.

Types

type BlockHeader

type BlockHeader struct {
	ParentHash       [32]byte
	OmmersHash       [32]byte
	Beneficiary      common.Address
	StateRoot        [32]byte
	TransactionsRoot [32]byte
	ReceiptsRoot     [32]byte
	LogsBloom        [8][32]byte
	Difficulty       *big.Int
	Height           *big.Int
	GasLimit         uint64
	GasUsed          uint64
	Timestamp        uint64
	ExtraData        []byte
	MixHash          [32]byte
	Nonce            uint64
	BaseFeePerGas    *big.Int
}

func FromGethHeader

func FromGethHeader(header *types.Header) *BlockHeader

FromGethHeader converts a GETH *types.Header to *BlockHeader.

func UnpackEvidenceHeader added in v0.1.5

func UnpackEvidenceHeader(txData []byte) (*BlockHeader, error)

UnpackEvidenceHeader unpacks the evidence data of a TaikoL1.proveBlock transaction, and returns the block header inside.

type TaikoL1Evidence

type TaikoL1Evidence struct {
	Meta   bindings.LibDataBlockMetadata
	Header BlockHeader
	Prover common.Address
	Proofs [][]byte
}

Jump to

Keyboard shortcuts

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