Skip to content

feat: add Gamma hardfork infrastructure and integration test#290

Draft
ByteYue wants to merge 1 commit intomainfrom
gamma_fork_test
Draft

feat: add Gamma hardfork infrastructure and integration test#290
ByteYue wants to merge 1 commit intomainfrom
gamma_fork_test

Conversation

@ByteYue
Copy link
Contributor

@ByteYue ByteYue commented Mar 16, 2026

Hardfork Infrastructure

  • Add GravityHardfork enum (Alpha/Beta/Gamma) via reth hardfork!() macro
  • Parse gravityHardforks.gammaBlock from genesis JSON config
  • Add gamma_transitions_at_block() to EthChainSpec trait

Gamma Bytecodes & Upgrade Logic

  • Add gamma.rs with 11 system contract bytecodes from current HEAD
  • Add StakePool bytecode + ReentrancyGuard storage constants
  • Implement apply_gamma() in parallel_execute.rs:
    • Replace bytecodes for all system contracts at gammaBlock
    • Replace bytecodes for StakePool instances
    • Initialize ReentrancyGuard storage slot to NOT_ENTERED(1)

Integration Test

  • Generate v1.0.0 genesis via generate_genesis_single.sh with old bytecodes
  • Inject gammaBlock=20 into genesis config
  • Boot single reth node, push 50 blocks via MockConsensus
  • Verify pre-hardfork: old bytecodes at block 19
  • Verify at-hardfork: new bytecodes + ReentrancyGuard at block 20
  • Verify post-hardfork: 30 additional blocks execute normally
  • Add HARDFORK_TESTING.md documentation with pitfalls and guide

@ByteYue ByteYue force-pushed the gamma_fork_test branch 3 times, most recently from dd3ef0f to e868acd Compare March 16, 2026 13:12
## Hardfork Infrastructure
- Add GravityHardfork enum (Alpha/Beta/Gamma) via reth hardfork!() macro
- Parse gravityHardforks.gammaBlock from genesis JSON config
- Add gamma_transitions_at_block() to EthChainSpec trait

## Gamma Bytecodes & Upgrade Logic
- Add gamma.rs with 11 system contract bytecodes from current HEAD
- Add StakePool bytecode + ReentrancyGuard storage constants
- Implement apply_gamma() in parallel_execute.rs:
  - Replace bytecodes for all system contracts at gammaBlock
  - Replace bytecodes for StakePool instances
  - Initialize ReentrancyGuard storage slot to NOT_ENTERED(1)

## Integration Test
- Generate v1.0.0 genesis via generate_genesis_single.sh with old bytecodes
- Inject gammaBlock=20 into genesis config
- Boot single reth node, push 50 blocks via MockConsensus
- Verify pre-hardfork: old bytecodes at block 19
- Verify at-hardfork: new bytecodes + ReentrancyGuard at block 20
- Verify post-hardfork: 30 additional blocks execute normally
- Add HARDFORK_TESTING.md documentation with pitfalls and guide
@nekomoto911 nekomoto911 added the hardfork-compatible Include hardfork compatible code label Mar 17, 2026
@nekomoto911 nekomoto911 marked this pull request as draft March 18, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardfork-compatible Include hardfork compatible code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants