encoding

package
v0.3.1-0...-684a909 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaikoL1ABI          *abi.ABI
	TaikoL2ABI          *abi.ABI
	TaikoTokenABI       *abi.ABI
	GuardianProverABI   *abi.ABI
	LibProposingABI     *abi.ABI
	LibProvingABI       *abi.ABI
	LibUtilsABI         *abi.ABI
	LibVerifyingABI     *abi.ABI
	SGXVerifierABI      *abi.ABI
	GuardianVerifierABI *abi.ABI
	ProverSetABI        *abi.ABI
)

Contract ABIs.

View Source
var (
	InternlDevnetProtocolConfig = &bindings.TaikoDataConfig{
		ChainId:               params.TaikoInternalL2ANetworkID.Uint64(),
		BlockMaxProposals:     324_000,
		BlockRingBufferSize:   360_000,
		MaxBlocksToVerify:     16,
		BlockMaxGasLimit:      240_000_000,
		LivenessBond:          livenessBond,
		StateRootSyncInternal: 16,
		MaxAnchorHeightOffset: 64,
		OntakeForkHeight:      2,
		BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{
			AdjustmentQuotient:     8,
			SharingPctg:            75,
			GasIssuancePerSecond:   5_000_000,
			MinGasExcess:           1_340_000_000,
			MaxGasIssuancePerBlock: 600_000_000,
		},
	}
	HeklaProtocolConfig = &bindings.TaikoDataConfig{
		ChainId:               params.HeklaNetworkID.Uint64(),
		BlockMaxProposals:     324_000,
		BlockRingBufferSize:   324_512,
		MaxBlocksToVerify:     16,
		BlockMaxGasLimit:      240_000_000,
		LivenessBond:          livenessBond,
		StateRootSyncInternal: 16,
		MaxAnchorHeightOffset: 64,
		OntakeForkHeight:      840_512,
		BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{
			AdjustmentQuotient:     8,
			SharingPctg:            75,
			GasIssuancePerSecond:   5_000_000,
			MinGasExcess:           1_340_000_000,
			MaxGasIssuancePerBlock: 600_000_000,
		},
	}
	MainnetProtocolConfig = &bindings.TaikoDataConfig{
		ChainId:               params.TaikoMainnetNetworkID.Uint64(),
		BlockMaxProposals:     324_000,
		BlockRingBufferSize:   360_000,
		MaxBlocksToVerify:     16,
		BlockMaxGasLimit:      240_000_000,
		LivenessBond:          livenessBond,
		StateRootSyncInternal: 16,
		MaxAnchorHeightOffset: 64,
		OntakeForkHeight:      538_304,
		BaseFeeConfig: bindings.LibSharedDataBaseFeeConfig{
			AdjustmentQuotient:     8,
			GasIssuancePerSecond:   5_000_000,
			MinGasExcess:           1_340_000_000,
			MaxGasIssuancePerBlock: 600_000_000,
		},
	}
)
View Source
var (
	TierOptimisticID       uint16 = 100
	TierSgxID              uint16 = 200
	TierZkVMRisc0ID        uint16 = 250
	TierZkVMSp1ID          uint16 = 251
	TierSgxAndZkVMID       uint16 = 300
	TierGuardianMinorityID uint16 = 900
	TierGuardianMajorityID uint16 = 1000
	GoldenTouchPrivKey            = "92954368afd3caa1f3ce3ead0069c1af414054aefe1ef9aeacc1bf426222ce38"
)

Tier IDs defined in protocol.

Functions

func BlockVerifiedEventToV2

BlockVerifiedEventToV2 converts a *bindings.TaikoL1ClientBlockVerified to *bindings.TaikoL1ClientBlockVerifiedV2.

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 EncodeBlockParams

func EncodeBlockParams(params *BlockParams) ([]byte, error)

EncodeBlockParams performs the solidity `abi.encode` for the given blockParams.

func EncodeBlockParamsOntake

func EncodeBlockParamsOntake(params *BlockParamsV2) ([]byte, error)

EncodeBlockParamsOntake performs the solidity `abi.encode` for the given ontake blockParams.

func EncodeProveBlockInput

func EncodeProveBlockInput(
	meta metadata.TaikoBlockMetaData,
	transition *bindings.TaikoDataTransition,
	tierProof *bindings.TaikoDataTierProof,
) ([]byte, error)

EncodeProveBlockInput performs the solidity `abi.encode` for the given TaikoL1.proveBlock input.

func GetProtocolConfig

func GetProtocolConfig(chainID uint64) *bindings.TaikoDataConfig

GetProtocolConfig returns the protocol config for the given chain ID.

func TaikoDataBlockToV2

func TaikoDataBlockToV2(b *bindings.TaikoDataBlock) *bindings.TaikoDataBlockV2

BlockVerifiedEventToV2 converts a *bindings.TaikoDataBlock to *bindings.TaikoDataBlockV2.

func ToExecutableData

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

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

func TransitionContestedEventToV2

func TransitionContestedEventToV2(
	e *bindings.TaikoL1ClientTransitionContested,
	proposedIn uint64,
) *bindings.TaikoL1ClientTransitionContestedV2

TransitionContestedEventToV2 converts a *bindings.TaikoL1ClientTransitionContested to *bindings.TaikoL1ClientTransitionContestedV2.

func TransitionProvedEventToV2

func TransitionProvedEventToV2(
	e *bindings.TaikoL1ClientTransitionProved,
	proposedIn uint64,
) *bindings.TaikoL1ClientTransitionProvedV2

TransitionProvedEventToV2 converts a *bindings.TaikoL1ClientTransitionProved to *bindings.TaikoL1ClientTransitionProvedV2.

func TryParsingCustomError

func TryParsingCustomError(originalError error) error

TryParsingCustomError tries to checks whether the given error is one of the custom errors defined the protocol ABIs, if so, it will return the matched custom error, otherwise, it simply returns the original error.

func TryParsingCustomErrorFromReceipt

func TryParsingCustomErrorFromReceipt(
	ctx context.Context,
	rpc BlockHashContractCallerAndChainReader,
	from common.Address,
	receipt *types.Receipt,
) error

TryParsingCustomErrorFromReceipt tries to parse the custom error from the given receipt.

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 BlockHashContractCallerAndChainReader

type BlockHashContractCallerAndChainReader interface {
	bind.BlockHashContractCaller
	ethereum.TransactionReader
	ethereum.ChainReader
}

BlockHashContractCallerAndChainReader represents a contract caller and chain reader.

type BlockParams

type BlockParams struct {
	AssignedProver common.Address
	Coinbase       common.Address
	ExtraData      [32]byte
	ParentMetaHash [32]byte
	HookCalls      []HookCall
	Signature      []byte
}

BlockParams should be same with TaikoData.BlockParams.

type BlockParamsV2

type BlockParamsV2 struct {
	Proposer         common.Address
	Coinbase         common.Address
	ParentMetaHash   [32]byte
	AnchorBlockId    uint64
	Timestamp        uint64
	BlobTxListOffset uint32
	BlobTxListLength uint32
	BlobIndex        uint8
}

BlockParamsV2 should be same with TaikoData.BlockParamsV2.

type HookCall

type HookCall struct {
	Hook common.Address
	Data []byte
}

HookCall should be same with TaikoData.HookCall

type TierFee

type TierFee struct {
	Tier uint16
	Fee  *big.Int
}

TierFee should be same with TaikoData.TierFee.

Jump to

Keyboard shortcuts

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