docs: clarify precompile table and limit hot-path comments#320
Open
mark0-cn wants to merge 1 commit into
Open
Conversation
- precompiles(): document that the gas-cost overrides are baked into the table and the compute-gas accounting / REX5 forwarded-gas cap happen in run(), replacing the stale "for now" note. - after_frame_init: explain why it defers its latch to before_frame_run, per the resource-limit check protocol. - compute_gas_ext: replace "TODO: add more doc" with a real module doc.
Author
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.
Summary
Documentation/comment-only cleanup of three spots in the precompile provider and the EVM hot path.
No behavior change: no spec semantics, gas accounting, or control flow is touched.
Changes
MegaPrecompiles::precompiles()(evm/precompiles.rs): the doc claimed it "returns precompiles with custom gas cost overrides for MINI_REX spec" while the body just returned the inner table under a// For nownote.Rewrote it to state accurately that the precompile gas-cost overrides (fixed-cost KZG point evaluation, Osaka ModExp schedule) are baked into the table by
mini_rex()/rex(), while the per-spec compute-gas accounting and the REX5 forwarded-gas cap are applied separately inrun().AdditionalLimit::after_frame_init(limit/limit.rs): added a comment explaining why this site records the child frame's init growth without callingcheck_limit()itself.before_frame_runlatches any exceed before the first metered opcode, so the deferral is sound under the fixed frame lifecycle order (per the Resource-Limit Check Protocol).This is the one frame-lifecycle hook that defers its latch, so the reasoning is now written down.
compute_gas_extmodule (evm/instructions.rs): replaced theTODO: add more docplaceholder with a real module doc describing the per-opcode compute-gas wrappers and thedefault/@frame/SELFDESTRUCTvariants.Testing
cargo fmt --all --check: clean.