-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eventindexer): Timeseries data indexing + refactor to taiko-clie…
…nt/relayer CLI approach and architecture (#14663)
- Loading branch information
1 parent
452e8a7
commit 9d01971
Showing
63 changed files
with
2,594 additions
and
1,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
HTTP_PORT=4100 | ||
PROMETHEUS_HTTP_PORT=6063 | ||
MYSQL_USER=root | ||
MYSQL_PASSWORD=root | ||
MYSQL_DATABASE=eventindexer | ||
MYSQL_HOST=localhost:3306 | ||
MYSQL_MAX_IDLE_CONNS=50 | ||
MYSQL_MAX_OPEN_CONNS=3000 | ||
MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 | ||
L1_TAIKO_ADDRESS=0x6375394335f34848b850114b66A49D6F47f2cdA8 | ||
BRIDGE_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 | ||
PROVER_POOL_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 | ||
RPC_URL=wss://l1ws.test.taiko.xyz | ||
DATABASE_USER=root | ||
DATABASE_PASSWORD=root | ||
DATABASE_NAME=eventindexer | ||
DATABASE_HOST=localhost:3306 | ||
DATABASE_MAX_IDLE_CONNS=50 | ||
DATABASE_MAX_OPEN_CONNS=3000 | ||
DATABASE_CONN_MAX_LIFETIME_IN_MS=100000 | ||
L1_TAIKO_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 | ||
BRIDGE_ADDRESS=0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE | ||
RPC_URL=wss://l1ws.internal.taiko.xyz | ||
CORS_ORIGINS=* | ||
BLOCK_BATCH_SIZE=100 | ||
BLOCK_BATCH_SIZE=10 | ||
CACHE_INTERVAL_IN_SECONDS=60 | ||
LAYER=l1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
HTTP_PORT=4100 | ||
PROMETHEUS_HTTP_PORT=6063 | ||
MYSQL_USER=root | ||
MYSQL_PASSWORD=root | ||
MYSQL_DATABASE=eventindexer | ||
MYSQL_HOST=localhost:3306 | ||
MYSQL_MAX_IDLE_CONNS=50 | ||
MYSQL_MAX_OPEN_CONNS=3000 | ||
MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 | ||
PROVER_POOL_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 | ||
SWAP_ADDRESSES=0x501f63210aE6D7Eeb50DaE74DA5Ae407515ee246,0x926815A3fb587DDF5e2d2A03ea235630c0A53a16,0x2223D60359736532958DF6a4E9A5e4A5a71729A1 | ||
RPC_URL=wss://ws.test.taiko.xyz | ||
HTTP_PORT=4009 | ||
METRICS_HTTP_PORT=6067 | ||
DATABASE_USER=root | ||
DATABASE_PASSWORD=root | ||
DATABASE_NAME=eventindexer | ||
DATABASE_HOST=localhost:3306 | ||
DATABASE_MAX_IDLE_CONNS=50 | ||
DATABASE_MAX_OPEN_CONNS=3000 | ||
DATABASE_CONN_MAX_LIFETIME_IN_MS=100000 | ||
RPC_URL=wss://ws.internal.taiko.xyz | ||
CORS_ORIGINS=* | ||
BLOCK_BATCH_SIZE=1000 | ||
BLOCK_BATCH_SIZE=100 | ||
CACHE_INTERVAL_IN_SECONDS=60 | ||
LAYER=l2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package eventindexer | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
type Account struct { | ||
ID int `json:"id"` | ||
Address string `json:"address"` | ||
TransactedAt time.Time `json:"transactedAt"` | ||
} | ||
|
||
type AccountRepository interface { | ||
Save(ctx context.Context, address common.Address, transactedAt time.Time) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,44 @@ | ||
package eventindexer | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
) | ||
|
||
// Block is a database model representing simple header types | ||
// ProcessedBlock is a database model representing simple header types | ||
// to keep track of our most recently processed block number and hash. | ||
type Block struct { | ||
type ProcessedBlock struct { | ||
ID int `json:"id"` | ||
Height uint64 `json:"blockHeight" gorm:"column:block_height"` | ||
Hash string `json:"hash"` | ||
ChainID int64 `json:"chainID"` | ||
} | ||
|
||
// SaveBlockOpts is required to store a new block | ||
type SaveBlockOpts struct { | ||
// SaveProcessedBlockOpts is required to store a new block | ||
type SaveProcessedBlockOpts struct { | ||
Height uint64 | ||
Hash common.Hash | ||
ChainID *big.Int | ||
} | ||
|
||
// BlockRepository defines methods necessary for interacting with | ||
// ProcessedBlockRepository defines methods necessary for interacting with | ||
// the block store. | ||
type ProcessedBlockRepository interface { | ||
Save(opts SaveProcessedBlockOpts) error | ||
GetLatestBlockProcessed(chainID *big.Int) (*ProcessedBlock, error) | ||
} | ||
|
||
type Block struct { | ||
ID int `json:"id"` | ||
ChainID int64 `json:"chainID"` | ||
BlockID int64 `json:"blockID"` | ||
TransactedAt time.Time `json:"transactedAt"` | ||
} | ||
|
||
type BlockRepository interface { | ||
Save(opts SaveBlockOpts) error | ||
GetLatestBlockProcessed(chainID *big.Int) (*Block, error) | ||
Save(ctx context.Context, tx *types.Block, chainID *big.Int) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package eventindexer | ||
|
||
import "context" | ||
|
||
type ChartResponse struct { | ||
Chart []ChartItem `json:"chart"` | ||
} | ||
|
||
type ChartItem struct { | ||
Date string `json:"date"` | ||
Value string `json:"value"` | ||
} | ||
|
||
type ChartRepository interface { | ||
Find( | ||
ctx context.Context, | ||
task string, | ||
start string, | ||
end string, | ||
) (*ChartResponse, error) | ||
} |
Oops, something went wrong.