submitter

package
v0.0.0-...-43163d8 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProofTimeout    = 3 * time.Hour
	ErrInvalidProof = errors.New("invalid proof found")
)

Functions

This section is empty.

Types

type Contester

type Contester interface {
	SubmitContest(
		ctx context.Context,
		blockID *big.Int,
		proposedIn *big.Int,
		parentHash common.Hash,
		meta metadata.TaikoBlockMetaData,
		tier uint16,
	) error
}

Contester is the interface for contesting proofs of the L2 blocks.

type ProofBuffer

type ProofBuffer struct {
	MaxLength uint64
	// contains filtered or unexported fields
}

ProofBuffer caches all single proof with a fixed size.

func NewProofBuffer

func NewProofBuffer(maxLength uint64) *ProofBuffer

NewProofBuffer creates a new ProofBuffer instance.

func (*ProofBuffer) ClearItems

func (pb *ProofBuffer) ClearItems(blockIDs ...uint64) int

ClearItems clears items that has given block ids in the buffer.

func (*ProofBuffer) Enabled

func (pb *ProofBuffer) Enabled() bool

Enabled returns if the buffer is enabled.

func (*ProofBuffer) IsAggregating

func (pb *ProofBuffer) IsAggregating() bool

IsAggregating returns if the proofs in this buffer are aggregating.

func (*ProofBuffer) LastUpdatedAt

func (pb *ProofBuffer) LastUpdatedAt() time.Time

LastUpdatedAt returns the last updated time of the buffer.

func (*ProofBuffer) Len

func (pb *ProofBuffer) Len() int

Len returns current length of the buffer.

func (*ProofBuffer) MarkAggregating

func (pb *ProofBuffer) MarkAggregating()

MarkAggregating marks the proofs in this buffer are aggregating.

func (*ProofBuffer) Read

func (pb *ProofBuffer) Read(length int) ([]*producer.ProofWithHeader, error)

Read returns the content with given length in the buffer.

func (*ProofBuffer) ReadAll

func (pb *ProofBuffer) ReadAll() ([]*producer.ProofWithHeader, error)

ReadAll returns all the content in the buffer.

func (*ProofBuffer) UpdateLastUpdatedAt

func (pb *ProofBuffer) UpdateLastUpdatedAt()

LastUpdatedAt returns the last updated time of the buffer.

func (*ProofBuffer) Write

func (pb *ProofBuffer) Write(item *producer.ProofWithHeader) (int, error)

Write adds new item to the buffer.

type ProofContester

type ProofContester struct {
	// contains filtered or unexported fields
}

ProofContester is responsible for contesting wrong L2 transitions.

func NewProofContester

func NewProofContester(
	rpcClient *rpc.Client,
	gasLimit uint64,
	txmgr *txmgr.SimpleTxManager,
	privateTxmgr *txmgr.SimpleTxManager,
	proverSetAddress common.Address,
	graffiti string,
	builder *transaction.ProveBlockTxBuilder,
) *ProofContester

NewProofContester creates a new ProofContester instance.

func (*ProofContester) SubmitContest

func (c *ProofContester) SubmitContest(
	ctx context.Context,
	blockID *big.Int,
	proposedIn *big.Int,
	parentHash common.Hash,
	meta metadata.TaikoBlockMetaData,
	tier uint16,
) error

SubmitContest submits a TaikoL1.proveBlock transaction to contest a L2 block transition.

type ProofSubmitter

type ProofSubmitter struct {
	// contains filtered or unexported fields
}

ProofSubmitter is responsible requesting proofs for the given L2 blocks, and submitting the generated proofs to the TaikoL1 smart contract.

func NewProofSubmitter

func NewProofSubmitter(
	rpcClient *rpc.Client,
	proofProducer proofProducer.ProofProducer,
	resultCh chan *proofProducer.ProofWithHeader,
	batchResultCh chan *proofProducer.BatchProofs,
	aggregationNotify chan uint16,
	proverSetAddress common.Address,
	taikoL2Address common.Address,
	graffiti string,
	gasLimit uint64,
	txmgr *txmgr.SimpleTxManager,
	privateTxmgr *txmgr.SimpleTxManager,
	builder *transaction.ProveBlockTxBuilder,
	tiers []*rpc.TierProviderTierWithID,
	isGuardian bool,
	submissionDelay time.Duration,
	proofBufferSize uint64,
	forceBatchProvingInterval time.Duration,
) (*ProofSubmitter, error)

NewProofSubmitter creates a new ProofSubmitter instance.

func (*ProofSubmitter) AggregateProofs

func (s *ProofSubmitter) AggregateProofs(ctx context.Context) error

AggregateProofs read all data from buffer and aggregate them.

func (*ProofSubmitter) AggregationEnabled

func (s *ProofSubmitter) AggregationEnabled() bool

AggregationEnabled returns whether the proof submitter's aggregation feature is enabled.

func (*ProofSubmitter) BatchSubmitProofs

func (s *ProofSubmitter) BatchSubmitProofs(ctx context.Context, batchProof *proofProducer.BatchProofs) error

BatchSubmitProofs implements the Submitter interface to submit proof aggregation.

func (*ProofSubmitter) BufferSize

func (s *ProofSubmitter) BufferSize() uint64

BufferSize returns the size of the proof buffer.

func (*ProofSubmitter) Producer

Producer returns the inner proof producer.

func (*ProofSubmitter) RequestProof

func (s *ProofSubmitter) RequestProof(ctx context.Context, meta metadata.TaikoBlockMetaData) error

RequestProof implements the Submitter interface.

func (*ProofSubmitter) SubmitProof

func (s *ProofSubmitter) SubmitProof(
	ctx context.Context,
	proofWithHeader *proofProducer.ProofWithHeader,
) (err error)

SubmitProof implements the Submitter interface.

func (*ProofSubmitter) Tier

func (s *ProofSubmitter) Tier() uint16

Tier returns the proof tier of the current proof submitter.

type Submitter

type Submitter interface {
	RequestProof(ctx context.Context, meta metadata.TaikoBlockMetaData) error
	SubmitProof(ctx context.Context, proofWithHeader *proofProducer.ProofWithHeader) error
	BatchSubmitProofs(ctx context.Context, proofsWithHeaders *proofProducer.BatchProofs) error
	AggregateProofs(ctx context.Context) error
	Producer() proofProducer.ProofProducer
	Tier() uint16
	BufferSize() uint64
	AggregationEnabled() bool
}

Submitter is the interface for submitting proofs of the L2 blocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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