state: build_diff() reports deletions for accounts that never existed

Đang mở
#1,718 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả 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 at build_diff() in test/state/state.cpp (the erase_if_empty / deleted_accounts path around the linked lines). Reproduce with state_transition.tx_legacy and state_transition.touch_nonexistent_sd, then add the pre.contains check on receipt.state_diff.deleted_accounts (fails 28/132). Decide a flag or skip for accounts inserted only because they were touched; #1717’s in_diff expectation can pin the chosen behaviour. Done when those accounts are not listed as deleted and related modified_accounts TODOs are considered.

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

Mô tả

#1709 fixed one instance of this: an account warmed up by a cold access and then reverted was reported in StateDiff::deleted_accounts. The artifact still appears when the account is inserted some other way and ends up empty.

The shortest case is a transaction to an address that does not exist — state_transition.tx_legacy, where 0xc0de is not in the pre-state:

tx.to = To;  // no code, no value

execute_message() inserts the recipient with erase_if_empty, it ends empty, and build_diff() puts it in deleted_accounts. Same for a non-existent SELFDESTRUCT beneficiary (state_transition.touch_nonexistent_sd, 0x4e).

build_diff() skips m.nonexistent (set only when a revert restores the account) and m.just_created (set only by CREATE). There is no flag for "inserted because it was touched", so these fall through to the erase_if_empty branch.

As with #1709 the state is correct — applying such a delete is a no-op — so only the diff is affected.

Scale: adding this to the state_transition fixture fails 28 of 132 tests on master:

for (const auto& a : receipt.state_diff.deleted_accounts)
    EXPECT_TRUE(pre.contains(a)) << a << ": deleted, never existed";

Related, and already noted in the TODO below: modified_accounts also lists accounts that were only read or warmed, with nonce and balance unchanged — e.g. state_transition.touch_access_list_storage_only, where 0x5a is warmed by the access list alone.

#1717 adds an in_diff expectation to the state_transition fixture, which can be used to pin down whatever behaviour is decided here.

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.