encoding

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

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Evidence
	EvidenceType, _ = abi.NewType("tuple", "TaikoData.BlockEvidence", evidenceComponents)
	EvidenceArgs    = abi.Arguments{{Name: "Evidence", Type: EvidenceType}}
)
View Source
var (
	MxcL1ABI    *abi.ABI
	MxcL2ABI    *abi.ABI
	MxcTokenABI *abi.ABI
	LPWANABI    *abi.ABI
)

Contract ABIs.

View Source
var (
	OracleProverAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")
	SystemProverAddress = common.HexToAddress("0x0000000000000000000000000000000000000001")
)

Functions

func BloomToBytes

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

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

func BytesToBloom

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

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

func EncodeBlockMetadata

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

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

func EncodeBlockMetadataInput

func EncodeBlockMetadataInput(meta *MxcL1BlockMetadataInput) ([]byte, error)

EncodeBlockMetadataInput performs the solidity `abi.encode` for the given blockMetadataInput.

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 *MxcL1Evidence) ([]byte, error)

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

func EncodeProposeBlockInput

func EncodeProposeBlockInput(metadataInput *MxcL1BlockMetadataInput) ([]byte, error)

EncodeProposeBlockInput encodes the input params for MxcL1.proposeBlock.

func EncodeProveBlockInput

func EncodeProveBlockInput(
	evidence *MxcL1Evidence,
) ([]byte, error)

EncodeProveBlockInput encodes the input params for MxcL1.proveBlock.

func EncodeProveBlockInvalidInput

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

EncodeProveBlockInvalidInput encodes the input params for MxcL1.proveBlockInvalid.

func ToExecutableData

func ToExecutableData(header *types.Header) *engine.ExecutableData

ToExecutableData converts a GETH *types.Header to *engine.ExecutableData.

func ToGethHeader

func ToGethHeader(header *BlockHeader) *types.Header

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

func TryParsingCustomError

func TryParsingCustomError(originalError error) error

TryParsingCustomError tries to checks whether the given error is one of the custom errors defined the MxcL1 / MxcL2's ABI, if so, it will return the matched custom error, otherwise, it simply returns the original error.

func UnpackTxListBytes

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

UnpackTxListBytes unpacks the input data of a MxcL1.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.

type MxcL1BlockMetadataInput

type MxcL1BlockMetadataInput struct {
	TxListHash      [32]byte
	Beneficiary     common.Address
	GasLimit        uint32
	TxListByteStart *big.Int
	TxListByteEnd   *big.Int
	CacheTxListInfo uint8
}

type MxcL1Evidence

type MxcL1Evidence struct {
	MetaHash      [32]byte
	BlockHash     [32]byte
	ParentHash    [32]byte
	SignalRoot    [32]byte
	Graffiti      [32]byte
	Prover        common.Address
	ParentGasUsed uint32
	GasUsed       uint32
	VerifierId    uint16
	Proof         []byte
}

Jump to

Keyboard shortcuts

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