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

The immutableTree clone() func is missing skipFastStorageUpgrade field --> wrong Block.Header.AppHash. error in the blockchain #598

Closed
dungtt-astra opened this issue Oct 27, 2022 · 3 comments · Fixed by #599

Comments

@dungtt-astra
Copy link

dungtt-astra commented Oct 27, 2022

When we upgrade iavl in our blockchain from iavl v0.19.0 to v0.19.3, the chain got the error: "wrong Block.Header.AppHash.".

Deep dive the iavl source code, we found that the immutable tree clone() func missing the skipFastStorageUpgrade field. This cause the "skipFastStorageUpgrade" field auto set to false, while it is initiated "true" --> immutable iterator() func return the wrong list, then mismatch in db of validators.

To fix this issue, we need to add "skipFastStorageUpgrade" into the clone() func as follows:

func (t *ImmutableTree) clone() *ImmutableTree {
	return &ImmutableTree{
		root:                   t.root,
		ndb:                    t.ndb,
		version:                t.version,
		skipFastStorageUpgrade: t.skipFastStorageUpgrade,
	}
}

@tac0turtle please give your comment

@tac0turtle
Copy link
Member

this sounds good to me, if you submit a pr I can test on chains

@tac0turtle
Copy link
Member

the main issue people seem to be running into is when the fast nodes exist and then turn it off. Ill test this on some chains, but this could elude to a different issue

@dungtt-astra
Copy link
Author

the main issue people seem to be running into is when the fast nodes exist and then turn it off.

It's true, actually we upgrade cosmos-sdk v0.45.7 to v0.45.9, it sets "const iavlDisablefastNodeDefault = true" by default, other blockchains set "const iavlDisablefastNodeDefault = false" then they don't face this issue.

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 a pull request may close this issue.

2 participants