Documentation ¶
Index ¶
- Variables
- func NewSyncTrustedBatchExecutorForEtrog(zkEVMClient syncinterfaces.ZKEVMClientTrustedBatchesGetter, ...) *l2_shared.TrustedBatchesRetrieve
- type CheckSyncStatusToProcessBatch
- type L1SyncChecker
- type StateGERInteface
- type StateInterface
- type SyncTrustedBatchExecutorForEtrog
- func (b *SyncTrustedBatchExecutorForEtrog) FullProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
- func (b *SyncTrustedBatchExecutorForEtrog) IncrementalProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
- func (b *SyncTrustedBatchExecutorForEtrog) NothingProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
- func (b *SyncTrustedBatchExecutorForEtrog) ReProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented is returned when a method is not implemented ErrNotImplemented = errors.New("not implemented") // ErrBatchDataIsNotIncremental is returned when the new batch has different data than the one in node and is not possible to sync ErrBatchDataIsNotIncremental = errors.New("the new batch has different data than the one in node") // ErrFailExecuteBatch is returned when the batch is not executed correctly ErrFailExecuteBatch = errors.New("fail execute batch") // ErrNotExpectedBathResult is returned when the batch result is not the expected (must match Trusted) ErrNotExpectedBathResult = errors.New("not expected batch result (differ from Trusted Batch)") )
Functions ¶
func NewSyncTrustedBatchExecutorForEtrog ¶
func NewSyncTrustedBatchExecutorForEtrog(zkEVMClient syncinterfaces.ZKEVMClientTrustedBatchesGetter, state l2_shared.StateInterface, stateBatchExecutor StateInterface, sync syncinterfaces.SynchronizerFlushIDManager, timeProvider syncCommon.TimeProvider, l1SyncChecker L1SyncChecker) *l2_shared.TrustedBatchesRetrieve
NewSyncTrustedBatchExecutorForEtrog creates a new prcessor for sync with L2 batches
Types ¶
type CheckSyncStatusToProcessBatch ¶
type CheckSyncStatusToProcessBatch struct {
// contains filtered or unexported fields
}
CheckSyncStatusToProcessBatch Implements CheckSyncStatusToProcessBatchInterface
func NewCheckSyncStatusToProcessBatch ¶
func NewCheckSyncStatusToProcessBatch(zkevmRPCClient syncinterfaces.ZKEVMClientGlobalExitRootGetter, state StateGERInteface) *CheckSyncStatusToProcessBatch
NewCheckSyncStatusToProcessBatch returns a new instance of CheckSyncStatusToProcessBatch
func (*CheckSyncStatusToProcessBatch) CheckL1SyncStatusEnoughToProcessBatch ¶
func (c *CheckSyncStatusToProcessBatch) CheckL1SyncStatusEnoughToProcessBatch(ctx context.Context, batchNumber uint64, globalExitRoot common.Hash, dbTx pgx.Tx) error
CheckL1SyncStatusEnoughToProcessBatch returns nil if the are sync and could process the batch if not:
- returns syncinterfaces.ErrMissingSyncFromL1 if we are behind the block number that contains the GlobalExitRoot
- returns l2_shared.NewDeSyncPermissionlessAndTrustedNodeError if trusted and and permissionless are not in same page! pass also the discrepance point
type L1SyncChecker ¶
type L1SyncChecker interface {
CheckL1SyncStatusEnoughToProcessBatch(ctx context.Context, batchNumber uint64, globalExitRoot common.Hash, dbTx pgx.Tx) error
}
L1SyncChecker is the interface to check if we are synced from L1 to process a batch
type StateGERInteface ¶
type StateGERInteface interface { GetExitRootByGlobalExitRoot(ctx context.Context, ger common.Hash, dbTx pgx.Tx) (*state.GlobalExitRoot, error) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error) }
StateGERInteface interface that requires from State
type StateInterface ¶
type StateInterface interface { BeginStateTransaction(ctx context.Context) (pgx.Tx, error) CloseBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) GetForkIDByBatchNumber(batchNumber uint64) uint64 UpdateWIPBatch(ctx context.Context, receipt state.ProcessingReceipt, dbTx pgx.Tx) error ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error ProcessBatchV2(ctx context.Context, request state.ProcessRequest, updateMerkleTree bool) (*state.ProcessBatchResponse, error) StoreL2Block(ctx context.Context, batchNumber uint64, l2Block *state.ProcessBlockResponse, txsEGPLog []*state.EffectiveGasPriceLog, dbTx pgx.Tx) error GetL1InfoTreeDataFromBatchL2Data(ctx context.Context, batchL2Data []byte, dbTx pgx.Tx) (map[uint32]state.L1DataV2, common.Hash, error) }
StateInterface contains the methods required to interact with the state.
type SyncTrustedBatchExecutorForEtrog ¶
type SyncTrustedBatchExecutorForEtrog struct {
// contains filtered or unexported fields
}
SyncTrustedBatchExecutorForEtrog is the implementation of the SyncTrustedStateBatchExecutorSteps that have the functions to sync a fullBatch, incrementalBatch and reprocessBatch
func (*SyncTrustedBatchExecutorForEtrog) FullProcess ¶
func (b *SyncTrustedBatchExecutorForEtrog) FullProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
FullProcess process a batch that is not on database, so is the first time we process it
func (*SyncTrustedBatchExecutorForEtrog) IncrementalProcess ¶
func (b *SyncTrustedBatchExecutorForEtrog) IncrementalProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
IncrementalProcess process a batch that we have processed before, and we have the intermediate state root, so is going to be process only new Tx
func (*SyncTrustedBatchExecutorForEtrog) NothingProcess ¶
func (b *SyncTrustedBatchExecutorForEtrog) NothingProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
NothingProcess process a batch that is already on database and updated, so it is not going to be processed again. Maybe it needs to be close
func (*SyncTrustedBatchExecutorForEtrog) ReProcess ¶
func (b *SyncTrustedBatchExecutorForEtrog) ReProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error)
ReProcess process a batch that we have processed before, but we don't have the intermediate state root, so we need to reprocess it