Skip to content

Commit

Permalink
feat(eventindexer): internal devnet changes (#16466)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Mar 19, 2024
1 parent 9427ab4 commit 9a6c4e8
Show file tree
Hide file tree
Showing 40 changed files with 628 additions and 2,033 deletions.
154 changes: 17 additions & 137 deletions packages/eventindexer/TaikoL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,6 @@
"type": "uint32",
"internalType": "uint32"
},
{
"name": "blockMaxTxListBytes",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "blobExpiry",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "blobAllowedForDA",
"type": "bool",
"internalType": "bool"
},
{
"name": "blobReuseEnabled",
"type": "bool",
"internalType": "bool"
},
{
"name": "livenessBond",
"type": "uint96",
Expand Down Expand Up @@ -454,25 +434,6 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "isBlobReusable",
"inputs": [
{
"name": "_blobHash",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "owner",
Expand Down Expand Up @@ -603,16 +564,6 @@
"type": "uint64",
"internalType": "uint64"
},
{
"name": "txListByteOffset",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "txListByteSize",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "minTier",
"type": "uint16",
Expand All @@ -627,6 +578,11 @@
"name": "parentMetaHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "sender",
"type": "address",
"internalType": "address"
}
]
},
Expand Down Expand Up @@ -919,32 +875,6 @@
],
"anonymous": false
},
{
"type": "event",
"name": "BlobCached",
"inputs": [
{
"name": "blobHash",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
},
{
"type": "event",
"name": "BlobCached",
"inputs": [
{
"name": "blobHash",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
},
{
"type": "event",
"name": "BlockProposed",
Expand Down Expand Up @@ -1023,16 +953,6 @@
"type": "uint64",
"internalType": "uint64"
},
{
"name": "txListByteOffset",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "txListByteSize",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "minTier",
"type": "uint16",
Expand All @@ -1047,6 +967,11 @@
"name": "parentMetaHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "sender",
"type": "address",
"internalType": "address"
}
]
},
Expand Down Expand Up @@ -1154,16 +1079,6 @@
"type": "uint64",
"internalType": "uint64"
},
{
"name": "txListByteOffset",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "txListByteSize",
"type": "uint24",
"internalType": "uint24"
},
{
"name": "minTier",
"type": "uint16",
Expand All @@ -1178,6 +1093,11 @@
"name": "parentMetaHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "sender",
"type": "address",
"internalType": "address"
}
]
},
Expand Down Expand Up @@ -1746,12 +1666,12 @@
},
{
"type": "error",
"name": "L1_BLOB_FOR_DA_DISABLED",
"name": "L1_BLOB_NOT_AVAILABLE",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOB_FOR_DA_DISABLED",
"name": "L1_BLOB_NOT_AVAILABLE",
"inputs": []
},
{
Expand All @@ -1764,26 +1684,6 @@
"name": "L1_BLOB_NOT_FOUND",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOB_NOT_REUSABLE",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOB_NOT_REUSABLE",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOB_REUSE_DISABLED",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOB_REUSE_DISABLED",
"inputs": []
},
{
"type": "error",
"name": "L1_BLOCK_MISMATCH",
Expand Down Expand Up @@ -1839,11 +1739,6 @@
"name": "L1_INVALID_PARAM",
"inputs": []
},
{
"type": "error",
"name": "L1_INVALID_PARAM",
"inputs": []
},
{
"type": "error",
"name": "L1_INVALID_PAUSE_STATUS",
Expand Down Expand Up @@ -1959,21 +1854,6 @@
"name": "L1_TRANSITION_NOT_FOUND",
"inputs": []
},
{
"type": "error",
"name": "L1_TXLIST_OFFSET",
"inputs": []
},
{
"type": "error",
"name": "L1_TXLIST_SIZE",
"inputs": []
},
{
"type": "error",
"name": "L1_TXLIST_SIZE",
"inputs": []
},
{
"type": "error",
"name": "L1_UNAUTHORIZED",
Expand Down
44 changes: 0 additions & 44 deletions packages/eventindexer/block.go

This file was deleted.

12 changes: 0 additions & 12 deletions packages/eventindexer/cmd/flags/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@ var (
Category: indexerCategory,
EnvVars: []string{"SYNC_MODE"},
}
WatchMode = &cli.StringFlag{
Name: "watchMode",
Usage: `Mode of watching the chain. Options are:
filter: only filter the chain, when caught up, exit
subscribe: do not filter the chain, only subscribe to new events
filter-and-subscribe: the default behavior, filter the chain and subscribe when caught up
`,
Value: "filter-and-subscribe",
Category: indexerCategory,
EnvVars: []string{"SYNC_MODE"},
}
IndexNFTs = &cli.BoolFlag{
Name: "indexNfts",
Usage: "Whether to index nft transfer events orn ot",
Expand All @@ -105,6 +94,5 @@ var IndexerFlags = MergeFlags(CommonFlags, []cli.Flag{
BlockBatchSize,
SubscriptionBackoff,
SyncMode,
WatchMode,
IndexNFTs,
})
190 changes: 162 additions & 28 deletions packages/eventindexer/contracts/assignmenthook/AssignmentHook.go

Large diffs are not rendered by default.

106 changes: 43 additions & 63 deletions packages/eventindexer/contracts/bridge/Bridge.go

Large diffs are not rendered by default.

370 changes: 33 additions & 337 deletions packages/eventindexer/contracts/taikol1/TaikoL1.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/eventindexer/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Event struct {
FeeTokenAddress string `json:"feeTokenAddress"`
TransactedAt time.Time `json:"transactedAt"`
Tier sql.NullInt16 `json:"tier"`
EmittedBlockID uint64 `json:"emittedBlockID"`
}

// SaveEventOpts
Expand All @@ -65,6 +66,7 @@ type SaveEventOpts struct {
FeeTokenAddress *string
TransactedAt time.Time
Tier *uint16
EmittedBlockID uint64
}

type UniqueProversResponse struct {
Expand Down Expand Up @@ -111,4 +113,8 @@ type EventRepository interface {
req *http.Request,
address string,
) (paginate.Page, error)
DeleteAllAfterBlockID(blockID uint64, srcChainID uint64) error
FindLatestBlockID(
srcChainID uint64,
) (uint64, error)
}
19 changes: 0 additions & 19 deletions packages/eventindexer/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,25 +638,6 @@ func (g *Generator) queryByTask(task string, date time.Time) error {
}

result = tsdResult.Decimal.Add(dailyAccountsCount.Decimal)
case tasks.BlocksPerDay:
query := `SELECT COUNT(*) FROM blocks WHERE DATE(transacted_at) = ?`
err = g.db.GormDB().Raw(query, dateString).Scan(&result).Error
case tasks.TotalBlocks:
var dailyBlockCount decimal.NullDecimal

query := `SELECT COUNT(*) FROM blocks WHERE DATE(transacted_at) = ?`

err = g.db.GormDB().Raw(query, dateString).Scan(&dailyBlockCount).Error
if err != nil {
return err
}

tsdResult, err := g.previousDayTsdResultByTask(task, date, nil, nil)
if err != nil {
return err
}

result = tsdResult.Decimal.Add(dailyBlockCount.Decimal)
case tasks.TransactionsPerDay:
query := `SELECT COUNT(*) FROM transactions WHERE DATE(transacted_at) = ?`
err = g.db.GormDB().Raw(query, dateString).Scan(&result).Error
Expand Down
2 changes: 0 additions & 2 deletions packages/eventindexer/indexer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type Config struct {
BlockBatchSize uint64
SubscriptionBackoff uint64
SyncMode SyncMode
WatchMode WatchMode
IndexNFTs bool
Layer string
OpenDBFunc func() (DB, error)
Expand Down Expand Up @@ -72,7 +71,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
BlockBatchSize: c.Uint64(flags.BlockBatchSize.Name),
SubscriptionBackoff: c.Uint64(flags.SubscriptionBackoff.Name),
RPCUrl: c.String(flags.IndexerRPCUrl.Name),
WatchMode: WatchMode(c.String(flags.WatchMode.Name)),
SyncMode: SyncMode(c.String(flags.SyncMode.Name)),
IndexNFTs: c.Bool(flags.IndexNFTs.Name),
Layer: c.String(flags.Layer.Name),
Expand Down
Loading

0 comments on commit 9a6c4e8

Please sign in to comment.