Skip to content

Conversation

@Eric-Warehime
Copy link
Collaborator

@Eric-Warehime Eric-Warehime commented Nov 14, 2025

Run persistent txn generation in parallel via goroutines.
Cache balances in the txdistribution in order to avoid balance queries.


Note

Parallelizes persistent tx building, throttles load during wallet bootstrapping, updates nonce/balance fetching, and changes bootstrapped distribution constructor with test updates.

  • Runner (persistent load):
    • Add bootstrapping throttle: compute requiredBootstrapLoads, track blocksProcessed, and publish load every bootstrapBackoff blocks while funding wallets (chains/ethereum/runner/persistent.go).
    • Parallelize load building with goroutines and a channel; aggregate txs; improve nonce error handling/logging.
  • Runner init:
    • Switch to NewTxDistributionBootstrapped(logger, wallets, initial) with info logs; use wallet.GetNonce and progress logs during nonce initialization (chains/ethereum/runner/runner.go).
  • TxFactory:
    • createMsgNativeGasTransfer: use pending balance (PendingBalanceAt) and fetch nonce via fromWallet.GetNonce; ignore passed nonce param (chains/ethereum/txfactory/factory.go).
  • Tx distribution:
    • Add logger and update constructor signature for TxDistributionBootstrapped; keep allocation/rotation logic; expose GetBaselineWallet (chains/ethereum/txfactory/tx_distribution_bootstrapped.go).
  • Tests:
    • Update to new constructor and add/reset assertions (chains/ethereum/txfactory/tx_distribution_bootstrapped_test.go).

Written by Cursor Bugbot for commit 35e3877. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Nov 14, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 16.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

r.logger.Error("nonce for wallet not found", zap.String("wallet", sender.Address().String()))
return
}
tx, err := r.txFactory.BuildTxs(msgSpec, sender, nonce.(uint64), useBaseline)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirming it is not possible to generate two txs for the same sender in a single load? i.e. GetNextSender will never return the same sender without returning nil in between? if it does there may be a nonce issue here due to goroutines, but from my quick look it doesnt look like that is a possible scenario.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetNextSender will return nil when it runs out of funded accounts which have not been used already. When we start a new round of load generation we will start over from index 0.

Once all wallets are funded we will reset sender and receiver indices to 0 and len(wallets)/2 respectively and iterate through N messages each time, incrementing modulo length of wallets.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

func (r *Runner) buildLoadPersistent(msgSpec loadtesttypes.LoadTestMsg, maxLoadSize int, useBaseline bool) ([]*gethtypes.Transaction, error) {
r.logger.Info("building load", zap.Int("maxLoadSize", maxLoadSize))
var txnLoad []*gethtypes.Transaction
var wg sync.WaitGroup
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Loop Variable Reference: Concurrency Bug

The loop captures the variable i by reference in the closure. When the goroutine executes, i will have the final value from the loop, causing all goroutines to write to sentTxs[len(txs)-1]. Capture i by value in the loop or pass it as a function parameter to ensure each goroutine writes to the correct index.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants