Compute gas with uint32

Abierto
#1,719 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
28/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp
Área
blockchain

Línea de trabajo

Start from the gas fields listed in the issue: gas_left in the interpreter and Result/TermResult, StateGas in lib/evmone/state_gas.hpp, and the evmc_message / evmc_result ABI fields. Read how the interpreter currently uses a signed subtract-and-compare-to-zero check, and TX_MAX_GAS_LIMIT in test/state/transaction.hpp. Done means a coherent uint32 (or documented ABI) plan for those counters, not a drive-by type swap.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

optimization

Every gas counter in evmone is int64_t, but all per-transaction gas quantities fit in 32 bits.

EIP-7825 caps a transaction's gas limit at TX_MAX_GAS_LIMIT = 2^24 (MAX_TX_GAS_LIMIT, test/state/transaction.hpp), and block gas limits are far below 2^32. A pending EIP-8037 change would additionally cap tx.gas itself at 2^32-1, so the whole two-dimensional budget stays inside an unsigned 32-bit integer.

Candidates:

  • gas_left threaded through the interpreter and Result / TermResult
  • StateGas::left and StateGas::spilled (lib/evmone/state_gas.hpp)
  • evmc_message::gas, evmc_message::state_gas
  • evmc_result::gas_left, gas_refund, state_gas_left, state_gas_spilled

Two things to settle first:

  • The interpreter relies on gas going negative ((gas_left -= cost) < 0). An unsigned counter needs a borrow-based check instead, e.g. __builtin_usub_overflow.
  • The evmc_* fields are public ABI, so changing them is a breaking change.
Lenguaje dominante
C++
Estrellas
979
Forks
340
Merge medio
12 h 16 min
PR fusionados (30 d)
25

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ipsilon/evmone

Todos los issues de ipsilon/evmone

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.