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

未关闭
#1,718 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
blockchain

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

#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.

主要语言
C++
星标
979
派生
340
平均合并
12 小时 16 分钟
30 天内合并 PR
25

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ipsilon/evmone 的其他 Issue

查看 ipsilon/evmone 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。