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..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} + {op.opcode.startsWith('PC_') + ? op.opcode.slice(3) + : op.opcode.startsWith('TX_') + ? op.opcode.slice(3) + : op.opcode} {hasCountChange && ( @@ -553,7 +559,8 @@ 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..b2053c823 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', @@ -325,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" 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' }, };