feat (BREAKING): evm compat tracker with mod directive replace approach

This commit is contained in:
2024-09-27 14:28:26 +03:00
parent afacc4425d
commit 8c15109238
32 changed files with 655 additions and 492 deletions

View File

@@ -4,9 +4,9 @@ import (
"context"
"time"
"github.com/celo-org/celo-blockchain"
"github.com/celo-org/celo-blockchain/core/types"
"github.com/celo-org/celo-blockchain/event"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
)
type BlockQueueFn func(uint64) error
@@ -23,7 +23,7 @@ func (s *Syncer) Start() {
s.realtimeSub = event.ResubscribeErr(resubscribeInterval, s.resubscribeFn())
}
func (s *Syncer) receiveRealtimeBlocks(ctx context.Context, fn BlockQueueFn) (celo.Subscription, error) {
func (s *Syncer) receiveRealtimeBlocks(ctx context.Context, fn BlockQueueFn) (ethereum.Subscription, error) {
newHeadersReceiver := make(chan *types.Header, 1)
sub, err := s.ethClient.SubscribeNewHead(ctx, newHeadersReceiver)
s.logg.Info("realtime syncer connected to ws endpoint")

View File

@@ -4,12 +4,12 @@ import (
"context"
"log/slog"
"github.com/celo-org/celo-blockchain"
"github.com/celo-org/celo-blockchain/ethclient"
"github.com/grassrootseconomics/celo-tracker/db"
"github.com/grassrootseconomics/celo-tracker/internal/chain"
"github.com/grassrootseconomics/celo-tracker/internal/pool"
"github.com/grassrootseconomics/celo-tracker/internal/stats"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/grassrootseconomics/eth-tracker/db"
"github.com/grassrootseconomics/eth-tracker/internal/chain"
"github.com/grassrootseconomics/eth-tracker/internal/pool"
"github.com/grassrootseconomics/eth-tracker/internal/stats"
)
type (
@@ -27,7 +27,7 @@ type (
db db.DB
ethClient *ethclient.Client
logg *slog.Logger
realtimeSub celo.Subscription
realtimeSub ethereum.Subscription
pool *pool.Pool
stats *stats.Stats
stopCh chan struct{}