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

Always reset OE in FinalizeBlock #57

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

teddyding
Copy link

@teddyding teddyding commented Oct 21, 2024

Rationale - got LGTM from Cosmos folks

Dependency workflow failing - won't fix in this PR since change is not related.

Copy link

@teddyding your pull request is missing a changelog!

baseapp/abci.go Outdated
Comment on lines 916 to 923
res.AppHash = app.workingHash()
}

app.optimisticExec.Reset()
return res, err
}

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:894)

@facundomedica
Copy link

Maybe it's better to reset right after WaitResult? Also, curious what kind of effect this has, does it improve performance?

@teddyding
Copy link
Author

Maybe it's better to reset right after WaitResult? Also, curious what kind of effect this has, does it improve performance?

Agree it's better to have one single call to .Reset right after WaitResult - made the change.

I don't believe this affects performance. It's mostly a semantic fix: it makes sense for the OE state (including oe.request) to be reset to nil after the current block is committed, regardless of whether we have to abort OE or not. This fix also prevents error log from being triggered in this case

Comment on lines 910 to 916
// Wait for the OE to finish, regardless of whether it was aborted or not
res, err = app.optimisticExec.WaitResult()

app.optimisticExec.Reset()

// only return if we are not aborting
if !aborted {

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:894)

@teddyding teddyding merged commit cc8c850 into dydx-fork-v0.50.5 Oct 22, 2024
33 of 37 checks passed
@teddyding teddyding deleted the td/reset-oe branch October 22, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants