feat(op-reth): add Soul Gas Token (SGT) support with acceptance tests#148
Open
blockchaindevsh wants to merge 2 commits intoop-esfrom
Open
feat(op-reth): add Soul Gas Token (SGT) support with acceptance tests#148blockchaindevsh wants to merge 2 commits intoop-esfrom
blockchaindevsh wants to merge 2 commits intoop-esfrom
Conversation
Add SGT support to the Rust OP Stack implementation and execution-client agnostic acceptance tests, enabling alternative gas payment using Soul Gas Tokens from a predeploy contract. Rust changes (under rust/): - Patch revm/alloy-evm with forked SGT-enabled versions (revm 34.0.0 based) - Add SgtConfig type and SGT constants (contract addr, balance slot) - Parse SGT config from genesis config.optimism (soulGasTokenTime, isSoulBackedByNative) — same format as op-geth - Thread SGT config through OpBlockExecutionCtx → EVM via configure_sgt() - Add OpHardforks trait methods: is_sgt_active_at_timestamp(), is_sgt_native_backed() - RPC: dual HTTP server support (--http.sgt.addr/port) returning native+SGT combined balance on eth_getBalance - TxPool: check native+SGT combined balance for tx validation (only when SGT is active, zero overhead on non-SGT chains) - CLI: --http.sgt.addr and --http.sgt.port arguments Acceptance tests (20/20 passing): - Deposit: basic, accumulation, multi-account independence, native backing - Gas payment: native-only, full SGT, full SGT+native, partial SGT - Gas payment + tx value: full SGT, partial SGT - Insufficient funds: SGT-only, native-only, combined, with tx value - Balance invariant: preSGT + preNative == postSGT + postNative + gasCost + txValue - Genesis: contract deployment, balanceOf returns zero - Smoke: native transfer, balance query Gas payment priority (enforced by forked revm handler): - Deduction: SGT first → native second - Refund: native first → SGT second No MSRV bump (stays 1.88), no reth version bump (stays v1.11.0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move SGT configuration from OpBlockExecutionCtx + Evm::configure_sgt() to CfgEnv fields, matching how OpSpecId passes hardfork info. This eliminates the alloy-evm fork entirely. Changes: - Remove configure_sgt() from Evm trait impl and OpEvm inherent method - Remove sgt_config from OpBlockExecutionCtx - Set CfgEnv.sgt_enabled/sgt_is_native_backed in evm_env(), next_evm_env(), evm_env_for_payload() - Switch revm fork from blockchaindevsh/revm to QuarkChain/revm@3a6aa085 which adds is_sgt_enabled()/is_sgt_native_backed() to Cfg trait - Drop alloy-evm fork (blockchaindevsh/evm) from [patch.crates-io] External dependency: QuarkChain/revm@3a6aa085 (only fork needed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
The go changes mainly migrates the sgt e2e tests to the op-acceptance tests(
cd op-acceptance-tests && just sgt).Essential op-reth changes are under the ./rust directory.
Details of this PR can be seen in the msg of the squashed commit.
External rust dependencies PRs will be created separately.