perf(protocol): optimize propose/prove gas via non-upgradeable checkers and new entry points#21502
perf(protocol): optimize propose/prove gas via non-upgradeable checkers and new entry points#21502
Conversation
…rs and new entry points - Add proposeDefault() and proposeCompact() entry points that skip ABI encode/decode overhead - Convert PreconfWhitelist to non-upgradeable (Ownable), inline checkProposer with gas-optimized beacon root lookup - Convert ProverWhitelist to non-upgradeable (Ownable), eliminate delegatecall proxy overhead - Inline _buildProposal into shared _propose() and add early-return in _consumeForcedInclusions - Update deploy scripts and tests for non-proxy whitelist contracts - Add gas benchmark tests for propose variants and checkProposer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bc01c5228
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Replace Ownable with Ownable2Step in both PreconfWhitelist and ProverWhitelist for safer two-step ownership transfers - Fix DeployShastaContracts to pass locally deployed preconfWhitelist to MainnetInbox instead of orphaned config.preconfWhitelist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… test comment - Use 0x00 scratch space instead of free memory pointer in checkProposer assembly block for compiler-version robustness - Add @dev warning to proposeCompact about missing deadline support - Clarify gas test naming: 1-operator baseline hits slow path, explaining why 3-operator test is cheaper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…I compat Keep the deprecated uint32 field in the struct so the autogenerated operators() getter returns the same 4-element tuple that existing Go bindings (gen_preconf_whitelist.go) and rpc/methods.go expect. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ange Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ProverWhitelist and PreconfWhitelist are no longer upgradeable, so storage layout tracking is unnecessary. Remove their _Layout.sol files and entries from gen-layouts.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude please review |
|
Claude finished @dantaik's task in 2m 56s —— View job PR Review
Overall this is a clean, well-targeted optimization PR. The gas savings are real and the changes are focused. A few things to address: Bug: Dead validation in
|
…s, deploy fix - Add proposeDefault() and proposeCompact() to IInbox interface - Add zero-address guard in ProverWhitelist and PreconfWhitelist constructors - Make DeployShastaContracts conditionally deploy PreconfWhitelist (reuse config.preconfWhitelist if set, deploy fresh if zero) - Add comment about beaconRoot == 0 fallback behavior in checkProposer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for the review! All four points addressed in 5cfc753:
|
|
Storage Layout Review for PR 21502 - Two _Layout.sol files deleted as part of architectural change from EssentialContract (upgradeable) to Ownable2Step (non-upgradeable). Deploy scripts confirm fresh non-proxy deployments so these changes are safe, but the new layouts are entirely incompatible with the old proxy layouts. ProverWhitelist: old layout had _provers at slot 251 and proverCount at slot 252; new layout starts at slot 0. PreconfWhitelist: old layout had operators/operatorMapping/packed-vars/ejecters at slots 251-254; new layout starts at slot 0 with deprecated vars removed. A proxy upgrade from old to new would corrupt all stored data. Warnings: (1) No new _Layout.sol files generated - confirm gen-layouts.sh intentionally excludes non-upgradeable contracts. (2) deprecatedInactiveSince retained in OperatorInfo for Go ABI compat. (3) operatorCount is uint8 max 255 operators. Safe changes: variable order preserved in both contracts, __gap arrays removed appropriately. Recommendations: confirm no production proxy points to old implementations; verify gen-layouts.sh exclusion is intentional; document that these contracts cannot be upgraded. Automated storage layout security review by Claude Code. |
Summary
Reduces propose and prove gas costs through structural changes — non-upgradeable whitelists, new entry points, and inlined logic.
Gas results (vs main)
propose_singlepropose_forced_inclusionprove_singleprove_batch_10New entry points (not on main)
propose()baselineproposeDefault()(1 blob, zero params)proposeCompact()(1 blob, explicit params)proposeCompact()(3 blobs)Key changes
proposeDefault()/proposeCompact()— new entry points that skip ABI encode/decode overhead for common propose casesPreconfWhitelist(Ownable2Step) — eliminates delegatecall proxy overhead on propose, inlinescheckProposerwith gas-optimized assembly beacon root lookupProverWhitelist(Ownable2Step) — eliminates delegatecall proxy overhead on prove_buildProposalinto_propose()— eliminates function call overheadInboxProposeGas.t.solandPreconfWhitelistGas.t.solwith pre-filled ring buffer for realistic steady-state measurementTest plan
forge test --match-path "test/layer1/{core,preconf}/**"— 172 tests passforge build— zero errorsdeprecatedInactiveSinceplaceholder for Go binding compat)proposeDefault()/proposeCompact()vspropose()inInboxProposeGas.t.sol🤖 Generated with Claude Code
Client implementration
@davidtaikocha depends on proposal parameters, our client code shall choose between
propose,proposeDefaultandproposeCompactto save gas cost.