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

Unify cache_ctx wraps #2519

Merged
merged 2 commits into from
Aug 29, 2022
Merged

Unify cache_ctx wraps #2519

merged 2 commits into from
Aug 29, 2022

Conversation

ValarDragon
Copy link
Member

What is the purpose of the change

In #2515 @puneet2019 fixed that epochs isn't returning events, due to cosmos/cosmos-sdk#12912 .

This also showed that were actually duplicating panic wrapping logic. This PR adds that fix to the general osmosis helper, and makes epochs use the general osmosis helper

Brief Changelog

Testing and Verifying

This change is already covered by existing tests, that @puneet2019 added in #2515

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? yes
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? no
  • How is the feature or change documented? N/A

// TODO: Thread info for which hook this is, may be dependent on larger hook system refactoring
err := osmoutils.ApplyFuncIfNoError(ctx, wrappedHookFn)
if err != nil {
ctx.Logger().Info("an epoch hook errored")
Copy link
Member

Choose a reason for hiding this comment

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

wdyt about logging the error itself here?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point

hookFn(cacheCtx, epochIdentifier, epochNumber)
write()
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
wrappedHookFn := func(ctx sdk.Context) error {
Copy link
Member

Choose a reason for hiding this comment

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

Can this function return err in any case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not right now, it will after #2520

Copy link
Member

Choose a reason for hiding this comment

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

Ah makes sense now

Copy link
Member

Choose a reason for hiding this comment

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

have created draft #2526
waiting on this one, so it's cleaner

@ValarDragon ValarDragon merged commit 5e0b914 into main Aug 29, 2022
@ValarDragon ValarDragon deleted the dev/unify_cache_ctx_wraps branch August 29, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants