Skip to content

Merge all bench into gigasim - #4390

Merged
yzang2019 merged 10 commits into
mainfrom
yzang/merge-cryptosim
Sep 30, 2026
Merged

yzang2019 merged 10 commits into
mainfrom
yzang/merge-cryptosim

Conversation

@yzang2019

@yzang2019 yzang2019 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Makes gigasim the single storage benchmark. It already ran the whole GigaStorageManager stack end to end; this closes the gaps that kept blocksim (block ledger only), cryptosim (state DB only) and walsim (WAL only) around, then deletes those three and their dashboards.

Workload

  • New TransactionType: erc20 (default) or transfer.
    • ERC20: reads token code, the sender's account and both balance slots; writes the sender's account and both slots. The recipient's account is not touched, as on chain.
    • Transfer: reads and writes both accounts' native balances; no contract code or storage. Always 21,000 gas.
  • ERC20 balance slots are keyed by token contract address + holder, so a hot token is a hot key range. Each account holds Erc20InteractionsPerAccount tokens and sends one of them.
  • Accounts are read and written through the native balance field (was the code hash as a stand-in).
  • Blocks can carry more transactions than a ledger block's 2,000 payload entries: ledgerPayload packs several per entry, still within the 2 MiB byte budget.

Config changes

  • Added:
    • TransactionType (default erc20)
    • Erc20GasPerTransaction (50,000)
    • MaxTps (0 = unthrottled), replacing MaxBlocksPerSecond
    • PprofAddr (empty = off), MutexProfileFraction (0), BlockProfileRate (0)
    • AccountCacheSizeBytes (1 GiB), CodeCacheSizeBytes (1 GiB), StorageCacheSizeBytes (4 GiB)
  • Removed:
    • MaxBlocksPerSecond (use MaxTps)
    • LogDir: logs always go to DataDir/logs
  • Changed defaults:
    • TransactionsPerBlock 2,000 → 10,000
    • BytesPerTransaction 256 → 200
    • MaxPendingExecutionQueueSize 100 → 20
    • FlushIntervalBlocks 10 → 1
    • Erc20ContractSize 4,096 → 2,048
    • LookbackWindow 1,000,000 → 100,000
    • CheckpointIntervalSeconds 60 → 300
    • CheckpointBlockInterval 0 → 5,000
  • Changed meaning:
    • Erc20InteractionsPerAccount: number of tokens each account holds
    • HotErc20ContractProbability: share of holdings (and so of transfers) in the hot token set
    • TransactionsPerBlock: now capped at 1,000,000 instead of 2,000
  • Shipped configs:
    • standard.json renamed to full-node.json, with LookbackWindow 1,000,000
    • New archive-node.json: LookbackWindow -1, keeps all history
    • validator.json: LookbackWindow 0
    • debug.json: MaxBlocksPerSecond 10 → MaxTps 1,000
    • All set TransactionType explicitly, and none set LogDir

Metrics and dashboard

  • New gigasim metrics: gigasim_gas_used_total, gigasim_store_keys_written_total{store}, and a type label on gigasim_transactions_executed_total.
  • Dashboard: gigagas/sec, state keys written/sec per store, TPS by transaction type, per-read latency percentiles, process I/O, a Retention row, and the Pebble rows ported from the cryptosim dashboard. All panels have transparent backgrounds.
  • Prometheus scrape job cryptosim renamed to gigasim.

Removed

  • sei-db/bench/blocksim, cryptosim and walsim, plus the blocksim and cryptosim dashboards. Cryptosim's Ubuntu setup script moves to gigasim/tools/, and its Prometheus/Grafana and AWS instructions move into the gigasim README.

Risk

  • One change outside the benchmark: the storage garbage collector (sei-db/controller) now publishes storage_gc_* metrics (cut lines, per-store rollback floors, per-store prune duration and errors). Pruning decisions are unchanged, but nodes running the collector will export these metrics too.
  • Existing gigasim data directories should be rebuilt: account and balance-slot keys changed.
  • Configs that set MaxBlocksPerSecond or LogDir now fail to load (unknown fields are rejected).

Validation

  • gigasim, controller, common metrics and block store tests pass under -race.
  • Live runs of both transaction types confirmed the gas and keys-written numbers.

@cursor

cursor Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Mostly deletes benchmark-only code and retargets monitoring; additive storage GC metrics do not change pruning logic, but gigasim key layout and config field renames break existing benchmark runs until data and JSON are refreshed.

Overview
Consolidates sei-db storage benchmarking into gigasim, removing the standalone blocksim, cryptosim, and walsim trees (binaries, configs, tests, and shell wrappers) along with the BlockSim Grafana dashboard.

Monitoring and repo hygiene follow that consolidation: Prometheus scrape job cryptosim → gigasim, .gitignore drops artifact paths for the deleted sims, and Autobahn docs now refer only to gigasim when restarting Prometheus.

Gigasim logging setup changes so configure-logger resolves DataDir, creates logs under DataDir/logs via LogDir() / LogFile() (no separate LogDir in shipped configs), and adds archive-node.json (LookbackWindow: -1) as a shipped profile.

Per the broader PR scope (not all visible in the diff snippet), gigasim also picks up the former sims’ workloads and knobs—e.g. TransactionType (erc20 / transfer), MaxTps instead of block-rate throttles, expanded metrics/dashboard panels, and storage_gc_* OTel metrics from the storage garbage collector without changing prune behavior. Existing gigasim data dirs and configs using removed fields should be rebuilt or updated.

Reviewed by Cursor Bugbot for commit c07c5fb. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 30, 2026, 9:52 PM

@seidroid seidroid Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reworks gigasim's workload and tooling: an ERC20-or-native TransactionType with holder-keyed token balance slots, ledger payload packing so blocks can carry more than 2,000 transactions, a MaxTps throttle, logs moved under DataDir, configurable FlatKV cache sizes, an opt-in pprof server, and storage_gc_ metrics on the garbage collector. Nothing in the changed code breaks correctness: the removed symbols have no callers left, and the claim/clean logic now keeps the open log file. The one scout claim does not hold, and no Go toolchain was available, so nothing was built or tested.

Non-blocking

1 finding on the changed lines, as inline comments.

  • The title says "Merge all bench into gigasim", but sei-db/bench/blocksim and sei-db/bench/cryptosim are untouched, and the description is still the unfilled template. A reviewer can't tell whether the default changes (10,000 tx × 200 B blocks, FlushIntervalBlocks 1, queue depth 20, LookbackWindow 100,000, checkpoints every 5,000 blocks) are deliberate retuning or leftovers from a local experiment.
  • Scout codex's one finding was dropped: it said emptyLogDir (gigasim.go:811) falls off the end without a return. The merged tree ends the function with return nil; the diff hunk just stops before that line.
1 nit, not posted on the code
  • sei-db/common/metrics/pprof.go:26 — The README's example PprofAddr of ":6060" binds every interface, which exposes /debug/pprof/cmdline and heap and goroutine dumps to anyone who can reach the host. A localhost:6060 example would be a safer thing to copy.

seidroid review · decision approve · session 57e08a802c044d3a9c021a2f547c8af2 · turn resp_claude_d235748bcc71485a54b8dce3b6109b6b · item 04d99a2e828150f4a49310f817b270e3

Findings: 0 blocking | 3 non-blocking | 1 posted inline

Comment thread sei-db/bench/gigasim/account_model.go
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.55%. Comparing base (2362063) to head (c07c5fb).

Files with missing lines Patch % Lines
sei-db/common/metrics/pprof.go 92.30% 2 Missing ⚠️
sei-db/controller/gc_metrics.go 88.23% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4390      +/-   ##
==========================================
+ Coverage   55.53%   55.55%   +0.01%     
==========================================
  Files        2176     2178       +2     
  Lines      169020   169086      +66     
==========================================
+ Hits        93868    93935      +67     
+ Misses      75147    75146       -1     
  Partials        5        5              
Flag Coverage Δ
sei-chain 53.69% <95.23%> (+0.01%) ⬆️
sei-db 74.81% <ø> (ø)
sei-db-state-db 78.63% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/controller/storage_garbage_collector.go 98.71% <100.00%> (-1.29%) ⬇️
sei-db/db_engine/view/read_cache.go 95.85% <ø> (+0.51%) ⬆️
sei-db/db_engine/view/shard.go 82.84% <ø> (-0.20%) ⬇️
sei-db/db_engine/view/view_manager_impl.go 90.78% <100.00%> (ø)
sei-db/db_engine/view/view_manager_metrics.go 98.78% <100.00%> (+0.25%) ⬆️
sei-db/common/metrics/pprof.go 92.30% <92.30%> (ø)
sei-db/controller/gc_metrics.go 88.23% <88.23%> (ø)

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread sei-db/bench/gigasim/receipt.go Outdated
senderTopic := indexedAddressTopic(addressFromKey(txn.srcAccount))
receiverTopic := indexedAddressTopic(addressFromKey(txn.dstAccount))

gasUsed := receiptGasUsedBase + rand.Int64Range(0, receiptGasUsedSpan)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ERC20 receipt gas and reported gas differ

Each ERC20 receipt stores 52,000 plus a random value in [0, 18,000). The block header and gigasim_gas_used_total use Erc20GasPerTransaction, which defaults to 50,000. A sum of receipt gas and the gigagas panel tell different stories. The README table says the ERC20 gas is 50,000.
Fix: Write Erc20GasPerTransaction into the ERC20 receipt, and make CumulativeGasUsed the sum of those values. Keep the random draw only if the README says that receipt gas is a separate synthetic range.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@alrevuelta alrevuelta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great!

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 602499e. Configure here.

Comment thread sei-db/bench/gigasim/receipt.go
@yzang2019

Copy link
Copy Markdown
Contributor Author

@seidroid review

@seidroid seidroid Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since my last review the PR deletes blocksim, cryptosim and walsim along with their dashboards, moves cryptosim's setup script and Prometheus/AWS instructions into gigasim, and adds per-shard atomic hit/miss counting to the view cache's metrics; the gigasim workload changes are the same as before. Nothing in the new code blocks: no references to the deleted benchmarks remain, and I'm resolving my resume-compatibility thread because the description now says old data directories must be rebuilt. Codex's missing-return claim on emptyLogDir is dropped again because the function ends in return nil in the merged tree. No Go toolchain was available, so nothing was built or tested.

Non-blocking

  • View cache hit and miss counters now reach OTel only once per MetricsScrapeInterval, not on every read. Dashboards will see those rates move in steps of one scrape interval, and a short interval is the only way to get finer resolution.
1 nit, not posted on the code
  • sei-db/common/metrics/pprof.go:26 — The README's example PprofAddr of ":6060" binds every interface. That exposes /debug/pprof/cmdline and heap and goroutine dumps to anyone who can reach the host, which matters most on the AWS setup the README now describes. A localhost:6060 example would be safer to copy.

seidroid review · decision approve · session 57e08a802c044d3a9c021a2f547c8af2 · turn resp_claude_30065f9b53eb0a149559e10707a65adb · item 4f35470bda2d5684b7ed57c830c8ec1a

Findings: 0 blocking | 1 non-blocking | 0 posted inline

@yzang2019
yzang2019 added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 82c82a1 Sep 30, 2026
58 checks passed
@yzang2019
yzang2019 deleted the yzang/merge-cryptosim branch September 30, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants