producer

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CircuitsIdx = 0 // Currently we only have one verification contract in protocol.
)

Variables

This section is empty.

Functions

func DegreeToCircuitsIdx added in v0.5.0

func DegreeToCircuitsIdx(degree uint64) (uint16, error)

Types

type DummyProofProducer

type DummyProofProducer struct {
	RandomDummyProofDelayLowerBound *time.Duration
	RandomDummyProofDelayUpperBound *time.Duration
}

DummyProofProducer always returns a dummy proof.

func (*DummyProofProducer) Cancel added in v0.8.0

func (d *DummyProofProducer) Cancel(ctx context.Context, blockID *big.Int) error

Cancel cancels an existing proof generation.

func (*DummyProofProducer) RequestProof

func (d *DummyProofProducer) RequestProof(
	ctx context.Context,
	opts *ProofRequestOptions,
	blockID *big.Int,
	meta *bindings.TaikoDataBlockMetadata,
	header *types.Header,
	resultCh chan *ProofWithHeader,
) error

RequestProof implements the ProofProducer interface.

type ProofProducer

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

type ProofRequestOptions

type ProofRequestOptions struct {
	Height             *big.Int // the block number
	ProverAddress      common.Address
	ProposeBlockTxHash common.Hash
	L1SignalService    common.Address
	L2SignalService    common.Address
	TaikoL2            common.Address
	MetaHash           common.Hash
	BlockHash          common.Hash
	ParentHash         common.Hash
	SignalRoot         common.Hash
	EventL1Hash        common.Hash
	Graffiti           string
	GasUsed            uint64
	ParentGasUsed      uint64
}

ProofRequestOptions contains all options that need to be passed to zkEVM rpcd service.

type ProofWithHeader

type ProofWithHeader struct {
	BlockID *big.Int
	Meta    *bindings.TaikoDataBlockMetadata
	Header  *types.Header
	ZkProof []byte
	Degree  uint64
	Opts    *ProofRequestOptions
}

type ProtocolInstance added in v0.12.0

type ProtocolInstance struct {
	L1SignalService         string `json:"l1_signal_service"`
	L2SignalService         string `json:"l2_signal_service"`
	TaikoL2                 string `json:"l2_contract"`
	MetaHash                string `json:"meta_hash"`
	BlockHash               string `json:"block_hash"`
	ParentHash              string `json:"parent_hash"`
	SignalRoot              string `json:"signal_root"`
	Graffiti                string `json:"graffiti"`
	Prover                  string `json:"prover"`
	GasUsed                 uint64 `json:"gas_used"`
	ParentGasUsed           uint64 `json:"parent_gas_used"`
	BlockMaxGasLimit        uint64 `json:"block_max_gas_limit"`
	MaxTransactionsPerBlock uint64 `json:"max_transactions_per_block"`
	MaxBytesPerTxList       uint64 `json:"max_bytes_per_tx_list"`
}

RequestProofBody represents the JSON body of RequestProofBody.Param's `protocol_instance` field.

type ProverCmdOutput added in v0.3.0

type ProverCmdOutput struct {
	Instances []string `json:"instances"`
	Proof     []byte   `json:"proof"`
}

type RequestProofBody added in v0.3.0

type RequestProofBody struct {
	JsonRPC string                   `json:"jsonrpc"`
	ID      *big.Int                 `json:"id"`
	Method  string                   `json:"method"`
	Params  []*RequestProofBodyParam `json:"params"`
}

RequestProofBody represents the JSON body for requesting the proof.

type RequestProofBodyParam added in v0.3.0

type RequestProofBodyParam struct {
	Circuit          string            `json:"circuit"`
	Block            *big.Int          `json:"block"`
	L2RPC            string            `json:"rpc"`
	Retry            bool              `json:"retry"`
	Param            string            `json:"param"`
	VerifyProof      bool              `json:"verify_proof"`
	Mock             bool              `json:"mock"`
	MockFeedback     bool              `json:"mock_feedback"`
	Aggregate        bool              `json:"aggregate"`
	ProtocolInstance *ProtocolInstance `json:"protocol_instance"`
}

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

type RequestProofBodyResponse added in v0.3.0

type RequestProofBodyResponse struct {
	JsonRPC string      `json:"jsonrpc"`
	ID      *big.Int    `json:"id"`
	Result  *RpcdOutput `json:"result"`
	Error   *struct {
		Code    *big.Int `json:"code"`
		Message string   `json:"message"`
	} `json:"error,omitempty"`
}

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

type RpcdOutput added in v0.3.0

type RpcdOutput struct {
	Circuit struct {
		Instances []string `json:"instance"`
		Proof     string   `json:"proof"`
		Degree    uint64   `json:"k"`
	} `json:"circuit"`
	Aggregation struct {
		Instances []string `json:"instance"`
		Proof     string   `json:"proof"`
		Degree    uint64   `json:"k"`
	} `json:"aggregation"`
}

RpcdOutput represents the JSON body of RequestProofBodyResponse's `result` field.

type ZkevmCmdProducer added in v0.3.0

type ZkevmCmdProducer struct {
	CmdPath    string
	L2Endpoint string // a L2 execution engine's RPC endpoint
}

ZkevmCmdProducer is responsible for generating zk proofs from the given command line binary file.

func NewZkevmCmdProducer added in v0.3.0

func NewZkevmCmdProducer(
	cmdPath string,
	l2Endpoint string,
) (*ZkevmCmdProducer, error)

NewZkevmCmdProducer creates a new NewZkevmCmdProducer instance.

func (*ZkevmCmdProducer) Cancel added in v0.8.0

func (p *ZkevmCmdProducer) Cancel(ctx context.Context, blockID *big.Int) error

Cancel cancels an existing proof generation. Right now, it is just a stub that does nothing, because it is not possible to cnacel the proof with the current zkevm software.

func (*ZkevmCmdProducer) ExecProverCmd added in v0.3.0

func (p *ZkevmCmdProducer) ExecProverCmd(height *big.Int) ([]byte, error)

func (*ZkevmCmdProducer) RequestProof added in v0.3.0

func (p *ZkevmCmdProducer) RequestProof(
	ctx context.Context,
	opts *ProofRequestOptions,
	blockID *big.Int,
	meta *bindings.TaikoDataBlockMetadata,
	header *types.Header,
	resultCh chan *ProofWithHeader,
) error

RequestProof implements the ProofProducer interface.

type ZkevmRpcdProducer

type ZkevmRpcdProducer struct {
	RpcdEndpoint    string                         // a proverd RPC endpoint
	Param           string                         // parameter file to use
	L1Endpoint      string                         // a L1 node RPC endpoint
	L2Endpoint      string                         // a L2 execution engine's RPC endpoint
	Retry           bool                           // retry proof computation if error
	CustomProofHook func() ([]byte, uint64, error) // only for testing purposes
	ProofTimeTarget uint64                         // used for calculating proof delay
	ProtocolConfig  *bindings.TaikoDataConfig      // protocol configurations
}

ZkevmRpcdProducer is responsible for requesting zk proofs from the given proverd endpoint.

func NewZkevmRpcdProducer

func NewZkevmRpcdProducer(
	rpcdEndpoint string,
	param string,
	l1Endpoint string,
	l2Endpoint string,
	retry bool,
	protocolConfig *bindings.TaikoDataConfig,
) (*ZkevmRpcdProducer, error)

NewZkevmRpcdProducer creates a new `ZkevmRpcdProducer` instance.

func (*ZkevmRpcdProducer) Cancel added in v0.8.0

func (p *ZkevmRpcdProducer) Cancel(ctx context.Context, blockID *big.Int) error

Cancel cancels an existing proof generation. Right now, it is just a stub that does nothing, because it is not possible to cancel the proof with the current zkevm software.

func (*ZkevmRpcdProducer) RequestProof

func (p *ZkevmRpcdProducer) RequestProof(
	ctx context.Context,
	opts *ProofRequestOptions,
	blockID *big.Int,
	meta *bindings.TaikoDataBlockMetadata,
	header *types.Header,
	resultCh chan *ProofWithHeader,
) error

RequestProof implements the ProofProducer interface.

Jump to

Keyboard shortcuts

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