Skip to content
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

Merged
merged 16 commits into from
Dec 12, 2023
Merged

Amend incarnation logic #8954

merged 16 commits into from
Dec 12, 2023

Conversation

yperbasis
Copy link
Member

No description provided.

@AskAlexSharov
Copy link
Collaborator

@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 {
Copy link
Collaborator

@AskAlexSharov AskAlexSharov Dec 12, 2023

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 { ?

Copy link
Member Author

@yperbasis yperbasis Dec 12, 2023

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

Copy link
Member Author

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.

@AskAlexSharov
Copy link
Collaborator

integration tests for this branch: https://github.com/ledgerwatch/erigon/actions/runs/7176204222

@AskAlexSharov
Copy link
Collaborator

do we need some new test for this corner case? or it doesn't change any behavior?

@yperbasis yperbasis merged commit faaf5a0 into devel Dec 12, 2023
9 checks passed
@yperbasis yperbasis deleted the phoenix branch December 12, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants