Skip to content

made all Application.CheckTx calls recover panics (CON-259)#3334

Merged
pompon0 merged 13 commits into
mainfrom
gprusak-rpc-sharding
Apr 30, 2026
Merged

made all Application.CheckTx calls recover panics (CON-259)#3334
pompon0 merged 13 commits into
mainfrom
gprusak-rpc-sharding

Conversation

@pompon0

@pompon0 pompon0 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

This has been achieved by:

  • making tendermint logic operate on Proxy rather than Application
  • adding panic -> error conversion to Proxy.CheckTx and renamed it to Proxy.CheckTxSafe, so that Proxy no longer implements Application.

Additionally removed some remains of stateful leader election tests, unused PersistentKVStore.

@pompon0 pompon0 requested review from sei-will and wen-coding April 29, 2026 10:11
@github-actions

github-actions Bot commented Apr 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✅ passedApr 30, 2026, 7:41 AM

@pompon0 pompon0 changed the title made all Application.CheckTx calls recover panics made all Application.CheckTx calls recover panics (CON-259) Apr 29, 2026
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.82609% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.20%. Comparing base (1b32293) to head (9c302b6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/mempool/mempool.go 69.44% 8 Missing and 3 partials ⚠️
app/abci.go 0.00% 5 Missing ⚠️
sei-tendermint/internal/mempool/tx.go 0.00% 4 Missing ⚠️
sei-tendermint/abci/types/application.go 25.00% 3 Missing ⚠️
sei-tendermint/internal/proxy/proxy.go 94.44% 1 Missing ⚠️
sei-tendermint/internal/rpc/core/mempool.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3334      +/-   ##
==========================================
+ Coverage   59.18%   59.20%   +0.02%     
==========================================
  Files        2097     2098       +1     
  Lines      172517   172554      +37     
==========================================
+ Hits       102107   102166      +59     
+ Misses      61558    61541      -17     
+ Partials     8852     8847       -5     
Flag Coverage Δ
sei-chain-pr 65.72% <72.82%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-tendermint/abci/types/types.go 72.09% <ø> (ø)
sei-tendermint/internal/consensus/replay.go 69.13% <100.00%> (ø)
sei-tendermint/internal/consensus/replay_stubs.go 84.61% <100.00%> (+1.28%) ⬆️
sei-tendermint/internal/rpc/core/env.go 75.51% <ø> (ø)
sei-tendermint/internal/state/execution.go 80.58% <ø> (ø)
sei-tendermint/internal/statesync/reactor.go 70.70% <ø> (ø)
sei-tendermint/internal/statesync/syncer.go 68.03% <ø> (ø)
sei-tendermint/node/node.go 65.10% <100.00%> (-0.10%) ⬇️
sei-tendermint/node/public.go 63.15% <100.00%> (+0.99%) ⬆️
sei-tendermint/node/seed.go 48.48% <100.00%> (ø)
... and 6 more

... and 2 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 app/abci.go
if err != nil {
res := sdkerrors.ResponseCheckTx(err, 0, 0, false)
return &abci.ResponseCheckTxV2{ResponseCheckTx: &res}, err
return nil, err

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.

Why are we returning a nil result here now? Would this break any downstream tools?

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.

CheckTx is only called by tendermint

res, err := txmp.app.CheckTxSafe(ctx, &abci.RequestCheckTxV2{Tx: tx})
if err != nil {
removeHandler(true)
res.Log = txmp.AppendCheckTxErr(res.Log, err.Error())

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.

Do we not need the error on log any more?

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.

there is no res any more, so there is no Log to add it to.

Comment thread sei-tendermint/internal/proxy/proxy.go Outdated
defer addTimeSample(app.metrics.MethodTiming.With("method", "check_tx", "type", "sync"))()
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic recovered in CheckTxSafe: %v", r)

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.

Should we attach debug.Stack() here for debugging?

Maybe we should log this as well?

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.

it will be logged by the caller. I will add the stack.

// sm.SaveState(stateDB,state) //height 1's validatorsInfo already saved in LoadStateFromDBOrGenesisDoc above

css[i] = newStateWithConfig(t, thisConfig, state, privVal, app)
proxyApp := proxy.New(app, proxy.NopMetrics())

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.

nit: if it's always proxy.NopMetrics() maybe we can use a constructor to hide this.

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.

in prod we use actual metrics. In tests we usually use kvstore.NewProxy() to hide this, but in those cases where app needs to be adjusted before wrapping we call proxy.New() directly

Comment thread sei-tendermint/internal/mempool/mempool.go
@pompon0 pompon0 enabled auto-merge April 30, 2026 07:40
@pompon0 pompon0 added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit 08689b2 Apr 30, 2026
38 checks passed
@pompon0 pompon0 deleted the gprusak-rpc-sharding branch April 30, 2026 08:08
revofusion pushed a commit to revofusion/sei-chain that referenced this pull request May 6, 2026
…ol#3386)

sei-protocol#3334 made
TxMempool.CheckTx and Application.CheckTx return an error instead of
ResponseCheckTx with an error code. This PR reverts to the previous
behavior. Since there is no case in which Application.CheckTx returns
unwrapped error, the signature has been tightened to always return
ResponseCheckTxV2. Proxy.CheckTxSafe() keeps returning
(*ResponseCheckTxV2,error) though, so that in case of panic the stack
trace is not send as part of the RPC response.
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.

3 participants