Merged
Conversation
Defines the Frontier through Prague hardfork timeline and an EIP\nactivation map so callers can check whether a given EIP feature\nflag is active for a given spec_id. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…hineState.new/2 Config.new/1 now accepts a spec_id atom (default :cancun) and stores a\nHardforkConfig struct. MachineState.new/2 accepts a :hardfork keyword\noption and passes it to Config.new/1, preserving backwards compatibility. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- EIP-3855 PUSH0 (0x5F): invalid before Shanghai\n- EIP-1153 TLOAD/TSTORE (0x5C/0x5D): invalid before Cancun\n- EIP-5656 MCOPY (0x5E): invalid before Cancun\n- EIP-6780 SELFDESTRUCT: pre-Cancun always fully deletes; Cancun+ only\n deletes if contract was created in the same transaction\n- EIP-170 code size limit: skipped before Spurious Dragon\n- EIP-3860 initcode size limit + word cost: skipped before Shanghai\n- EIP-3541 0xEF prefix rejection: skipped before London Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- EIP-2929 (Berlin+): address_access_cost and storage_access_cost now\n check the hardfork config before applying cold/warm tracking\n- EIP-3529 (London+): apply_refund uses 1/5 cap; pre-London uses 1/2 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Adds HardforkConfigTest with:\n- Unit tests for enabled?/2 across all EIPs and hardfork boundaries\n- Behavioral tests verifying PUSH0, TLOAD/TSTORE, MCOPY become\n :invalid before their activation hardfork\n- EIP-6780 SELFDESTRUCT: pre-Cancun always deletes, post-Cancun preserves\n- EIP-2929 gas cost differences between Istanbul and Berlin\n- EIP-3529 refund cap (1/5 London vs 1/2 pre-London)\n- Default hardfork is Cancun\n\nAlso updates ConfigTest for new Config.new/1 signature. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- memory_ops.ex: wrap long expansion_cost line per mix format\n- creation.ex: fix continuation indent on multi-line if/and expressions\n- hardfork_config_test.exs: each byte on its own line in <<>> literal;\n fix EIP-2929 pre-Berlin gas assertion (storage_access returns 0, not 100) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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
Closes #75.
Adds a hardfork configuration system so eevm can toggle EIP-specific behavior based on the target hardfork, matching the design of revm's
SpecId.Changes
New:
EEVM.HardforkConfigspec_idtype covering Frontier through Pragueenabled?(config, :eip_XXXX)helper — returnstrueif the EIP is active at the given forkdefault/0returns Cancun (preserves backwards compatibility)Updated:
EEVM.Confighardfork: HardforkConfig.t()field (default:cancun)Config.new/1accepts an optionalspec_idatomUpdated:
EEVM.MachineStatenew/2accepts:hardforkkeyword option, passed through toConfig.new/1EIP Guards Added
control_flow.exstorage_ops.exmemory_ops.extermination.exgas/access.exexecutor.excreation.excreation.excreation.exAll pre-activation: opcodes return
:invalid; gas rules fall back to pre-EIP behavior.Tests (
test/hardfork_config_test.exs)enabled?/2at every EIP's hardfork boundary:invalidbefore activationBackwards Compatibility
All existing tests are unaffected — default hardfork is Cancun, which is what all existing tests implicitly relied on.