From bdc2d400baad0d3fbf33787dfa63f46863d6340d Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Thu, 12 Feb 2026 10:35:47 +1000 Subject: [PATCH 1/2] feat(gas-profiler): add Intrinsic Gas parameter group to simulation UI Introduce a new "Intrinsic Gas" category that exposes transaction-level gas parameters (TX_BASE, TX_DATA_ZERO, TX_CREATE_BASE, etc.) so users can experiment with protocol-level costs. This replaces the previous hard-coded note that these values were not customizable. Update tooltip and display logic to strip the "TX_" prefix in the same way "PC_" is already handled, and adjust category labels to show "parameter(s)" instead of "opcode(s)" for this new group. --- .../gas-profiler/SimulatePage.types.ts | 17 +++++++++++++++-- .../BlockSimulationResultsV2.tsx | 11 ++++++++--- .../GasScheduleDrawer/GasScheduleDrawer.tsx | 1 + .../execution/gas-profiler/utils/opcodeUtils.ts | 10 ++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/pages/ethereum/execution/gas-profiler/SimulatePage.types.ts b/src/pages/ethereum/execution/gas-profiler/SimulatePage.types.ts index 660c29bd4..891bfe77c 100644 --- a/src/pages/ethereum/execution/gas-profiler/SimulatePage.types.ts +++ b/src/pages/ethereum/execution/gas-profiler/SimulatePage.types.ts @@ -300,8 +300,21 @@ export const GAS_PARAMETER_GROUPS: GasParameterGroup[] = [ { key: 'PC_BLS12_G2MSM_MUL_GAS', label: 'BLS12 G2MSM /Point', min: 0, max: 100000, step: 1000 }, ], }, - // NOTE: Intrinsic gas (TX_BASE, TX_CREATE, TX_DATA_ZERO, TX_DATA_NONZERO) cannot be - // customized - it's calculated at the protocol level before EVM execution begins. + { + name: 'Intrinsic Gas', + color: '#d946ef', // fuchsia + parameters: [ + { key: 'TX_BASE', label: 'TX Base', min: 0, max: 100000, step: 1000 }, + { key: 'TX_CREATE_BASE', label: 'TX Create', min: 0, max: 200000, step: 1000 }, + { key: 'TX_DATA_ZERO', label: 'Calldata Zero', min: 0, max: 50, step: 1 }, + { key: 'TX_DATA_NONZERO', label: 'Calldata Non-Zero', min: 0, max: 200, step: 1 }, + { key: 'TX_ACCESS_LIST_ADDR', label: 'Access List Addr', min: 0, max: 10000, step: 100 }, + { key: 'TX_ACCESS_LIST_KEY', label: 'Access List Key', min: 0, max: 10000, step: 100 }, + { key: 'TX_INIT_CODE_WORD', label: 'Init Code Word', min: 0, max: 20, step: 1 }, + { key: 'TX_FLOOR_PER_TOKEN', label: 'Floor Per Token', min: 0, max: 50, step: 1 }, + { key: 'TX_AUTH_COST', label: 'Auth Cost', min: 0, max: 100000, step: 1000 }, + ], + }, ]; /** diff --git a/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx b/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx index 65af0689c..95b41bf47 100644 --- a/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx +++ b/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx @@ -414,7 +414,7 @@ function OpcodeRow({ op, maxGas }: { op: OpcodeRowData; maxGas: number }): JSX.E return ( @@ -443,7 +443,7 @@ function OpcodeRow({ op, maxGas }: { op: OpcodeRowData; maxGas: number }): JSX.E
- {op.opcode.startsWith('PC_') ? op.opcode.slice(3) : op.opcode} + {op.opcode.startsWith('PC_') ? op.opcode.slice(3) : op.opcode.startsWith('TX_') ? op.opcode.slice(3) : op.opcode} {hasCountChange && ( @@ -553,7 +553,12 @@ function OpcodeBreakdownSection({
{cat.name} - ({cat.opcodes.length} {cat.name === 'Precompiles' ? 'contract' : 'opcode'} + ({cat.opcodes.length}{' '} + {cat.name === 'Precompiles' + ? 'contract' + : cat.name === 'Intrinsic Gas' + ? 'parameter' + : 'opcode'} {cat.opcodes.length !== 1 ? 's' : ''})
diff --git a/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx b/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx index 904176bf2..12bfef122 100644 --- a/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx +++ b/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx @@ -9,6 +9,7 @@ import { getOpcodeCategory, CATEGORY_COLORS } from '../../utils/opcodeUtils'; /** Category ordering for display */ const CATEGORY_ORDER = [ + 'Intrinsic Gas', 'Storage', 'Transient Storage', 'Contract', diff --git a/src/pages/ethereum/execution/gas-profiler/utils/opcodeUtils.ts b/src/pages/ethereum/execution/gas-profiler/utils/opcodeUtils.ts index 33375e6af..27dcd23c2 100644 --- a/src/pages/ethereum/execution/gas-profiler/utils/opcodeUtils.ts +++ b/src/pages/ethereum/execution/gas-profiler/utils/opcodeUtils.ts @@ -141,6 +141,7 @@ export const CATEGORY_COLORS: Record = { 'Precompiles (Fixed)': '#10b981', // emerald 'Precompiles (Variable)': '#059669', // emerald-600 Precompiles: '#10b981', // emerald - used for opcode breakdown chart + 'Intrinsic Gas': '#d946ef', // fuchsia Other: '#9ca3af', // gray-400 }; @@ -190,6 +191,11 @@ export function isGasParameter(name: string): boolean { return true; } + // Intrinsic gas parameters (TX_BASE, TX_DATA_ZERO, etc.) + if (name.startsWith('TX_')) { + return true; + } + // Known standalone parameters (not opcodes) const standaloneParameters = [ 'MEMORY', // Memory expansion cost @@ -214,6 +220,9 @@ export function getOpcodeCategory(opcode: string): string { // Direct lookup first if (OPCODE_CATEGORIES[opcode]) return OPCODE_CATEGORIES[opcode]; + // Intrinsic gas entries (TX_BASE, TX_DATA_ZERO, etc.) + if (opcode.startsWith('TX_')) return 'Intrinsic Gas'; + // Precompile gas entries (PC_SHA256, PC_ECREC, etc.) if (opcode.startsWith('PC_')) return 'Precompiles'; @@ -276,6 +285,7 @@ const HEX_TO_TAILWIND: Record = { '#0ea5e9': { bg: 'bg-sky-500', hover: 'hover:bg-sky-400' }, '#10b981': { bg: 'bg-emerald-500', hover: 'hover:bg-emerald-400' }, '#059669': { bg: 'bg-emerald-600', hover: 'hover:bg-emerald-500' }, + '#d946ef': { bg: 'bg-fuchsia-500', hover: 'hover:bg-fuchsia-400' }, '#9ca3af': { bg: 'bg-gray-400', hover: 'hover:bg-gray-300' }, }; From 31725fccd400700af74df4cb47acd9516abe65f9 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Thu, 12 Feb 2026 10:39:23 +1000 Subject: [PATCH 2/2] style: reformat nested ternaries and long lines for readability refactor: change search placeholder from "Search opcodes..." to "Search..." --- .../BlockSimulationResultsV2.tsx | 16 +++++++++------- .../GasScheduleDrawer/GasScheduleDrawer.tsx | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx b/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx index 95b41bf47..6ad89dc60 100644 --- a/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx +++ b/src/pages/ethereum/execution/gas-profiler/components/BlockSimulationResultsV2/BlockSimulationResultsV2.tsx @@ -414,7 +414,9 @@ function OpcodeRow({ op, maxGas }: { op: OpcodeRowData; maxGas: number }): JSX.E return ( @@ -443,7 +445,11 @@ function OpcodeRow({ op, maxGas }: { op: OpcodeRowData; maxGas: number }): JSX.E
- {op.opcode.startsWith('PC_') ? op.opcode.slice(3) : op.opcode.startsWith('TX_') ? op.opcode.slice(3) : op.opcode} + {op.opcode.startsWith('PC_') + ? op.opcode.slice(3) + : op.opcode.startsWith('TX_') + ? op.opcode.slice(3) + : op.opcode} {hasCountChange && ( @@ -554,11 +560,7 @@ function OpcodeBreakdownSection({ {cat.name} ({cat.opcodes.length}{' '} - {cat.name === 'Precompiles' - ? 'contract' - : cat.name === 'Intrinsic Gas' - ? 'parameter' - : 'opcode'} + {cat.name === 'Precompiles' ? 'contract' : cat.name === 'Intrinsic Gas' ? 'parameter' : 'opcode'} {cat.opcodes.length !== 1 ? 's' : ''})
diff --git a/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx b/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx index 12bfef122..b2053c823 100644 --- a/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx +++ b/src/pages/ethereum/execution/gas-profiler/components/GasScheduleDrawer/GasScheduleDrawer.tsx @@ -326,7 +326,7 @@ export function GasScheduleDrawer({ setSearchQuery(e.target.value)} className="w-full border-0 bg-transparent text-sm text-foreground placeholder:text-muted focus:ring-0 focus:outline-hidden"