Documentation
¶
Index ¶
- Variables
- type Config
- type EthClienter
- type Event
- type InitL1InfoRootMap
- type L1InfoTreeLeaf
- type L1InfoTreeSync
- func (s *L1InfoTreeSync) GetFirstInfo() (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetFirstInfoAfterBlock(blockNum uint64) (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetFirstL1InfoWithRollupExitRoot(rollupExitRoot common.Hash) (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetFirstVerifiedBatches(rollupID uint32) (*VerifyBatches, error)
- func (s *L1InfoTreeSync) GetFirstVerifiedBatchesAfterBlock(rollupID uint32, blockNum uint64) (*VerifyBatches, error)
- func (s *L1InfoTreeSync) GetInfoByGlobalExitRoot(ger common.Hash) (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetInfoByIndex(ctx context.Context, index uint32) (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetL1InfoTreeMerkleProof(ctx context.Context, index uint32) (types.Proof, types.Root, error)
- func (s *L1InfoTreeSync) GetL1InfoTreeMerkleProofFromIndexToRoot(ctx context.Context, index uint32, root common.Hash) (types.Proof, error)
- func (s *L1InfoTreeSync) GetL1InfoTreeRootByIndex(ctx context.Context, index uint32) (types.Root, error)
- func (s *L1InfoTreeSync) GetLastInfo() (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetLastL1InfoTreeRoot(ctx context.Context) (types.Root, error)
- func (s *L1InfoTreeSync) GetLastProcessedBlock(ctx context.Context) (uint64, error)
- func (s *L1InfoTreeSync) GetLastRollupExitRoot(ctx context.Context) (types.Root, error)
- func (s *L1InfoTreeSync) GetLastVerifiedBatches(rollupID uint32) (*VerifyBatches, error)
- func (s *L1InfoTreeSync) GetLatestInfoUntilBlock(ctx context.Context, blockNum uint64) (*L1InfoTreeLeaf, error)
- func (s *L1InfoTreeSync) GetLocalExitRoot(ctx context.Context, networkID uint32, rollupExitRoot common.Hash) (common.Hash, error)
- func (s *L1InfoTreeSync) GetRollupExitTreeMerkleProof(ctx context.Context, networkID uint32, root common.Hash) (types.Proof, error)
- func (s *L1InfoTreeSync) Start(ctx context.Context)
- type UpdateL1InfoTree
- type VerifyBatches
Constants ¶
This section is empty.
Variables ¶
var ( ErrBlockNotProcessed = errors.New("given block(s) have not been processed yet") ErrNoBlock0 = errors.New("blockNum must be greater than 0") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DBPath string `mapstructure:"DBPath"`
GlobalExitRootAddr common.Address `mapstructure:"GlobalExitRootAddr"`
RollupManagerAddr common.Address `mapstructure:"RollupManagerAddr"`
SyncBlockChunkSize uint64 `mapstructure:"SyncBlockChunkSize"`
// BlockFinality indicates the status of the blocks that will be queried in order to sync
BlockFinality string `` //nolint:lll
/* 134-byte string literal not displayed */
URLRPCL1 string `mapstructure:"URLRPCL1"`
WaitForNewBlocksPeriod types.Duration `mapstructure:"WaitForNewBlocksPeriod"`
InitialBlock uint64 `mapstructure:"InitialBlock"`
RetryAfterErrorPeriod types.Duration `mapstructure:"RetryAfterErrorPeriod"`
MaxRetryAttemptsAfterError int `mapstructure:"MaxRetryAttemptsAfterError"`
}
type EthClienter ¶
type EthClienter interface {
ethereum.LogFilterer
ethereum.BlockNumberReader
ethereum.ChainReader
bind.ContractBackend
}
type Event ¶
type Event struct {
UpdateL1InfoTree *UpdateL1InfoTree
VerifyBatches *VerifyBatches
InitL1InfoRootMap *InitL1InfoRootMap
}
type InitL1InfoRootMap ¶
type L1InfoTreeLeaf ¶
type L1InfoTreeLeaf struct {
BlockNumber uint64 `meddler:"block_num"`
BlockPosition uint64 `meddler:"block_pos"`
L1InfoTreeIndex uint32 `meddler:"position"`
PreviousBlockHash common.Hash `meddler:"previous_block_hash,hash"`
Timestamp uint64 `meddler:"timestamp"`
MainnetExitRoot common.Hash `meddler:"mainnet_exit_root,hash"`
RollupExitRoot common.Hash `meddler:"rollup_exit_root,hash"`
GlobalExitRoot common.Hash `meddler:"global_exit_root,hash"`
Hash common.Hash `meddler:"hash,hash"`
}
L1InfoTreeLeaf representation of a leaf of the L1 Info tree
type L1InfoTreeSync ¶
type L1InfoTreeSync struct {
// contains filtered or unexported fields
}
func New ¶
func New( ctx context.Context, dbPath string, globalExitRoot, rollupManager common.Address, syncBlockChunkSize uint64, blockFinalityType etherman.BlockNumberFinality, rd sync.ReorgDetector, l1Client EthClienter, waitForNewBlocksPeriod time.Duration, initialBlock uint64, retryAfterErrorPeriod time.Duration, maxRetryAttemptsAfterError int, ) (*L1InfoTreeSync, error)
New creates a L1 Info tree syncer that syncs the L1 info tree and the rollup exit tree
func (*L1InfoTreeSync) GetFirstInfo ¶
func (s *L1InfoTreeSync) GetFirstInfo() (*L1InfoTreeLeaf, error)
func (*L1InfoTreeSync) GetFirstInfoAfterBlock ¶
func (s *L1InfoTreeSync) GetFirstInfoAfterBlock(blockNum uint64) (*L1InfoTreeLeaf, error)
func (*L1InfoTreeSync) GetFirstL1InfoWithRollupExitRoot ¶
func (s *L1InfoTreeSync) GetFirstL1InfoWithRollupExitRoot(rollupExitRoot common.Hash) (*L1InfoTreeLeaf, error)
func (*L1InfoTreeSync) GetFirstVerifiedBatches ¶
func (s *L1InfoTreeSync) GetFirstVerifiedBatches(rollupID uint32) (*VerifyBatches, error)
func (*L1InfoTreeSync) GetFirstVerifiedBatchesAfterBlock ¶
func (s *L1InfoTreeSync) GetFirstVerifiedBatchesAfterBlock(rollupID uint32, blockNum uint64) (*VerifyBatches, error)
func (*L1InfoTreeSync) GetInfoByGlobalExitRoot ¶
func (s *L1InfoTreeSync) GetInfoByGlobalExitRoot(ger common.Hash) (*L1InfoTreeLeaf, error)
func (*L1InfoTreeSync) GetInfoByIndex ¶
func (s *L1InfoTreeSync) GetInfoByIndex(ctx context.Context, index uint32) (*L1InfoTreeLeaf, error)
GetInfoByIndex returns the value of a leaf (not the hash) of the L1 info tree
func (*L1InfoTreeSync) GetL1InfoTreeMerkleProof ¶
func (s *L1InfoTreeSync) GetL1InfoTreeMerkleProof(ctx context.Context, index uint32) (types.Proof, types.Root, error)
GetL1InfoTreeMerkleProof creates a merkle proof for the L1 Info tree
func (*L1InfoTreeSync) GetL1InfoTreeMerkleProofFromIndexToRoot ¶
func (s *L1InfoTreeSync) GetL1InfoTreeMerkleProofFromIndexToRoot( ctx context.Context, index uint32, root common.Hash, ) (types.Proof, error)
GetL1InfoTreeMerkleProofFromIndexToRoot creates a merkle proof for the L1 Info tree
func (*L1InfoTreeSync) GetL1InfoTreeRootByIndex ¶
func (s *L1InfoTreeSync) GetL1InfoTreeRootByIndex(ctx context.Context, index uint32) (types.Root, error)
GetL1InfoTreeRootByIndex returns the root of the L1 info tree at the moment the leaf with the given index was added
func (*L1InfoTreeSync) GetLastInfo ¶
func (s *L1InfoTreeSync) GetLastInfo() (*L1InfoTreeLeaf, error)
func (*L1InfoTreeSync) GetLastL1InfoTreeRoot ¶
GetLastL1InfoTreeRoot return the last root and index processed from the L1 Info tree
func (*L1InfoTreeSync) GetLastProcessedBlock ¶
func (s *L1InfoTreeSync) GetLastProcessedBlock(ctx context.Context) (uint64, error)
GetLastProcessedBlock return the last processed block
func (*L1InfoTreeSync) GetLastRollupExitRoot ¶
GetLastRollupExitRoot return the last rollup exit root processed
func (*L1InfoTreeSync) GetLastVerifiedBatches ¶
func (s *L1InfoTreeSync) GetLastVerifiedBatches(rollupID uint32) (*VerifyBatches, error)
func (*L1InfoTreeSync) GetLatestInfoUntilBlock ¶
func (s *L1InfoTreeSync) GetLatestInfoUntilBlock(ctx context.Context, blockNum uint64) (*L1InfoTreeLeaf, error)
GetLatestInfoUntilBlock returns the most recent L1InfoTreeLeaf that occurred before or at blockNum. If the blockNum has not been processed yet the error ErrBlockNotProcessed will be returned
func (*L1InfoTreeSync) GetLocalExitRoot ¶
func (*L1InfoTreeSync) GetRollupExitTreeMerkleProof ¶
func (s *L1InfoTreeSync) GetRollupExitTreeMerkleProof( ctx context.Context, networkID uint32, root common.Hash, ) (types.Proof, error)
GetRollupExitTreeMerkleProof creates a merkle proof for the rollup exit tree
func (*L1InfoTreeSync) Start ¶
func (s *L1InfoTreeSync) Start(ctx context.Context)
Start starts the synchronization process
type UpdateL1InfoTree ¶
type UpdateL1InfoTree struct {
BlockPosition uint64
MainnetExitRoot common.Hash
RollupExitRoot common.Hash
ParentHash common.Hash
Timestamp uint64
}
UpdateL1InfoTree representation of the UpdateL1InfoTree event
type VerifyBatches ¶
type VerifyBatches struct {
BlockNumber uint64 `meddler:"block_num"`
BlockPosition uint64 `meddler:"block_pos"`
RollupID uint32 `meddler:"rollup_id"`
NumBatch uint64 `meddler:"batch_num"`
StateRoot common.Hash `meddler:"state_root,hash"`
ExitRoot common.Hash `meddler:"exit_root,hash"`
Aggregator common.Address `meddler:"aggregator,address"`
// Not provided by downloader
RollupExitRoot common.Hash `meddler:"rollup_exit_root,hash"`
}
VerifyBatches representation of the VerifyBatches and VerifyBatchesTrustedAggregator events