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

refactor(core): use working hash in finalizeblock instead of flush #16065

Merged
merged 5 commits into from
May 9, 2023

Conversation

tac0turtle
Copy link
Member

Description

ref #12272


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@tac0turtle tac0turtle changed the base branch from main to bez/feature/abci-2.0-base May 8, 2023 17:45
@tac0turtle tac0turtle marked this pull request as ready for review May 8, 2023 17:46
@tac0turtle tac0turtle requested a review from a team as a code owner May 8, 2023 17:46
@github-actions github-actions bot added the C:CLI label May 8, 2023
@@ -166,7 +166,7 @@

// commit genesis changes
if !startupConfig.AtGenesis {
// app.Commit(context.TODO(), &abci.RequestCommit{}) // TODO figure out if this is needed?
app.Commit(context.TODO(), &abci.RequestCommit{})

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There is one doubt I have which I left a comment on.

// state transitions will be flushed to disk and as a result, but we already have
// an application Merkle root.
func (app *BaseApp) workingHash() []byte {
app.finalizeBlockState.ms.Write()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we moved the writing from comit to working hash now after Initchain & commit are called there is still no state, so we need to write to disk in order to call commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still a misnomer to call this workingHash as the name implies it's idempotent. But in reality, this now has side affects. Perhaps consider moving the flush/write to disk back to Commit.

baseapp/abci.go Outdated
Comment on lines 787 to 788
func (app *BaseApp) flushCommit() storetypes.CommitID {
app.finalizeBlockState.ms.Write()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of flashCommit doesn't make sense since get rid of Write, ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill change to commit to make it clearer, thanks for the pointer

@tac0turtle tac0turtle merged commit 024850c into bez/feature/abci-2.0-base May 9, 2023
@tac0turtle tac0turtle deleted the marko/abci-2.0-7 branch May 9, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants