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

x/lightclient redundent call for FindStateInfoByHeight #1308

Open
mtsitrin opened this issue Oct 11, 2024 · 2 comments · May be fixed by #1467
Open

x/lightclient redundent call for FindStateInfoByHeight #1308

mtsitrin opened this issue Oct 11, 2024 · 2 comments · May be fixed by #1467
Assignees

Comments

@mtsitrin
Copy link
Contributor

// Check for the last BD from the previous stateInfo as now we have the nextValhash available for that block
blockValHash, found := hook.k.GetConsensusStateValHash(ctx, canonicalClient, stateInfo.StartHeight-1)
if found {
previousStateInfo, err := hook.k.rollappKeeper.FindStateInfoByHeight(ctx, rollappId, stateInfo.StartHeight-1)
if err != nil {
	return err
}

this code calls FindStateInfoByHeight while it can just get the previous state index.
FindStateInfoByHeight is inefficient for this use case

@danwt
Copy link
Contributor

danwt commented Oct 11, 2024

this is micro optimization unless you can show it's a bottleneck

@mtsitrin
Copy link
Contributor Author

this is micro optimization unless you can show it's a bottleneck

why not taking the previous state index? why u need to "FindStateInfo" if it's index is known?

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