Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State root storage #15

Merged
merged 6 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ block-lake/preprod-values.yaml
./block-lake/preprod-values.yaml
/scripts/runLocal
sidecar.db*
*.db*
sqlite
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## Sample backfill requests

*Contracts*
## RPC Routes

### Get current block height
```bash
grpcurl -plaintext -d '{
"range": {"from": 1477020, "to": 1477020 }
}' localhost:9999 eigenlayer.blocklake.api.v1.Backfiller/IndexContracts
grpcurl -plaintext -d '{}' localhost:7100 eigenlayer.sidecar.api.v1.Rpc/GetBlockHeight
```
29 changes: 26 additions & 3 deletions cmd/sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ import (
"github.com/Layr-Labs/sidecar/internal/config"
"github.com/Layr-Labs/sidecar/internal/contractManager"
"github.com/Layr-Labs/sidecar/internal/contractStore/sqliteContractStore"
"github.com/Layr-Labs/sidecar/internal/eigenState/stateManager"
"github.com/Layr-Labs/sidecar/internal/fetcher"
"github.com/Layr-Labs/sidecar/internal/indexer"
"github.com/Layr-Labs/sidecar/internal/logger"
"github.com/Layr-Labs/sidecar/internal/metrics"
"github.com/Layr-Labs/sidecar/internal/pipeline"
"github.com/Layr-Labs/sidecar/internal/shutdown"
"github.com/Layr-Labs/sidecar/internal/sidecar"
"github.com/Layr-Labs/sidecar/internal/sqlite"
"github.com/Layr-Labs/sidecar/internal/sqlite/migrations"
sqliteBlockStore "github.com/Layr-Labs/sidecar/internal/storage/sqlite"
"go.uber.org/zap"
"log"
"time"
)

func main() {
Expand Down Expand Up @@ -46,7 +49,6 @@ func main() {
}

migrator := migrations.NewSqliteMigrator(grm, l)
migrator.MigrateAll()
if err = migrator.MigrateAll(); err != nil {
log.Fatalf("Failed to migrate: %v", err)
}
Expand All @@ -63,15 +65,36 @@ func main() {
log.Fatalln(err)
}

sm := stateManager.NewEigenStateManager(l, grm)

fetchr := fetcher.NewFetcher(client, cfg, l)

idxr := indexer.NewIndexer(mds, contractStore, etherscanClient, cm, client, fetchr, l, cfg)

p := pipeline.NewPipeline(fetchr, idxr, mds, l)
p := pipeline.NewPipeline(fetchr, idxr, mds, sm, l)

// Create new sidecar instance
sidecar := sidecar.NewSidecar(&sidecar.SidecarConfig{
GenesisBlockNumber: cfg.GetGenesisBlockNumber(),
}, cfg, mds, p, l, client)

sidecar.Start(ctx)
// RPC channel to notify the RPC server to shutdown gracefully
rpcChannel := make(chan bool)
err = sidecar.WithRpcServer(ctx, mds, sm, rpcChannel)
if err != nil {
l.Sugar().Fatalw("Failed to start RPC server", zap.Error(err))
}

// Start the sidecar main process in a goroutine so that we can listen for a shutdown signal
go sidecar.Start(ctx)

l.Sugar().Info("Started Sidecar")

gracefulShutdown := shutdown.CreateGracefulShutdownChannel()

done := make(chan bool)
shutdown.ListenForShutdown(gracefulShutdown, done, func() {
l.Sugar().Info("Shutting down...")
rpcChannel <- true
}, time.Second*5, l)
}
34 changes: 7 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ go 1.22.2
require (
github.com/DataDog/datadog-go/v5 v5.5.0
github.com/ethereum/go-ethereum v1.14.0
github.com/google/go-cmp v0.6.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/lib/pq v1.10.9
github.com/rabbitmq/amqp091-go v1.10.0
github.com/holiman/uint256 v1.3.1
github.com/rs/cors v1.7.0
github.com/stretchr/testify v1.9.0
github.com/wealdtech/go-merkletree/v2 v2.6.0
github.com/wk8/go-ordered-map/v2 v2.1.8
go.uber.org/zap v1.27.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
gorm.io/driver/postgres v1.5.7
gorm.io/driver/sqlite v1.5.6
gorm.io/gorm v1.25.10
)

require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/apache/arrow/go/v17 v17.0.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
Expand All @@ -33,44 +34,28 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/glebarez/sqlite v1.11.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/iden3/go-iden3-crypto v0.0.16 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.4.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/marcboeker/go-duckdb v1.7.1 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/wealdtech/go-merkletree/v2 v2.6.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
Expand All @@ -82,10 +67,5 @@ require (
golang.org/x/tools v0.22.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/sqlite v1.5.6 // indirect
modernc.org/libc v1.41.0 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/sqlite v1.29.6 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading