Commit 573d18c5 authored by Hamdi Allam's avatar Hamdi Allam

ci failures

parent 18779f6d
...@@ -21,8 +21,8 @@ const ( ...@@ -21,8 +21,8 @@ const (
) )
// DepositsByAddress mocks returning deposits by an address // DepositsByAddress mocks returning deposits by an address
func (mbv *MockBridgeView) DepositsByAddress(address common.Address) ([]*database.DepositWithTransactionHash, error) { func (mbv *MockBridgeView) DepositsByAddress(address common.Address) ([]*database.DepositWithTransactionHashes, error) {
return []*database.DepositWithTransactionHash{ return []*database.DepositWithTransactionHashes{
{ {
Deposit: database.Deposit{ Deposit: database.Deposit{
GUID: uuid.MustParse(guid1), GUID: uuid.MustParse(guid1),
......
...@@ -2,7 +2,6 @@ package cli ...@@ -2,7 +2,6 @@ package cli
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"os" "os"
"os/signal" "os/signal"
...@@ -41,11 +40,11 @@ func runIndexer(ctx *cli.Context) error { ...@@ -41,11 +40,11 @@ func runIndexer(ctx *cli.Context) error {
} }
signalChannel := make(chan os.Signal, 1) signalChannel := make(chan os.Signal, 1)
indexerCtx, indexerCancel := context.WithCancelCause(context.Background()) indexerCtx, indexerCancel := context.WithCancel(context.Background())
signal.Notify(signalChannel, os.Interrupt) signal.Notify(signalChannel, os.Interrupt)
go func() { go func() {
<-signalChannel <-signalChannel
indexerCancel(errors.New("caught interrrupt")) indexerCancel()
}() }()
return indexer.Run(indexerCtx) return indexer.Run(indexerCtx)
......
...@@ -5,6 +5,8 @@ import ( ...@@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/indexer/config" "github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/database" "github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/node" "github.com/ethereum-optimism/optimism/indexer/node"
...@@ -14,7 +16,8 @@ import ( ...@@ -14,7 +16,8 @@ import (
// Indexer contains the necessary resources for // Indexer contains the necessary resources for
// indexing the configured L1 and L2 chains // indexing the configured L1 and L2 chains
type Indexer struct { type Indexer struct {
db *database.DB db *database.DB
log log.Logger
L1Processor *processor.L1Processor L1Processor *processor.L1Processor
L2Processor *processor.L2Processor L2Processor *processor.L2Processor
...@@ -52,6 +55,7 @@ func NewIndexer(cfg config.Config) (*Indexer, error) { ...@@ -52,6 +55,7 @@ func NewIndexer(cfg config.Config) (*Indexer, error) {
indexer := &Indexer{ indexer := &Indexer{
db: db, db: db,
log: cfg.Logger,
L1Processor: l1Processor, L1Processor: l1Processor,
L2Processor: l2Processor, L2Processor: l2Processor,
} }
...@@ -65,14 +69,16 @@ func (i *Indexer) Run(ctx context.Context) error { ...@@ -65,14 +69,16 @@ func (i *Indexer) Run(ctx context.Context) error {
errCh := make(chan error) errCh := make(chan error)
// If either processor errors out, we stop // If either processor errors out, we stop
processorCtx, cancel := context.WithCancelCause(ctx) processorCtx, cancel := context.WithCancel(ctx)
run := func(start func(ctx context.Context) error) { run := func(start func(ctx context.Context) error) {
wg.Add(1) wg.Add(1)
defer wg.Done() defer wg.Done()
err := start(processorCtx) err := start(processorCtx)
if err != nil { if err != nil {
cancel(err) i.log.Error("halting indexer on error", "err", err)
cancel()
errCh <- err errCh <- err
} }
} }
......
...@@ -310,7 +310,7 @@ func l1BridgeProcessContractEvents(processLog log.Logger, db *database.DB, ethCl ...@@ -310,7 +310,7 @@ func l1BridgeProcessContractEvents(processLog log.Logger, db *database.DB, ethCl
if withdrawal == nil { if withdrawal == nil {
// This needs to be updated to read from config as well as correctly identify if the CrossDomainMessenger message is a standard // This needs to be updated to read from config as well as correctly identify if the CrossDomainMessenger message is a standard
// bridge message. This will easier to do once we index passed messages seperately which will include the right To/From fields // bridge message. This will easier to do once we index passed messages separately which will include the right To/From fields
if provenWithdrawalEvent.From != common.HexToAddress("0x4200000000000000000000000000000000000007") || provenWithdrawalEvent.To != l1Contracts.L1CrossDomainMessenger { if provenWithdrawalEvent.From != common.HexToAddress("0x4200000000000000000000000000000000000007") || provenWithdrawalEvent.To != l1Contracts.L1CrossDomainMessenger {
// non-bridge withdrawal // non-bridge withdrawal
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment