fix(mempool): fall back to app.ChainID() for EVM sig preverifier when chain-id flag is unset - #2186
fix(mempool): fall back to app.ChainID() for EVM sig preverifier when chain-id flag is unset#2186JayT106 wants to merge 5 commits into
Conversation
… chain-id flag is unset chainId from the --chain-id flag is empty on a bare `start` (chain ID is only known from genesis at InitChain time), which silently no-ops NewEVMSigPreVerifier since ethermint.ParseChainID fails on "". Fall back to app.ChainID(), which server.DefaultBaseappOptions already resolves from genesis before this closure runs.
This comment has been minimized.
This comment has been minimized.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe EVM signature pre-verifier now uses ChangesPre-verifier chain ID resolution
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change restores EVM signature preverification when the chain-id flag is unset while preserving explicit flag behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@claude review |
|
Claude finished @JayT106's task in 3m 11s —— View job Code Review
SummaryThis is a clean, minimal fix. The bug is real: No breaking changes. This is purely a runtime/initialization fix — no state mutations, no consensus changes, no migrations required. Correctness of the ordering claimThe key correctness invariant is that
This makes the fallback reliable for normal Observations1. Edge case: both empty ( If neither the flag nor 2. Test file: testify suite for a 3-case pure function Using func TestResolvePreVerifierChainID(t *testing.T) {
for _, tc := range []struct{ ... }{ ... } {
t.Run(tc.name, func(t *testing.T) {
require.Equal(t, tc.expected, resolvePreVerifierChainID(tc.flagChainID, tc.appChainID))
})
}
}This is non-blocking — if the suite pattern matches codebase conventions, keep it. 3. Removed The comment deletion is fine — the code is self-descriptive and consistent with this repo's "no obvious comments" preference. VerdictLGTM. Logic is correct, tests cover the three meaningful cases, no state-breaking changes, changelog is in order. The test-file style note is optional. |
What
app/app.go's mempool setup now registers the EVM signature preverifier (appmempool.NewEVMSigPreVerifier) withapp.ChainID()instead of the raw--chain-idflag value.Issue
The flag is empty on a bare
cronosd start— the chain ID is only known from genesis atInitChaintime.ethermint.ParseChainIDfails on an empty string, soNewEVMSigPreVerifiersilently returnsniland the preverifier never registers. Every tx admission then pays the full ecrecover cost inside the admission mutex instead of hitting the sender cache populated by the (never-running) preverifier — this was found while diagnosing a mempool-admission throughput ceiling.newApp()buildsbaseappOptionsviaserver.DefaultBaseappOptions(appOpts), which already resolves the flag-or-genesis chain ID and applies it withbaseapp.SetChainID— and that option runs before this closure, sincebaseapp.NewBaseAppapplies options in slice order. Soapp.ChainID()at this point already equals.Solution
appmempool.NewEVMSigPreVerifier(app.ChainID(), activeDecoder, senderCache)directly.