Repository navigation
core/vm: price the 0x68 double-sign-evidence precompile per input byte at Pasteur - #3772
Conversation
Pull Request ReviewThis PR updates the Go-based EVM implementation to use a Pasteur-specific variant of the double-sign evidence precompile at address Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Pull Request ReviewThis PR updates an Ethereum-compatible Go EVM so that, from the Pasteur fork, the double-sign-evidence precompile at 0x68 uses a fork-specific implementation with gas charged per input byte. It adds a 16-gas-per-byte protocol parameter while preserving the existing verification logic and base gas charge. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…e at Jenner verifyDoubleSignEvidence charges a flat DoubleSignEvidenceVerifyGas regardless of input size, while Run computes SealHash over both RLP-decoded headers whose Extra fields are not size-bounded, so the metered cost does not track the hashing work. Add a Jenner-gated variant (verifyDoubleSignEvidenceJenner) pricing per input byte (DoubleSignEvidenceVerifyPerByteGas = 16), mirroring 0x67's cometBFTLightBlockValidatePasteur. Verification logic inherited unchanged; pre-Jenner tables (including Pasteur) keep the flat-gas contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
539afa5 to
20c1f8d
Compare
Pull Request ReviewThis PR updates the Go-based EVM implementation so the double-sign-evidence precompile at address byte 0x68 uses a Jenner-specific gas calculator while retaining the existing verification logic. It adds a gas charge of 16 per input byte on top of the existing 10,000 base gas, mitigating underpriced processing of oversized RLP-encoded headers. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
|
core/vm: price the 0x68 double-sign-evidence precompile per input byte at Pasteur -> Jenner ? |
…yte at Jenner (#498) Ports bnb-chain/bsc#3772. Precompile 0x68 (DoubleSignEvidenceValidation) charges a flat 10,000 gas no matter how large the RLP-encoded headers in the evidence are, even though the work it does -- decoding both headers and computing two seal hashes over their full encoding -- scales with input size. A caller can therefore impose unbounded hashing for a fixed fee. From Jenner the cost becomes `10_000 + len(input) * 16`, mirroring go-bsc's `verifyDoubleSignEvidenceJenner.RequiredGas` and matching what Pasteur already did for 0x67 (`COMETBFT_LIGHT_BLOCK_VALIDATE_PER_BYTE_GAS`). The verification logic is untouched, so the accepted-input set is unchanged; only the price moves. Because the change is consensus-visible -- a call that succeeds at a 10,000 gas allowance before Jenner runs out of gas from Jenner -- it is fork-gated the same way go gates it, via a new cumulative Jenner precompile table that inherits Pasteur's and overrides 0x68. `traced_precompiles_for_spec` gains the matching arm ahead of Pasteur. Like go-bsc, the Jenner variant keeps the pre-Jenner precompile name ("VERIFY_DOUBLE_SIGN_EVIDENCE"): `verifyDoubleSignEvidenceJenner` embeds `verifyDoubleSignEvidence` and overrides only `RequiredGas`, inheriting `Name()`. BEP-706's 0x70 milli-timestamp precompile is deliberately not in the new table -- it reads block context and stays dynamically registered by `BscEvm::new`. Tests cover the per-byte charge on success, on revert (go charges `RequiredGas` before `Run`, so a rejected evidence still pays), the empty-input base-fee edge, the pre-Jenner/Jenner out-of-gas split at the same allowance, and that a Jenner-spec EVM resolves to the Jenner table rather than falling through to Pasteur's. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
No description provided.