Skip to content

Conversation

@jewei1997
Copy link
Contributor

@jewei1997 jewei1997 commented Jan 14, 2026

Describe your changes and provide context

This PR converts the current ReceiptDB interface from StateStore interface to using a receipt-specific interface. In a future PR, we will add in the new Parquet implementation for receipts.

Testing performed to validate your change

unit tests.

@github-actions
Copy link

github-actions bot commented Jan 14, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJan 21, 2026, 3:48 PM

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.89%. Comparing base (ec08797) to head (f4d3d6c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2701      +/-   ##
==========================================
- Coverage   43.96%   41.89%   -2.07%     
==========================================
  Files        1978     1015     -963     
  Lines      162479    84542   -77937     
==========================================
- Hits        71439    35422   -36017     
+ Misses      84544    45797   -38747     
+ Partials     6496     3323    -3173     
Flag Coverage Δ
sei-chain ?
sei-cosmos 38.06% <ø> (-0.01%) ⬇️
sei-db 68.72% <ø> (ø)
sei-tendermint 47.25% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 978 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.

}
go func() {
for {
pruneStartTime := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Comment on lines 321 to 339
go func() {
for {
pruneStartTime := time.Now()
latestVersion := db.GetLatestVersion()
pruneVersion := latestVersion - keepRecent
if pruneVersion > 0 {
// prune all versions up to and including the pruneVersion
if err := db.Prune(pruneVersion); err != nil {
log.Error("failed to prune receipt store till", "version", pruneVersion, "err", err)
}
log.Info(fmt.Sprintf("Pruned receipt store till version %d took %s\n", pruneVersion, time.Since(pruneStartTime)))
}

// Generate a random percentage (between 0% and 100%) of the fixed interval as a delay
randomPercentage := rand.Float64()
randomDelay := int64(float64(pruneInterval) * randomPercentage)
time.Sleep(time.Duration(pruneInterval+randomDelay) * time.Second)
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
jewei1997 and others added 7 commits January 15, 2026 13:59
- Add sentinel errors ErrNotFound and ErrNotConfigured for consistent error checking
- Add shutdown mechanism for pruning goroutine with stopPruning channel
- Update Close() to signal pruning goroutine to stop using sync.Once
- Update x/evm/keeper/receipt.go to use sentinel errors and errors.Is()
- Replace string-based error comparison with errors.Is() for better error handling

Co-authored-by: jeremy <jeremy@seinetwork.io>

// Generate a random percentage (between 0% and 100%) of the fixed interval as a delay
randomPercentage := rand.Float64()
randomDelay := int64(float64(pruneInterval) * randomPercentage)

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
cursoragent and others added 7 commits January 16, 2026 22:03
- Rename StoreReceipts to SetReceipts for consistency
- Rename LatestHeight to LatestVersion
- Rename SetLatestHeight to SetLatestVersion
- Rename SetEarliestHeight to SetEarliestVersion
- Update all usages in keeper, evmrpc, and tests

Co-authored-by: jeremy <jeremy@seinetwork.io>
@jewei1997 jewei1997 requested review from Kbhat1 and yzang2019 January 20, 2026 18:02
@jewei1997 jewei1997 changed the title New receiptDB receipt-specific interface [STO-308] New receiptDB receipt-specific interface Jan 20, 2026
closeOnce sync.Once
}

func NewReceiptStore(log dbLogger.Logger, config dbconfig.StateStoreConfig, storeKey sdk.StoreKey) (ReceiptStore, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would recommend we create a ReceiptStoreConfig instead of reusing the StateStoreConfig

return ErrNotConfigured
}

pairs := make([]*iavl.KVPair, 0, len(receipts))
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we plan to add Parquet based backend logic in the future? These logic are all specific to Pebble backend now, do we plan to do another refactor in the next PR to wrap these logic into a separate function?

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