Skip to content

Add receiptdb config option in app.toml#3035

Merged
jewei1997 merged 11 commits intomainfrom
app-toml-controls-receiptdb
Mar 10, 2026
Merged

Add receiptdb config option in app.toml#3035
jewei1997 merged 11 commits intomainfrom
app-toml-controls-receiptdb

Conversation

@jewei1997
Copy link
Contributor

Describe your changes and provide context

Testing performed to validate your change

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 10, 2026, 5:38 PM

@jewei1997 jewei1997 changed the title app toml controls receipt Add receiptdb config option in app.toml Mar 6, 2026
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 76.47059% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.35%. Comparing base (7131e2f) to head (76566dc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-db/config/receipt_config.go 71.42% 5 Missing and 5 partials ⚠️
sei-db/ledger_db/receipt/receipt_store.go 53.84% 5 Missing and 1 partial ⚠️
app/test_helpers.go 89.74% 2 Missing and 2 partials ⚠️
app/app.go 33.33% 1 Missing and 1 partial ⚠️
app/receipt_store_config.go 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3035      +/-   ##
==========================================
+ Coverage   58.31%   58.35%   +0.03%     
==========================================
  Files        2079     2080       +1     
  Lines      171804   171898      +94     
==========================================
+ Hits       100193   100315     +122     
+ Misses      62681    62649      -32     
- Partials     8930     8934       +4     
Flag Coverage Δ
sei-chain-pr 48.22% <76.47%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
cmd/seid/cmd/app_config.go 100.00% <100.00%> (ø)
cmd/seid/cmd/root.go 24.08% <100.00%> (+24.08%) ⬆️
app/app.go 68.39% <33.33%> (-1.51%) ⬇️
app/receipt_store_config.go 71.42% <71.42%> (ø)
app/test_helpers.go 63.80% <89.74%> (+1.65%) ⬆️
sei-db/ledger_db/receipt/receipt_store.go 70.70% <53.84%> (-1.19%) ⬇️
sei-db/config/receipt_config.go 75.60% <71.42%> (-24.40%) ⬇️

... and 32 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.

app/seidb.go Outdated
func parseReceiptConfigs(appOpts servertypes.AppOptions) config.ReceiptStoreConfig {
receiptConfig := config.DefaultReceiptStoreConfig()
if backend := cast.ToString(appOpts.Get(FlagRSBackend)); backend != "" {
receiptConfig.Backend = backend
Copy link
Contributor

Choose a reason for hiding this comment

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

parseReceiptConfigs() only reads FlagRSBackend. The remaining fields (AsyncWriteBuffer, KeepRecent, PruneIntervalSeconds, UseDefaultComparer) come from DefaultReceiptStoreConfig(). The TOML template also only renders rs-backend.

is this expected?

@blindchaser
Copy link
Contributor

suggestion for testings:

  • A test with an invalid backend string to verify it either errors at parse time or at store creation time.
  • A test that exercises the full app.New path with rs-backend = "parquet" to ensure the parquet store is actually instantiated end-to-end

customAppTemplate := serverconfig.ManualConfigTemplate +
seidbconfig.StateCommitConfigTemplate +
seidbconfig.StateStoreConfigTemplate +
seidbconfig.ReceiptStoreConfigTemplate +
Copy link
Contributor

Choose a reason for hiding this comment

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

ReceiptStoreConfigTemplate only has one config for rs-backend, what about other configs? Do we want to allow people to configure them as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

This commit introduces additional configuration options for the receipt store, including `db-directory`, `async-write-buffer`, `keep-recent`, and `prune-interval-seconds`. The changes include updates to the TOML configuration template, the receipt store configuration struct, and the associated reading logic.

Unit tests have been added to ensure that these new configuration options are correctly parsed and utilized, as well as to verify that the receipt store behaves as expected with the new settings. This enhances the flexibility and usability of the receipt store configuration.
receiptConfig := ssconfig.DefaultReceiptStoreConfig()
receiptConfig.DBDirectory = receiptStorePath
receiptConfig.KeepRecent = cast.ToInt(appOpts.Get(server.FlagMinRetainBlocks))
receiptConfig, err := readReceiptStoreConfig(homePath, appOpts)
Copy link
Contributor

Choose a reason for hiding this comment

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

on main, the receipt store inherited its pruning window from min-retain-blocks. This branch removes that fallback and defaults receipts to DefaultReceiptStoreConfig().KeepRecent instead. BaseApp still uses min-retain-blocks, so after upgrade the node can retain far more receipt data than before unless receipt-store.keep-recent is manually set. The updated test also locks in this new behavior.

is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the default matches up with DefaultSSKeepRecent (100k) so I don't think it's a big deal if not set.

@jewei1997 jewei1997 enabled auto-merge (squash) March 10, 2026 17:43
@jewei1997 jewei1997 merged commit fa2080d into main Mar 10, 2026
35 checks passed
@jewei1997 jewei1997 deleted the app-toml-controls-receiptdb branch March 10, 2026 17:55
blindchaser added a commit that referenced this pull request Mar 13, 2026
This commit was inadvertently reverted by the squash-merge of #3039.
Restores ReceiptStoreConfig in app.toml, readReceiptStoreConfig(),
BackendTypeName(), receipt config tests, and init_test.go.

Conflicts resolved:
- app_config.go: kept both ReceiptStore (from #3035) and Admin (from #3062)
- receipt_store.go: kept BackendTypeName but used #3050's slog convention
- parquet_store_test.go: kept #3053's deterministic pruning test fix

Made-with: Cursor
blindchaser added a commit that referenced this pull request Mar 13, 2026
The cherry-picked tests from #3035 and #3043 still referenced the
old logger package (removed by #3050 slog migration). Fix:
- composite/store_test.go: remove logger import/arg, add CommittedRootHash to mock
- parquet/store_config_test.go: remove dbLogger arg from NewStore
- receipt/parquet_store_test.go: remove dbLogger arg from NewReceiptStore

Made-with: Cursor
github-merge-queue bot pushed a commit that referenced this pull request Mar 13, 2026
## Summary

The squash-merge of #3039 (`feat(flatkv): add read-only LoadVersion for
state sync`) inadvertently reverted changes from 5 previously-merged
PRs. The `yiren/flatkv-readonly` branch had accumulated stale versions
of files through merge-from-main commits, and when the final
squash-merge landed, those stale versions overwrote the newer code on
`main`.

### PRs reverted by #3039 and restored in this PR

| PR | Title | Key changes lost |
|---|---|---|
| **#2810** | fix(giga): check whether txs follow Giga ordering |
`firstCosmosSeen` tx ordering check, `len(evmEntries) > 0` /
`len(v2Entries) > 0` guards in `ProcessTXsWithOCCGiga` |
| **#3035** | Add receiptdb config option in app.toml |
`ReceiptStoreConfig` in app.toml, `readReceiptStoreConfig()`,
`BackendTypeName()`, receipt config tests |
| **#3043** | Add config to enable lattice hash | `EnableLatticeHash`
config, composite store lattice hash support |
| **#3021** | Background Transaction Generation | `block.go`,
`block_builder.go` for cryptosim benchmark |
| **#3046** | Add console logger and fix memiavl config for benchmark |
`BlocksPerCommit=1`, `SnapshotInterval=1000`,
`SnapshotMinTimeInterval=60` |

### Conflict resolutions

Since several PRs landed after #3039 (notably #3050 slog migration,
#3053 flaky test fix, #3062 admin service), cherry-picks required manual
conflict resolution:

- **`app/app.go`** (#2810): Kept #2810's structural changes, used
`logger.Error` (from #3050) instead of `ctx.Logger().Error`
- **`cmd/seid/cmd/app_config.go`** (#3035): Kept both `ReceiptStore`
(from #3035) and `Admin` (from #3062)
- **`sei-db/ledger_db/receipt/receipt_store.go`** (#3035): Restored
`BackendTypeName` but dropped logger param (superseded by #3050 slog)
- **`sei-db/ledger_db/receipt/parquet_store_test.go`** (#3035): Kept
#3053's deterministic pruning test fix
- **`sei-db/state_db/sc/composite/store_test.go`** (#3043): Merged all
three needed imports
- **`sei-db/common/logger/logger.go`** (#3046): Kept deletion from
#3050; `consoleLogger` is no longer needed with slog
- **`sei-db/state_db/bench/wrappers/db_implementations.go`** (#3046):
Kept #3050's no-logger-param API

---------

Signed-off-by: Cody Littley <cody.littley@seinetwork.io>
Co-authored-by: Cody Littley <56973212+cody-littley@users.noreply.github.com>
Co-authored-by: Cody Littley <cody.littley@seinetwork.io>
yzang2019 pushed a commit that referenced this pull request Mar 19, 2026
---------

Co-authored-by: Kartik Bhat <kartikbhatri@gmail.com>
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