Skip to content

Fix devnet genesis gasLimit mismatch and RPC test chain ID validation#123

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-devnet-gaslimit-mismatch
Draft

Fix devnet genesis gasLimit mismatch and RPC test chain ID validation#123
Copilot wants to merge 2 commits intomainfrom
copilot/fix-devnet-gaslimit-mismatch

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 7, 2026

Devnet's block gas capacity was misconfigured at 8M while feeConfig.gasLimit and mainnet/testnet are all set to 20M, causing behavioral divergence. The test_chain_id RPC test was also broken: it passed the chain ID as the JSON-RPC request id, omitted params, and only printed results — meaning the test could never fail.

Changes

  • chains/devnet/genesis.json: Correct top-level gasLimit from 0x7a1200 (8M) → 0x1312D00 (20M) to match config.feeConfig.gasLimit and align with mainnet/testnet

  • rpc/rpc_test.py: Fix test_chain_id to use a proper JSON-RPC payload and assert the response:

    # Before: chain_id used as request id, no params, only prints
    def test_chain_id(rpc_url, chain_id):
        payload = {"jsonrpc": "2.0", "method": "eth_chainId", "id": chain_id}
        ...
        print("RPC request successful, Response Data:", response_data)
    
    # After: correct payload, actual assertion
    def test_chain_id(rpc_url, expected_chain_id):
        payload = {"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}
        ...
        actual_chain_id = int(response_data["result"], 16)
        assert actual_chain_id == expected_chain_id, \
            f"Chain ID mismatch: expected {expected_chain_id}, got {actual_chain_id}"
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature][High] Fix devnet genesis gasLimit mismatch and RPC test chain ID validation bug</issue_title>
<issue_description>## Summary

Two correctness bugs that affect development and testing reliability.

Findings

1. Devnet genesis gasLimit mismatch (Configuration Bug)

File: chains/devnet/genesis.json, lines 5 and 47

The devnet genesis has a critical inconsistency:

  • config.feeConfig.gasLimit = 20000000 (20M)
  • Top-level gasLimit = "0x7a1200" = 8000000 (8M)

On mainnet and testnet, these are aligned at 20M / "0x1312D00". This mismatch means transactions that succeed on testnet/mainnet may fail on devnet due to different block gas capacity, defeating its purpose as a pre-production environment.

Fix: Change line 47 from "gasLimit": "0x7a1200" to "gasLimit": "0x1312D00".

2. RPC test chain_id validation bug (Logic Bug)

File: rpc/rpc_test.py, lines 40-52

The test_chain_id function has a bug: it passes the expected chain_id value (e.g., 10507) as the JSON-RPC "id" field instead of using it to validate the response. The function also omits the required "params": [] field. Most critically, none of the test functions actually assert returned values -- they only print, meaning tests can never fail.

Fix:

def test_chain_id(rpc_url, expected_chain_id):
    payload = {
        "jsonrpc": "2.0",
        "method": "eth_chainId",
        "params": [],
        "id": 1,
    }
    response = requests.post(rpc_url, json=payload)
    response_data = response.json()
    actual_chain_id = int(response_data["result"], 16)
    assert actual_chain_id == expected_chain_id, \
        f"Chain ID mismatch: expected {expected_chain_id}, got {actual_chain_id}"

Impact

  • Devnet testing does not accurately reflect production gas behavior
  • RPC tests provide false confidence as they never fail regardless of actual results

Generated by Health Monitor with Omni</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix devnet genesis gasLimit mismatch and RPC test chain ID validation bug Fix devnet genesis gasLimit mismatch and RPC test chain ID validation Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][High] Fix devnet genesis gasLimit mismatch and RPC test chain ID validation bug

2 participants