-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amend incarnation logic #8954
Amend incarnation logic #8954
Conversation
@yperbasis hi, give a bit context of this change plz. |
@@ -74,6 +75,15 @@ func (dsw *DbStateWriter) UpdateAccountData(address libcommon.Address, original, | |||
if err := dsw.db.Put(kv.HashedAccounts, addrHash[:], value); err != nil { | |||
return err | |||
} | |||
|
|||
if account.Incarnation == 0 && original.Incarnation > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not if original.Incarnation > account.Incarnation {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in that case IncarnationMap
isn't too relevant. My understanding is that IncarnationMap
is relevant when a contract is self-destructed and then recreated as a smart contract. Within a block, IntraBlockState
rather than IncarnationMap
is used to determine the right incarnation. But here we're treating a special corner case when at the end of the block a contract is destroyed and then re-recreated as a non-smart account (account.Incarnation == 0
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the lines I'm adding to UpdateAccountData
are copy-pasted from DeleteAccount
.
integration tests for this branch: https://github.com/ledgerwatch/erigon/actions/runs/7176204222 |
do we need some new test for this corner case? or it doesn't change any behavior? |
No description provided.