- 
                Notifications
    
You must be signed in to change notification settings  - Fork 60
 
Add base_meterBundle RPC for transaction bundle metering #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements JSON-RPC endpoint to simulate and meter Optimism transaction bundles, returning detailed gas usage, execution time, and bundle hash using Flashbots methodology. Includes reusable meter_bundle() function for non-RPC contexts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, left some comments on things that stood out but aren't blockers to merging.
Can we add a sanity check e2e test to this? Happy to do it in a follow up PR
Add comprehensive tests following flashblocks-rpc pattern with funded test accounts from genesis.json. Tests cover bundle metering, gas calculations, state resolution, and error handling.
- Add tips-core dependency (default-features=false to avoid version conflicts) - Replace MeterBundleRequest with tips-core Bundle - Use BundleWithMetadata.bundle_hash() instead of manual calculation - Use bundle.block_number and bundle.min_timestamp for simulation - Update docs to clarify TIPS Bundle format - Add workaround for op-alloy 0.20/0.21 version mismatch (temporary until next reth release)
| 
           Once this is reviewed, I'm going to  EDIT: turns out the merge base is editable! It's now based on main.  | 
    
Update tips-core to rev 27674ae which includes the metering response types. Remove local type definitions and use the types from tips-core instead.
Bundle metering now always uses the latest available block state for simulation. The bundle.block_number parameter is only used for TIPS bundle validity checks, not for state selection.
Implements JSON-RPC endpoint to simulate and meter Optimism transaction bundles, returning detailed gas usage, execution time, and bundle hash using Flashbots methodology.
Includes reusable meter_bundle() function for non-RPC contexts.