producer

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContestRequestBody added in v0.20.0

type ContestRequestBody struct {
	BlockID    *big.Int
	ProposedIn *big.Int
	ParentHash common.Hash
	Meta       *bindings.TaikoDataBlockMetadata
	Tier       uint16
}

ContestRequestBody represents a request body to generate a proof for contesting.

type DummyProofProducer

type DummyProofProducer struct{}

DummyProofProducer always returns a dummy proof.

func (*DummyProofProducer) RequestProof

func (o *DummyProofProducer) RequestProof(
	opts *ProofRequestOptions,
	blockID *big.Int,
	meta *bindings.TaikoDataBlockMetadata,
	header *types.Header,
	tier uint16,
) (*ProofWithHeader, error)

RequestProof returns a dummy proof to the result channel.

type GuardianProofProducer added in v0.17.0

type GuardianProofProducer struct {
	DummyProofProducer
	// contains filtered or unexported fields
}

GuardianProofProducer always returns an optimistic (dummy) proof.

func NewGuardianProofProducer added in v0.19.0

func NewGuardianProofProducer(returnLivenessBond bool) *GuardianProofProducer

func (*GuardianProofProducer) RequestProof added in v0.17.0

RequestProof implements the ProofProducer interface.

func (*GuardianProofProducer) Tier added in v0.17.0

func (g *GuardianProofProducer) Tier() uint16

Tier implements the ProofProducer interface.

type OptimisticProofProducer added in v0.17.0

type OptimisticProofProducer struct{ DummyProofProducer }

OptimisticProofProducer always returns an optimistic (dummy) proof.

func (*OptimisticProofProducer) RequestProof added in v0.17.0

RequestProof implements the ProofProducer interface.

func (*OptimisticProofProducer) Tier added in v0.17.0

func (o *OptimisticProofProducer) Tier() uint16

Tier implements the ProofProducer interface.

type ProofParam added in v0.21.0

type ProofParam struct {
	Setup     bool `json:"setup"`
	Bootstrap bool `json:"bootstrap"`
	Prove     bool `json:"prove"`
}

ProofParam represents the JSON body of SGXRequestProofBodyParam's `sgx` field.

type ProofProducer

type ProofProducer interface {
	RequestProof(
		ctx context.Context,
		opts *ProofRequestOptions,
		blockID *big.Int,
		meta *bindings.TaikoDataBlockMetadata,
		header *types.Header,
	) (*ProofWithHeader, error)
	Tier() uint16
}

type ProofRequestBody added in v0.20.0

type ProofRequestBody struct {
	Tier  uint16
	Event *bindings.TaikoL1ClientBlockProposed
}

ProofRequestBody represents a request body to generate a proof.

type ProofRequestOptions

type ProofRequestOptions struct {
	BlockID            *big.Int
	ProverAddress      common.Address
	ProposeBlockTxHash common.Hash
	TaikoL2            common.Address
	MetaHash           common.Hash
	BlockHash          common.Hash
	ParentHash         common.Hash
	StateRoot          common.Hash
	EventL1Hash        common.Hash
	Graffiti           string
	GasUsed            uint64
	ParentGasUsed      uint64
}

ProofRequestOptions contains all options that need to be passed to a backend proof producer service.

type ProofWithHeader

type ProofWithHeader struct {
	BlockID *big.Int
	Meta    *bindings.TaikoDataBlockMetadata
	Header  *types.Header
	Proof   []byte
	Opts    *ProofRequestOptions
	Tier    uint16
}

type RaikoHostOutput added in v0.19.0

type RaikoHostOutput struct {
	Proof string `json:"proof"`
}

RaikoHostOutput represents the JSON body of SGXRequestProofBodyResponse's `result` field.

type SGXProofProducer added in v0.17.0

type SGXProofProducer struct {
	RaikoHostEndpoint string // a proverd RPC endpoint
	L1Endpoint        string // a L1 node RPC endpoint
	L1BeaconEndpoint  string // a L1 beacon node RPC endpoint
	L2Endpoint        string // a L2 execution engine's RPC endpoint
	Dummy             bool
	DummyProofProducer
}

SGXProofProducer generates a SGX proof for the given block.

func (*SGXProofProducer) RequestProof added in v0.17.0

func (s *SGXProofProducer) RequestProof(
	ctx context.Context,
	opts *ProofRequestOptions,
	blockID *big.Int,
	meta *bindings.TaikoDataBlockMetadata,
	header *types.Header,
) (*ProofWithHeader, error)

RequestProof implements the ProofProducer interface.

func (*SGXProofProducer) Tier added in v0.17.0

func (s *SGXProofProducer) Tier() uint16

Tier implements the ProofProducer interface.

type SGXRequestProofBody added in v0.19.0

type SGXRequestProofBody struct {
	JsonRPC string                      `json:"jsonrpc"` //nolint:revive,stylecheck
	ID      *big.Int                    `json:"id"`
	Method  string                      `json:"method"`
	Params  []*SGXRequestProofBodyParam `json:"params"`
}

SGXRequestProofBody represents the JSON body for requesting the proof.

type SGXRequestProofBodyParam added in v0.19.0

type SGXRequestProofBodyParam struct {
	Type        string      `json:"proof_type"`
	Block       *big.Int    `json:"block_number"`
	L2RPC       string      `json:"rpc"`
	L1RPC       string      `json:"l1_rpc"`
	L1BeaconRPC string      `json:"beacon_rpc"`
	Prover      string      `json:"prover"`
	Graffiti    string      `json:"graffiti"`
	ProofParam  *ProofParam `json:"sgx"`
}

SGXRequestProofBodyParam represents the JSON body of RequestProofBody's `param` field.

type SGXRequestProofBodyResponse added in v0.19.0

type SGXRequestProofBodyResponse struct {
	JsonRPC string           `json:"jsonrpc"` //nolint:revive,stylecheck
	ID      *big.Int         `json:"id"`
	Result  *RaikoHostOutput `json:"result"`
	Error   *struct {
		Code    *big.Int `json:"code"`
		Message string   `json:"message"`
	} `json:"error,omitempty"`
}

SGXRequestProofBodyResponse represents the JSON body of the response of the proof requests.

Jump to

Keyboard shortcuts

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