t8n: currentGasLimit >= 2^63 wraps signed and rejects valid txs
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp, json
- Lĩnh vực
- blockchain
Hướng nghiên cứu
Start by reading integer parsing and block-field assignment in test/utils/statetest_loader.cpp, then trace gas-limit handling through test/t8n/t8n.cpp and test/state/state.cpp. Run the provided Cancun reproducer, changing currentGasLimit between 0x7fffffffffffffff and 0x8000000000000000. Done looks like evmone executes the transaction at both limits and agrees with geth on the reported transaction and gas results.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
evmone-t8n treats env.currentGasLimit as signed int64_t (via JSON loader), so values >= 2^63 wrap negative and cause valid transactions to be rejected as "gas limit reached".
go-ethereum evm t8n treats currentGasLimit as uint64 and executes the same transaction.
Reproducer (Cancun)
alloc.json
{
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"code": "0x",
"nonce": "0x0",
"balance": "0xde0b6b3a7640000",
"storage": {}
}
}
env.json
{
"currentCoinbase": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"currentNumber": "0x01",
"currentTimestamp": "0x54c99069",
"currentGasLimit": "0x8000000000000000",
"currentRandom": "0x0000000000000000000000000000000000000000000000000000000000000001",
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"currentBaseFee": "0x1",
"currentExcessBlobGas": "0x0",
"withdrawals": []
}
txs.json
[
{
"to": "0x095E7BAea6a6c7c4c2DfeB977eFac326aF552d87",
"input": "0x",
"gas": "0x5208",
"nonce": "0x0",
"value": "0x0",
"gasPrice": "0x1",
"chainId": "0x1",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"v": "0x26",
"r": "0x62d32a1bac6b89021fce16cf51479a8b00f26523933afde1b62f7957ed1943a3",
"s": "0x6f3941435cb48b0c649c1b0d707fc6878407f6287c9cd89c33c0048bd2710e45"
}
]
Commands
# evmone
evmone-t8n \
--state.fork Cancun --state.chainid 1 \
--input.alloc alloc.json --input.env env.json --input.txs txs.json \
--output.basedir out-evmone --output.result result.json --output.alloc alloc.json
# geth
evm t8n \
--state.fork Cancun --state.chainid 1 \
--input.alloc alloc.json --input.env env.json --input.txs txs.json \
--output.basedir out-geth --output.result result.json --output.alloc alloc.json
Observed divergence
- evmone:
rejected[0].error = "gas limit reached"gasUsed = 0x0- empty tx/receipt roots (
0x56e81f...)
- geth:
- tx executes successfully
gasUsed = 0x5208- non-empty tx/receipt roots
State roots differ:
- evmone:
0x517f2cdf6adb1a644878c390ffab4e130f1bed4b498ef7ce58c5addd98d61018 - geth:
0x5a605f957d4aa4145411d63287ddf1bae2202c30cc6ec86ae003423bb6343778
Control (boundary)
If only currentGasLimit is changed to 0x7fffffffffffffff (2^63 - 1), evmone and geth agree and both execute the tx.
This isolates the issue to signed handling above int64 max.
Suspected root cause
currentGasLimit and tx gas are parsed via from_json<int64_t> using unsigned parse + signed cast:
test/utils/statetest_loader.cppinteger_from_json<T>usesstatic_cast<T>(std::stoull(...))- block field assignment:
.gas_limit = from_json<int64_t>(j.at("currentGasLimit"))
Execution path then uses signed comparison:
test/t8n/t8n.cpp:int64_t block_gas_left = block.gas_limit;test/state/state.cpp:if (tx.gas_limit > block_gas_left) return GAS_LIMIT_REACHED;
For 0x8000000000000000, block_gas_left becomes negative, causing false rejection.
For reference, geth t8n env models currentGasLimit as uint64:
cmd/evm/internal/t8ntool/execution.go:GasLimit uint64 \json:"currentGasLimit"``
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ipsilon/evmone
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ipsilon/evmone
Issue tương tự
-
Reference check: findingsĐang mởaudit-reference-check
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
schrodinger/pymol-open-source#532 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
xlnt-community/xlnt#174 ·