Skip to content

Commit

Permalink
Merge branch 'main' into patch
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Mar 19, 2024
2 parents a0b148a + fd04543 commit 144746e
Show file tree
Hide file tree
Showing 53 changed files with 924 additions and 2,319 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ taiko-mono/
├── <a href="./LICENSE.md">LICENSE.md</a>
├── <a href="./README.md">README.md</a>
├── <a href="./packages">packages</a>
│ ├── <a href="./packages/branding">blob-storage</a>: Blob storage service.
│ ├── <a href="./packages/blobstorage">blob-storage</a>: Blob storage service.
│ ├── <a href="./packages/branding">branding</a>: Taiko branding materials.
│ ├── <a href="./packages/bridge-ui">bridge-ui</a>: Bridge UI.
│ ├── <a href="./packages/eventindexer">eventindexer</a>: Event indexer.
Expand Down
14 changes: 4 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ require (
github.com/go-git/go-git/v5 v5.11.0
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/joho/godotenv v1.5.1
github.com/labstack/echo-contrib v0.15.0
github.com/labstack/echo/v4 v4.11.4
github.com/labstack/gommon v0.4.2
github.com/morkid/paginate v1.1.7
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/pressly/goose/v3 v3.18.0
github.com/pressly/goose/v3 v3.19.2
github.com/prometheus/client_golang v1.19.0
github.com/rabbitmq/amqp091-go v1.9.0
github.com/shopspring/decimal v1.3.1
github.com/stretchr/testify v1.9.0
github.com/swaggo/swag v1.16.3
github.com/testcontainers/testcontainers-go v0.28.0
github.com/urfave/cli/v2 v2.27.1
go.mongodb.org/mongo-driver v1.14.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.6.0
gopkg.in/go-playground/assert.v1 v1.2.1
Expand All @@ -42,6 +40,7 @@ require (

require (
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
Expand Down Expand Up @@ -97,7 +96,7 @@ require (
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/go-sql-driver/mysql v1.8.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
Expand Down Expand Up @@ -133,7 +132,6 @@ require (
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/morkid/gocache v1.0.0 // indirect
github.com/neko-neko/echo-logrus/v2 v2.0.1 // indirect
Expand Down Expand Up @@ -164,11 +162,7 @@ require (
github.com/valyala/fasthttp v1.44.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
Expand All @@ -181,7 +175,7 @@ require (
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.15.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
Expand Down
69 changes: 26 additions & 43 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.23.0",
"private": true,
"devDependencies": {
"lefthook": "^1.6.4",
"lefthook": "^1.6.7",
"prettier": "^3.2.5"
}
}
34 changes: 30 additions & 4 deletions packages/blobstorage/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,40 @@ func InitFromConfig(ctx context.Context, i *Indexer, cfg *Config) (err error) {

func (i *Indexer) Start() error {
i.wg.Add(1)

go i.eventLoop(i.ctx, i.latestIndexedBlockNumber)

return nil
}

func (i *Indexer) setInitialIndexingBlock(
ctx context.Context,
) error {
// get most recently processed block height from the DB
latest, err := i.blobHashRepo.FindLatestBlockID()
if err != nil {
return err
}

// if its non-zero ,we use that. if it is zero, it means we havent
// processed any blobs, so we should get the state variables below.
if latest != 0 {
i.latestIndexedBlockNumber = latest

return nil
}

// and then start from the genesis height.
stateVars, err := i.taikoL1.GetStateVariables(nil)
if err != nil {
return err
}

i.latestIndexedBlockNumber = stateVars.A.GenesisHeight - 1

return nil
}

// eventLoop runs on an interval ticker, every N seconds we will check
// the latest processed block, and the latest header, and filter every block in between
// for BlockProposed events, if we are not already filtering. This lets us avoid
Expand Down Expand Up @@ -143,13 +172,10 @@ func (i *Indexer) withRetry(f func() error) error {
}

func (i *Indexer) filter(ctx context.Context) error {
n, err := i.blobHashRepo.FindLatestBlockID()
if err != nil {
if err := i.setInitialIndexingBlock(i.ctx); err != nil {
return err
}

i.latestIndexedBlockNumber = n

// get the latest header
header, err := i.ethClient.HeaderByNumber(i.ctx, nil)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@sveltejs/kit": "^1.30.4",
"@types/debug": "^4.1.12",
"@types/object-hash": "^3.0.6",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.0.2",
"@vitest/coverage-v8": "^1.3.1",
"@wagmi/cli": "^2.1.1",
"@wagmi/cli": "^2.1.2",
"abitype": "^1.0.0",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.18",
Expand All @@ -45,7 +45,7 @@
"lokijs": "^1.5.12",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"prettier-plugin-svelte": "^3.2.2",
"svelte": "^4.2.11",
"svelte-check": "^3.6.6",
"tailwindcss": "^3.4.1",
Expand All @@ -63,7 +63,7 @@
"@wagmi/core": "^2.6.5",
"@walletconnect/ethereum-provider": "^2.11.2",
"@walletconnect/modal": "^2.6.2",
"@web3modal/wagmi": "^4.0.9",
"@web3modal/wagmi": "^4.1.1",
"@zerodevx/svelte-toast": "^0.9.5",
"axios": "^1.6.7",
"buffer": "^6.0.3",
Expand Down
Loading

0 comments on commit 144746e

Please sign in to comment.