Compute gas with uint32

Đang mở
#1,719 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
28/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
blockchain

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
C++
Star
979
Fork
340
Merge trung bình
12 giờ 16 phút
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ipsilon/evmone

Tất cả issue của ipsilon/evmone

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.