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

fix: module consensus version is not correctly set when upgrade after state sync #391

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

forcodedancing
Copy link
Collaborator

Description

Fix upgrade initializers are not called when state sync.

Rationale

If pre initializers are not called, it will lead to apphash mismatch issue. For example,

When doing migration, the to version (will be stored) is read from app.

toVersion := uint64(0)
if module, ok := module.(HasConsensusVersion); ok {
	toVersion = module.ConsensusVersion()
}
...

updatedVM[moduleName] = toVersion

However, when doing state sync, it will not call all previous upgrade initializers, leading to toVersion is not correct.

Example

NA

Changes

Notable changes:

  • upgrade handler

Potential Impacts

Test

Before fix:
image
After fix:
image

@unclezoro unclezoro added this pull request to the merge queue Jan 22, 2024
Merged via the queue into bnb-chain:develop with commit a6122fb Jan 22, 2024
29 checks passed
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