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

Hotfix attempt for Canary : v2.8.0-rc0 upgrade fails on Polygon. #11828

Merged
merged 6 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
12 changes: 10 additions & 2 deletions common/txmgr/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,22 @@ func NewTracker[
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Start(_ context.Context) (err error) {
tr.lock.Lock()
defer tr.lock.Unlock()
DylanTinianov marked this conversation as resolved.
Show resolved Hide resolved
tr.lggr.Info("Abandoned transaction tracking enabled")
return tr.StartOnce("Tracker", func() error {
return tr.startInternal()
})
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) startInternal() (err error) {
tr.lock.Lock()
defer tr.lock.Unlock()

tr.ctx, tr.ctxCancel = context.WithCancel(context.Background())

if err := tr.setEnabledAddresses(); err != nil {
return fmt.Errorf("failed to set enabled addresses: %w", err)
}
tr.lggr.Info("Enabled addresses set")

if err := tr.trackAbandonedTxes(tr.ctx); err != nil {
return fmt.Errorf("failed to track abandoned txes: %w", err)
Expand All @@ -115,6 +118,8 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) startIntern
tr.lggr.Infow("no abandoned txes found, skipping runLoop")
return nil
}

tr.lggr.Infof("%d abandoned txes found, starting runLoop", len(tr.txCache))
tr.wg.Add(1)
go tr.runLoop()
return nil
Expand Down Expand Up @@ -211,6 +216,7 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) trackAbando
return fmt.Errorf("tracker already started")
}

tr.lggr.Info("Retrieving non fatal transactions from txStore")
nonFatalTxes, err := tr.txStore.GetNonFatalTransactions(ctx, tr.chainID)
if err != nil {
return fmt.Errorf("failed to get non fatal txes from txStore: %w", err)
Expand Down Expand Up @@ -239,6 +245,8 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) HandleTxesB
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) handleTxesByState(ctx context.Context, blockHeight int64) error {
tr.lggr.Info("Handling transactions by state")

for id, atx := range tr.txCache {
tx, err := tr.txStore.GetTxByID(ctx, atx.id)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions common/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Start(ctx
return fmt.Errorf("Txm: Estimator failed to start: %w", err)
}

b.logger.Infow("Txm starting tracker")
DylanTinianov marked this conversation as resolved.
Show resolved Hide resolved
if err := ms.Start(ctx, b.tracker); err != nil {
return fmt.Errorf("Txm: Tracker failed to start: %w", err)
}

b.logger.Infow("Txm starting runLoop")
DylanTinianov marked this conversation as resolved.
Show resolved Hide resolved
b.wg.Add(1)
go b.runLoop()
<-b.chSubbed
Expand Down
Loading