Commit a86737df authored by Ethen Pociask's avatar Ethen Pociask

[indexer.bridge_offset_fix] Addressed PR feedback

parent f5a58f73
...@@ -56,9 +56,7 @@ The indexer service is responsible for polling and processing real-time batches ...@@ -56,9 +56,7 @@ The indexer service is responsible for polling and processing real-time batches
### L1 Polling ### L1 Polling
L1 blocks are only indexed if they contain: L1 blocks are only indexed if they contain L1 system contract events. This is done to reduce the amount of unnecessary data that is indexed. Because of this, the `l1_block_headers` table will not contain every L1 block header.
- L1 system contract events
- Batch commitment events
#### API #### API
The indexer service runs a lightweight health server adjacently to the main service. The health server exposes a single endpoint `/healthz` that can be used to check the health of the indexer service. The health assessment doesn't check dependency health (ie. database) but rather checks the health of the indexer service itself. The indexer service runs a lightweight health server adjacently to the main service. The health server exposes a single endpoint `/healthz` that can be used to check the health of the indexer service. The health assessment doesn't check dependency health (ie. database) but rather checks the health of the indexer service itself.
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"gorm.io/gorm" "gorm.io/gorm"
) )
...@@ -177,8 +176,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64 ...@@ -177,8 +176,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64
// TODO - Embed logging to db // TODO - Embed logging to db
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
log.Warn("Could not fetch latest provided L1 block header in bridge processor", "number", fromL1Height,
"processor", "bridge")
return nil, nil return nil, nil
} }
return nil, result.Error return nil, result.Error
...@@ -189,8 +186,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64 ...@@ -189,8 +186,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64
result := db.gorm.Order("number desc").Take(&header) result := db.gorm.Order("number desc").Take(&header)
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
log.Warn("Could not fetch recent L1 block header", "number", fromL1Height,
"processor", "bridge")
return nil, nil return nil, nil
} }
return nil, result.Error return nil, result.Error
...@@ -212,8 +207,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64 ...@@ -212,8 +207,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64
result := db.gorm.Where(l1QueryFilter).Order("timestamp DESC").Take(&l1Header) result := db.gorm.Where(l1QueryFilter).Order("timestamp DESC").Take(&l1Header)
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
log.Warn("Could not fetch latest L1 block header in bridge processor", "from_timestamp",
fromTimestamp, "max_l1_range", maxL1Range, "processor", "bridge")
return nil, nil return nil, nil
} }
return nil, result.Error return nil, result.Error
...@@ -226,7 +219,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64 ...@@ -226,7 +219,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64
result = db.gorm.Where("timestamp <= ?", toTimestamp).Order("timestamp DESC").Take(&l2Header) result = db.gorm.Where("timestamp <= ?", toTimestamp).Order("timestamp DESC").Take(&l2Header)
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
log.Warn("Could not fetch latest L2 block header in bridge processor", "processor", "bridge")
return nil, nil return nil, nil
} }
return nil, result.Error return nil, result.Error
...@@ -249,7 +241,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64 ...@@ -249,7 +241,6 @@ func (db *blocksDB) LatestObservedEpoch(fromL1Height *big.Int, maxL1Range uint64
result := query.Take(&epoch) result := query.Take(&epoch)
if result.Error != nil { if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) { if errors.Is(result.Error, gorm.ErrRecordNotFound) {
log.Warn("Could not fetch latest observed epoch in bridge processor", "processor", "bridge")
return nil, nil return nil, nil
} }
return nil, result.Error return nil, result.Error
......
...@@ -16,21 +16,6 @@ END $$; ...@@ -16,21 +16,6 @@ END $$;
* BLOCK DATA * BLOCK DATA
*/ */
DROP TABLE IF EXISTS l1_block_headers CASCADE;
DROP TABLE IF EXISTS l2_block_headers CASCADE;
DROP TABLE IF EXISTS l1_contract_events CASCADE;
DROP TABLE IF EXISTS l2_contract_events CASCADE;
DROP TABLE IF EXISTS l1_transaction_deposits CASCADE;
DROP TABLE IF EXISTS l2_transaction_withdrawals CASCADE;
DROP TABLE IF EXISTS l1_bridge_messages CASCADE;
DROP TABLE IF EXISTS l2_bridge_messages CASCADE;
DROP TABLE IF EXISTS l1_bridged_tokens CASCADE;
DROP TABLE IF EXISTS l2_bridged_tokens CASCADE;
DROP TABLE IF EXISTS l1_bridge_deposits CASCADE;
DROP TABLE IF EXISTS l2_bridge_withdrawals CASCADE;
CREATE TABLE IF NOT EXISTS l1_block_headers ( CREATE TABLE IF NOT EXISTS l1_block_headers (
-- Searchable fields -- Searchable fields
hash VARCHAR PRIMARY KEY, hash VARCHAR PRIMARY KEY,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment