-
Notifications
You must be signed in to change notification settings - Fork 0
Run persistent tx generation in parallel, cache account balances #37
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
base: main
Are you sure you want to change the base?
Conversation
|
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
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.
requiredBootstrapLoads, trackblocksProcessed, and publish load everybootstrapBackoffblocks while funding wallets (chains/ethereum/runner/persistent.go).NewTxDistributionBootstrapped(logger, wallets, initial)with info logs; usewallet.GetNonceand progress logs during nonce initialization (chains/ethereum/runner/runner.go).createMsgNativeGasTransfer: use pending balance (PendingBalanceAt) and fetch nonce viafromWallet.GetNonce; ignore passed nonce param (chains/ethereum/txfactory/factory.go).TxDistributionBootstrapped; keep allocation/rotation logic; exposeGetBaselineWallet(chains/ethereum/txfactory/tx_distribution_bootstrapped.go).chains/ethereum/txfactory/tx_distribution_bootstrapped_test.go).Written by Cursor Bugbot for commit 35e3877. This will update automatically on new commits. Configure here.