Incorrect incarnation number for an re-created account
Silkworm is failing the CREATE2 - recreate EEST test in variant recreate_on_separate_block=True.
The scenario is like this:
- Block 1
- Create account X with
CREATE2(incarnation 1) - Set X storage
[0] = 1
- Create account X with
- Block 2
- Selfdestruct X
- Send value 1 to X
- Block 3
- Create account X with
CREATE2(incarnation 2).
- Create account X with
In the final state the X should have empty storage. However, it has [0] == 1 because the incarnation number for the second CREATE2 is incorrectly 1.
This bug don't happen when the transaction 3.1 is in block 2 (same where selfdestruct happens): recreate_on_separate_block=False.
It seems we don't properly remember the X's prev_incarnation at the end of block 2. Formally, the account exist is not empty but has not been created with IntraBlockState::create_contract.
I tried to also keep prev_incarnation of "current" accounts in InMemoryState::update_account, but this didn't fix the problem.