Repository navigation
Conversation
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The gno.land ante wrapper decodes the auth params (
acck.GetParams) and the vm params(
vmk.GetParamsplusApplyToGasConfig) for every transaction it sees. Both amino-unmarshalevery field and bech32-decode every allowlist entry. Profiled with stage timers on a 5000-deep
mempool, the two decodes take about 305 us p50 (
auth_params148 us,vm_params157 us), 37% of arecheck, more than the 31% spent on signature verification. With recheck on, every pending
transaction pays them again after every block, although CheckTx cannot see a params change
between two commits.
Change
gno.land/pkg/gnoland/anteparams.go:checkTxParamsmemoizes the decoded auth params, vmparams and derived gas config for
RunTxModeCheck, keyed on the CheckTx context's height.app.go: the wrapper reads all three through it. The decode itself is moved verbatim into aclosure; the order of reads relative to the gas meter is unchanged.
gno.land/adr/prxxxx_checktx_params_cache.md.Invalidation
and on load, each time with the header of the block just committed, and CheckTx runs the ante
handler but never a message handler, so nothing writes params between two commits as CheckTx
sees them. A params change made by a tx in block H reaches CheckTx through the check state of
height H, which misses the entry for H-1.
cache and decode on every call, as today, so the next tx of the same block sees the new value.
checkCodePolicy, the gas config copy) do not mutate them.Consensus: none
DeliverTx is untouched by construction. Both reads already bypass the gas meter, so skipping them
in CheckTx changes no gas. End to end below: identical app hash and identical gas.
In-tree benchmark
BenchmarkCheckTxRecheck(new,gno.land/pkg/gnoland/checktx_bench_test.go): oneCheckTx(Type: Recheck)of a bank send through the full app per iteration. Base is master withonly the benchmark file added; the two test binaries were run alternately, 8 rounds,
-test.benchtime 2000x,taskset -c 10-19, GOMAXPROCS=10, loadavg 20.33 at start, 17.12 at end.End to end, mempool depth 5000
Same driver and method as PR 1 (real
CListMempool, depth held at 5000, 100 tx per block, 10blocks per run, master and branch alternated back to back on the same cores). Loadavg 16.95 at
start, 27.82 at end (09:28 to 09:35 UTC+1): the host got busier during rep 3.
Paired, per rep: block p50 -28.1%, -16.2%, -33.2%: mean -25.9%, 95% CI -47.5% to -4.2%.
tx/s +39.1%, +19.4%, +49.8%: mean +36.1%, 95% CI -2.2% to +74.4%, which does not exclude zero
at n=3. Recheck p50 -35.4%, -23.6%, -39.6%. Branch rep 2 is the outlier (stddev 374 ms against
59 to 217 elsewhere, a noisy-neighbour signature); the benchstat above, at n=8, is the tighter
number.
Consensus check, identical in all six runs and identical to PR 1's runs: final app hash
CD51267EAF24E728DCA53B38EDDBED42088357B1DE19B40EF97BB4DC0AB41318, app-hash chain43FD38708089B6A90D2013C346973F10658A913B666E96E4B52317F04C75CB30, DeliverTx gas 17,691,156,145,CheckTx gas 34,990,311,192, 0 CheckTx failures.
Tests
TestCheckTxParams: CheckTx at one height decodes once; a change made in DeliverTx at the nextheight is seen by DeliverTx at once (it never uses the cache) and by CheckTx once the height
moves; simulate never caches; height 0 never caches. Broken on purpose to see it fail: ignoring
the height fails it, caching in DeliverTx fails it.
Out of scope
path).
gpk.LastGasPrice, also read per tx; small.argued from BaseApp's check-state lifecycle and unit-tested on the cache.
AI-assisted: written with an AI coding agent and reviewed by the author; design notes in the ADR.