feat(loadtest): per-transaction calldata from stdin for contract-call mode - #1022
Merged
Merged
Conversation
… mode Add --calldata-stdin and --calldata-size to contract-call mode. Stdin is read as raw bytes and cut into fixed-size chunks, and each transaction carries the next chunk as its calldata, so a shell pipeline can generate a distinct payload per transaction. The test stops cleanly when stdin reaches EOF or when the request count is reached, whichever comes first. Modes that draw from an external stream implement mode.InputReserver. The runner reserves the input before taking a nonce, so an exhausted stream never leaves a reserved nonce unsent, and once a request holds a nonce it always runs to completion. A read error on stdin ends the run non-zero instead of being mistaken for EOF. The flag requires contract-call to be the sole mode, is mutually exclusive with --calldata, --calldata-file and --reverse-nonce-order, rejects a terminal on stdin, and caps the chunk size at 1 MiB. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
leovct
approved these changes
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
--calldataand--calldata-filesend the same payload in everycontract-calltransaction. This adds--calldata-stdinand--calldata-sizeso each transaction gets its own calldata from a shell pipeline.--calldata-sizechunks. Each transaction carries the next chunk. A trailing partial chunk is discarded with a warning.mode.InputReserverinterface. The runner reserves the input before taking a nonce, so an exhausted stream never leaves a reserved nonce unsent (which would stall the final-block wait). Once a request holds a nonce it always runs to completion.contract-callas the sole mode; mutually exclusive with--calldata,--calldata-file, and--reverse-nonce-order; rejects a terminal on stdin; caps chunk size at 1 MiB.Not breaking. No new dependencies (
golang.org/x/termwas already direct).Pre-existing gap noticed while here, not changed: the
uniswapv3subcommand never callscfg.Validate(). The new flags are local to the parent command so it cannot reach them.Jira / Linear Tickets
Testing
go test -race ./loadtest/... ./cmd/...,golangci-lint,go vet,typos,go run docutil/*.goall clean.TestValidateCalldataStdin), chunk feeder (exact multiple, partial tail, empty input, read error, cancellation while blocked, reader exit when buffer full, 16 concurrent consumers with-race), contract-call mode (per-chunk calldata via reserve + execute, unreserved execute fails, stale feeder cleared onInit, legacy vs dynamic fee tx build).--gas-limit 100000:--concurrency 8 --requests 100: exactly 25 txs sent, stopped at EOF, final-block wait completed, 0 errors, exit 0.--concurrency 8 --requests 3: exactly 24 txs sent (request cap wins).--output-raw-tx-only: decoded raw txs carry differentinputper chunk.< /dev/null: 0 txs, clean stop.script): rejected with the intended message.--reverse-nonce-orderand--calldata-size 2000000: rejected at validation.🤖 Generated with Claude Code