Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claim ¶
type Claim struct {
BlockNum uint64 `meddler:"block_num"`
BlockPos uint64 `meddler:"block_pos"`
TxHash common.Hash `meddler:"tx_hash,hash"`
GlobalIndex *big.Int `meddler:"global_index,bigint"`
OriginNetwork uint32 `meddler:"origin_network"`
OriginAddress common.Address `meddler:"origin_address"`
DestinationAddress common.Address `meddler:"destination_address"`
Amount *big.Int `meddler:"amount,bigint"`
ProofLocalExitRoot treetypes.Proof `meddler:"proof_local_exit_root,merkleproof"`
ProofRollupExitRoot treetypes.Proof `meddler:"proof_rollup_exit_root,merkleproof"`
MainnetExitRoot common.Hash `meddler:"mainnet_exit_root,hash"`
RollupExitRoot common.Hash `meddler:"rollup_exit_root,hash"`
GlobalExitRoot common.Hash `meddler:"global_exit_root,hash"`
DestinationNetwork uint32 `meddler:"destination_network"`
Metadata []byte `meddler:"metadata"`
IsMessage bool `meddler:"is_message"`
BlockTimestamp uint64 `meddler:"block_timestamp"`
Type ClaimType `meddler:"type"`
}
Claim representation of a claim event
func (*Claim) DecodeEtrogCalldata ¶
DecodeEtrogCalldata decodes claim calldata for Etrog fork
func (*Claim) DecodePreEtrogCalldata ¶
DecodePreEtrogCalldata decodes the claim calldata for pre-Etrog forks
type ClaimStorager ¶
type ClaimStorager interface {
// InsertBlock records a block so claims can reference it via foreign key
InsertBlock(ctx context.Context, tx dbtypes.Querier, blockNum uint64, blockHash common.Hash) error
// InsertClaim persists a single claim record
InsertClaim(ctx context.Context, tx dbtypes.Querier, claim Claim) error
// InsertUnsetClaim persists an unset claim record
InsertUnsetClaim(ctx context.Context, tx dbtypes.Querier, u UnsetClaim) error
// InsertSetClaim persists a set claim record
InsertSetClaim(ctx context.Context, tx dbtypes.Querier, s SetClaim) error
// GetClaims returns claims in [fromBlock, toBlock] using compaction logic
GetClaims(ctx context.Context, tx dbtypes.Querier, fromBlock, toBlock uint64) ([]Claim, error)
// GetClaimsByGlobalIndex returns claims for the given global index using compaction logic
GetClaimsByGlobalIndex(ctx context.Context, tx dbtypes.Querier, globalIndex *big.Int) ([]Claim, error)
// GetFirstProcessedBlock returns the lowest block number stored if any.
// Returns (0, false, nil) if there are no blocks.
GetFirstProcessedBlock(ctx context.Context, tx dbtypes.Querier) (uint64, bool, error)
// GetLastProcessedBlock returns the highest block number stored if any
// it returns:
// - the highest block number stored, or 0 if there are no blocks
// - a boolean indicating whether a block was found (false if there are no blocks)
// - error if the operation failed, or nil if successful
GetLastProcessedBlock(ctx context.Context, tx dbtypes.Querier) (uint64, bool, error)
// DeleteBlocksFrom deletes all blocks with num >= firstBlock (cascade-deletes claims etc.)
DeleteBlocksFrom(ctx context.Context, tx dbtypes.Querier, firstBlock uint64) (int64, error)
// GetClaimsByGER returns all DetailedClaimEvent claims with the given global exit root
GetClaimsByGER(ctx context.Context, tx dbtypes.Querier, globalExitRoot common.Hash) ([]*Claim, error)
// GetClaimsPaged returns claims for the given page parameters and filters,
// it returns:
// - the list of claims for the requested page
// - the total count of claims matching the filters (ignoring pagination)
// - error if the operation failed, or nil if successful
GetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32, networkIDs []uint32, globalIndex *big.Int,
) ([]*Claim, int, error)
// GetSetClaimsPaged returns set claims for the given page parameters and filters,
// it returns:
// - the list of set claims for the requested page
// - the total count of set claims matching the filters (ignoring pagination)
// - error if the operation failed, or nil if successful
GetSetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32,
globalIndex *big.Int,
) ([]*SetClaim, int, error)
// GetUnsetClaimsPaged returns unset claims for the given page parameters and filters,
// it returns:
// - the list of unset claims for the requested page
// - the total count of unset claims matching the filters (ignoring pagination)
// - error if the operation failed, or nil if successful
GetUnsetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32,
globalIndex *big.Int,
) ([]*UnsetClaim, int, error)
// NewTx begins a new database transaction.
NewTx(ctx context.Context) (dbtypes.Txer, error)
compatibility.CompatibilityDataStorager[aggsync.RuntimeData]
}
Storage defines the interface for claim storage operations. Each method accepts an optional tx dbtypes.Querier; pass nil to use the default DB connection.
type ClaimSyncer ¶
type ClaimSyncer interface {
OriginNetwork() uint32
// GetLastProcessedBlock is deprecated in favour GetProcessedBlockRange
GetLastProcessedBlock(ctx context.Context) (uint64, bool, error)
// GetStatus(ctx context.Context) (Status, error)
// SetNextRequiredBlock sets the next required block number. It is used by aggsender that
// set the next required block to the next one from the previous settled certificate
// If the syncer have no block yet is going to use this as starting point
// If the syncer have any block check that the `blockNumber`is higher than the first synced block
// blockNumber==0 means that the syncer should start syncing from the InitialBlockNum in the config
SetNextRequiredBlock(ctx context.Context, blockNumber uint64) error
GetClaims(ctx context.Context, fromBlock, toBlock uint64) ([]Claim, error)
GetClaimsByGlobalIndex(ctx context.Context, globalIndex *big.Int) ([]Claim, error)
GetLatestBlockNumByGlobalIndexFromRPC(
ctx context.Context, globalIndex *big.Int, toBlock *aggkittypes.BlockNumberFinality,
) (uint64, bool, error)
}
type ClaimSyncerID ¶
type ClaimSyncerID int
ClaimSyncerID represents the type of bridge syncer
const ( L1ClaimSyncer ClaimSyncerID = iota L2ClaimSyncer // CurrentDBVersion represents the current version of the bridge syncer's database schema. // It is used to ensure the database is reset if an upgrade requires a full resync. // Increment this value whenever the database schema changes in a way that is not backward-compatible. CurrentDBVersion = 1 )
func (ClaimSyncerID) String ¶
func (b ClaimSyncerID) String() string
type ClaimsReader ¶
type ClaimsReader interface {
GetFirstProcessedBlock(ctx context.Context, tx dbtypes.Querier) (uint64, bool, error)
GetLastProcessedBlock(ctx context.Context, tx dbtypes.Querier) (uint64, bool, error)
GetClaims(ctx context.Context, tx dbtypes.Querier, fromBlock, toBlock uint64) ([]Claim, error)
GetClaimsByGlobalIndex(ctx context.Context, tx dbtypes.Querier, globalIndex *big.Int) ([]Claim, error)
GetClaimsByGER(ctx context.Context, tx dbtypes.Querier, globalExitRoot common.Hash) ([]*Claim, error)
GetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32,
networkIDs []uint32, globalIndex *big.Int,
) ([]*Claim, int, error)
GetSetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32,
globalIndex *big.Int,
) ([]*SetClaim, int, error)
GetUnsetClaimsPaged(
ctx context.Context, pageNumber, pageSize uint32,
globalIndex *big.Int,
) ([]*UnsetClaim, int, error)
}
ClaimsReader provides read-only access
type EmbeddedProcessor ¶
type SetClaim ¶
type SetClaim struct {
BlockNum uint64 `meddler:"block_num"`
BlockPos uint64 `meddler:"block_pos"`
TxHash common.Hash `meddler:"tx_hash,hash"`
GlobalIndex *big.Int `meddler:"global_index,bigint"`
CreatedAt uint64 `meddler:"created_at"`
}
SetClaim representation of a SetClaim event, that is emitted by the L2 bridge contract when a claim is set.
type Unclaim ¶
type Unclaim struct {
GlobalIndex *big.Int `json:"global_index"`
BlockNumber uint64 `json:"block_number"`
LogIndex uint64 `json:"log_index"`
}
TODO: Why this struct is duplicated?? Unclaim: this was in file bridgesync/types/types.go UnsetClaim: this was in file bridgesync/processor.go
type UnsetClaim ¶
type UnsetClaim struct {
BlockNum uint64 `meddler:"block_num"`
BlockPos uint64 `meddler:"block_pos"`
TxHash common.Hash `meddler:"tx_hash,hash"`
GlobalIndex *big.Int `meddler:"global_index,bigint"`
UnsetGlobalIndexHashChain common.Hash `meddler:"unset_global_index_hash_chain,hash"`
CreatedAt uint64 `meddler:"created_at"`
}
UnsetClaim representation of an UpdatedUnsetGlobalIndexHashChain event, that is emitted by the bridge contract when a claim is unset.
func (*UnsetClaim) String ¶
func (u *UnsetClaim) String() string
String returns a string representation of the UnsetClaim.