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

chore: adding calls to util.Panic #1764

Merged
merged 4 commits into from
Jan 31, 2023
Merged

chore: adding calls to util.Panic #1764

merged 4 commits into from
Jan 31, 2023

Conversation

robert-zaremba
Copy link
Member

Description

Simplify the "if err -> panic" code flows.


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
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • 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 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)

@robert-zaremba robert-zaremba requested review from a team as code owners January 30, 2023 21:42
if err := k.AccrueAllInterest(ctx); err != nil {
panic(err)
}
util.Panic(k.SweepBadDebts(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
panic(err)
}
util.Panic(k.SweepBadDebts(ctx))
util.Panic(k.AccrueAllInterest(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
if err := keeper.ResetQuota(ctx); err != nil {
panic(err)
}
util.Panic(keeper.ResetQuota(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@toteki
Copy link
Member

toteki commented Jan 31, 2023

I think this PR is missing the file with util.Panic defined

@robert-zaremba
Copy link
Member Author

Yes, just added missing file.

@codecov-commenter
Copy link

Codecov Report

Merging #1764 (6cfbbab) into main (9af22b8) will decrease coverage by 1.53%.
The diff coverage is 12.42%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1764      +/-   ##
==========================================
- Coverage   57.50%   55.98%   -1.53%     
==========================================
  Files          77       84       +7     
  Lines        8034     8310     +276     
==========================================
+ Hits         4620     4652      +32     
- Misses       3063     3317     +254     
+ Partials      351      341      -10     
Impacted Files Coverage Δ
util/error.go 0.00% <0.00%> (ø)
x/oracle/genesis.go 4.58% <0.00%> (-0.13%) ⬇️
x/oracle/module.go 52.56% <0.00%> (-0.69%) ⬇️
x/uibc/genesis.go 0.00% <0.00%> (ø)
x/uibc/ics20/keeper/keeper.go 0.00% <0.00%> (ø)
x/uibc/keys.go 0.00% <0.00%> (ø)
x/uibc/msg.go 0.00% <0.00%> (ø)
x/uibc/query.pb.gw.go 0.00% <0.00%> (ø)
x/leverage/keeper/genesis.go 8.51% <15.38%> (+4.51%) ⬆️
x/uibc/params.go 41.46% <41.46%> (ø)
... and 9 more

if err := k.AccrueAllInterest(ctx); err != nil {
panic(err)
}
util.Panic(k.SweepBadDebts(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
panic(err)
}
util.Panic(k.SweepBadDebts(ctx))
util.Panic(k.AccrueAllInterest(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
panic(err)
}
err := EndBlocker(ctx, am.keeper)
util.Panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
if err != nil {
panic(err)
}
util.Panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
if err := keeper.ResetQuota(ctx); err != nil {
panic(err)
}
util.Panic(keeper.ResetQuota(ctx))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@gsk967 gsk967 changed the title adding calls to util.Panic chore: adding calls to util.Panic Jan 31, 2023
Copy link
Collaborator

@gsk967 gsk967 left a comment

Choose a reason for hiding this comment

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

LGTM

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