|
| 1 | +# Missing EIP-7918 Test Cases |
| 2 | + |
| 3 | +Below are four distinct test scenarios that are not yet covered by our EIP-7918 suite. Each section explains: |
| 4 | + |
| 5 | +1. **What the test should do and why it is needed** |
| 6 | +2. **High-level description of the test steps (no code)** |
| 7 | +3. **Notes on fixture or `conftest.py` changes (must be proposed and confirmed before implementing)** |
| 8 | + |
| 9 | +All tests marked “Osaka-only” should use `@pytest.mark.valid_from("Osaka")`. The single fork-transition test must use `@pytest.mark.valid_at_transition_to("Osaka")`. We will implement **one test at a time**, and any change to fixtures must be described and confirmed before proceeding, so as not to break existing tests. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## 1. Reserve-Inactive Path (Osaka-Only) |
| 14 | + |
| 15 | +**What it should do and why** |
| 16 | +When |
| 17 | + |
| 18 | +reserve_price = ⌊BLOB_BASE_COST · base_fee_per_gas ÷ GAS_PER_BLOB⌋ |
| 19 | +≤ blob_fee_from_excess |
| 20 | + |
| 21 | +EIP-7918 must defer to the old EIP-4844 rule. Concretely: |
| 22 | +- A transaction with `max_fee_per_blob_gas = blob_fee_from_excess − 1` should be rejected with `INSUFFICIENT_MAX_FEE_PER_BLOB_GAS`. |
| 23 | +- A transaction with `max_fee_per_blob_gas = blob_fee_from_excess` should be accepted. |
| 24 | + |
| 25 | +Without this test, we never explicitly demonstrate “reserve inactive ⇒ fallback to 4844 pricing.” |
| 26 | + |
| 27 | +**High-level test description (no code)** |
| 28 | +1. Choose `parent_excess_blobs` so that `blob_fee_from_excess ≥ 1`. |
| 29 | +2. Pick a `block_base_fee_per_gas` small enough that |
| 30 | + |
| 31 | +reserve_price = ⌊base_fee_per_gas ÷ 8⌋ ≤ blob_fee_from_excess. |
| 32 | + |
| 33 | +3. Submit two separate single-transaction blocks (both valid-from Osaka): |
| 34 | +- **Tx A:** `max_fee_per_blob_gas = blob_fee_from_excess − 1` → expect rejection (`INSUFFICIENT_MAX_FEE_PER_BLOB_GAS`). |
| 35 | +- **Tx B:** `max_fee_per_blob_gas = blob_fee_from_excess` → expect acceptance, and that contract storage records exactly `blob_fee_from_excess`. |
| 36 | + |
| 37 | +**Fixture/`conftest.py` notes** |
| 38 | +- We must be able to force `parent_excess_blobs` to the chosen value. If the current fixture always sets it to some default, override it here. |
| 39 | +- We need `block_base_fee_per_gas` to accept values low enough that `reserve_price ≤ blob_fee_from_excess`. If any global fixture clamps it higher, we must override. |
| 40 | +- _Any such fixture change must be described here and confirmed before implementation._ |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## 2. Low-Base-Fee ⇒ Zero Reserve ⇒ Min-1-Wei Fallback |
| 45 | + |
| 46 | +**What it should do and why** |
| 47 | +When |
| 48 | + |
| 49 | +base_fee_per_gas < 8 ⇒ reserve_price = ⌊base_fee_per_gas ÷ 8⌋ = 0, |
| 50 | + |
| 51 | +EIP-7918 must still enforce a minimum of **1 wei per blob** (the EIP-4844 minimum). Specifically: |
| 52 | +- A transaction with `max_fee_per_blob_gas = 0` must be rejected with `INSUFFICIENT_MAX_FEE_PER_BLOB_GAS`. |
| 53 | +- A transaction with `max_fee_per_blob_gas = 1` must be accepted. |
| 54 | + |
| 55 | +Otherwise, an implementation could accidentally permit a zero-blob fee. |
| 56 | + |
| 57 | +**High-level test description (no code)** |
| 58 | +1. Force `parent_excess_blobs = 0` so that `blob_fee_from_excess = 0`. |
| 59 | +2. Set `block_base_fee_per_gas` to any value in [1..7], so that |
| 60 | + |
| 61 | +reserve_price = ⌊base_fee_per_gas ÷ 8⌋ = 0. |
| 62 | + |
| 63 | +3. Submit two separate single-transaction blocks (valid-from Osaka): |
| 64 | +- **Tx A:** `max_fee_per_blob_gas = 0` → expect rejection (`INSUFFICIENT_MAX_FEE_PER_BLOB_GAS`). |
| 65 | +- **Tx B:** `max_fee_per_blob_gas = 1` → expect acceptance, and that contract storage records 1. |
| 66 | + |
| 67 | +**Fixture/`conftest.py` notes** |
| 68 | +- We need to override `parent_excess_blobs` temporarily to 0 if any fixture defaults it higher. |
| 69 | +- We must allow `block_base_fee_per_gas` as low as 1. If a default fixture enforces a minimum of 7, we must override. |
| 70 | +- _Any fixture adjustment must be proposed and confirmed first._ |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## 3. Multi-Block Crossover (Reserve → Excess or Excess → Reserve) |
| 75 | + |
| 76 | +**What it should do and why** |
| 77 | +Over consecutive blocks, the “effective_blob_base_fee” can flip between “reserve-driven” and “excess-driven.” We need a test that explicitly exercises that flip: |
| 78 | + |
| 79 | +1. **Block 0 (reserve-dominant):** |
| 80 | +- Choose `parent_excess_blobs = 1` so that `blob_fee_from_excess = 1`. |
| 81 | +- Pick `block_base_fee_per_gas` high enough that |
| 82 | + ``` |
| 83 | + reserve_price = ⌊base_fee_per_gas ÷ 8⌋ = R > 1. |
| 84 | + ``` |
| 85 | +- Submit a transaction with `max_fee_per_blob_gas = R` → expect acceptance. |
| 86 | + |
| 87 | +2. **Block 1 (excess-dominant):** |
| 88 | +- Because Block 0 used 1 blob, now `excess_blob_gas` has increased, raising `blob_fee_from_excess` above R. |
| 89 | +- Keep the same `block_base_fee_per_gas` (or lower it) so that the new `blob_fee_from_excess ≥ R` and thus “excess” wins over “reserve.” |
| 90 | +- Submit two transactions: |
| 91 | + - **Tx A:** `max_fee_per_blob_gas = R` (which is now < new `blob_fee_from_excess`) → expect rejection (`INSUFFICIENT_MAX_FEE_PER_BLOB_GAS`). |
| 92 | + - **Tx B:** `max_fee_per_blob_gas = new_blob_fee_from_excess` → expect acceptance, and that contract storage records `new_blob_fee_from_excess`. |
| 93 | + |
| 94 | +**Fixture/`conftest.py` notes** |
| 95 | +- We must ensure that Block 1’s `parent_excess_blobs` reflects Block 0’s consumption (i.e., increment from 1 to whatever yields the new blob fee). If the existing “blocks” fixture does not track that automatically, override it. |
| 96 | +- If `block_base_fee_per_gas` is recalculated per-block, we need to fix it across both blocks. Possibly add a fixture parameter to hold it constant. |
| 97 | +- _Any fixture change must be described and confirmed before coding._ |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 4. Fork-Transition: Pre-Osaka vs Post-Osaka Behavior |
| 102 | + |
| 103 | +**What it should do and why** |
| 104 | +Before Osaka, EIP-7918’s reserve logic is not active—only EIP-4844’s old rule applies. Immediately after Osaka, the new reserve rule must apply. We need a single test (valid_at_transition_to) proving that the very same transaction that passed just before Osaka is then rejected just after Osaka because it falls below the new reserve price. |
| 105 | + |
| 106 | +**High-level test description (no code)** |
| 107 | +1. **Pre-Osaka block** (`@pytest.mark.valid_at_transition_to("Osaka")`): |
| 108 | +- Set `parent_excess_blobs` so `blob_fee_from_excess = 1`. |
| 109 | +- Choose `block_base_fee_per_gas` high enough that `reserve_price = ⌊base_fee_per_gas ÷ 8⌋ = R > 1`. |
| 110 | +- Submit a transaction with `max_fee_per_blob_gas = 1`. |
| 111 | + - Under pre-Osaka (pure 4844), “1 ≥ blob_fee_from_excess” → **accepted**. |
| 112 | + |
| 113 | +2. **Post-Osaka block** (valid-from Osaka): |
| 114 | +- Use the same `parent_excess_blobs` and `block_base_fee_per_gas`. |
| 115 | +- Submit the same transaction with `max_fee_per_blob_gas = 1`. |
| 116 | + - Under Osaka, `reserve_price = R > 1` → **reject** (INSUFFICIENT_MAX_FEE_PER_BLOB_GAS). |
| 117 | + |
| 118 | +**Fixture/`conftest.py` notes** |
| 119 | +- We must be able to run one block under pre-Osaka logic (ignoring reserve) and the next under Osaka logic. If any fixture already enforces reserve at all times, override it in the pre-Osaka segment. |
| 120 | +- Ensure `parent_excess_blobs` and `base_fee_per_gas` remain identical across the fork boundary. |
| 121 | +- _Describe and confirm any fixture changes before implementing._ |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +**Implementation Plan** |
| 126 | +1. We will implement **one test at a time**, starting with Scenario 1. |
| 127 | +2. For each scenario, if we need to update `conftest.py` or existing fixtures, we will clearly describe the change here and ask for your confirmation before writing any test code. |
| 128 | +3. Once confirmed, we will add the new test, run the full suite to ensure no existing tests break, then proceed to the next scenario. |
| 129 | + |
| 130 | +Please review these four missing test descriptions. Let me know which scenario you’d like to start with, or if you have questions about any of the fixture changes. |
0 commit comments