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

Update insufficient Balance Err #3392

Closed
wants to merge 1 commit into from

Conversation

Liuhaai
Copy link
Member

@Liuhaai Liuhaai commented May 19, 2022

Description

fix err in #3377

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] Test A
  • [] Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@Liuhaai Liuhaai requested a review from a team as a code owner May 19, 2022 00:24
@@ -134,7 +135,7 @@ func (p *Protocol) assertEnoughBalance(
return err
}
if acc.Balance.Cmp(amount) < 0 {
return errors.New("balance is not enough for donation")
return errors.Wrapf(state.ErrNotEnoughBalance, "balance is not enough for donation")
Copy link
Member

@dustinxie dustinxie May 19, 2022

Choose a reason for hiding this comment

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

add %s", actionCtx.Caller.String() into error message?

Copy link
Member

Choose a reason for hiding this comment

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

think you can add this into 3377

@@ -694,7 +694,7 @@ func (p *Protocol) handleCandidateRegister(ctx context.Context, act *action.Cand
// update caller balance
if err := caller.SubBalance(act.Amount()); err != nil {
return log, nil, &handleError{
err: errors.Wrapf(err, "failed to update the balance of register %s", actCtx.Caller.String()),
err: errors.Wrapf(state.ErrNotEnoughBalance, "failed to update the balance of register %s", actCtx.Caller.String()),
Copy link
Member

Choose a reason for hiding this comment

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

these 3 are not necessary

@codecov
Copy link

codecov bot commented May 19, 2022

Codecov Report

Merging #3392 (6701cc0) into master (eb78dbd) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3392   +/-   ##
=======================================
  Coverage   75.22%   75.22%           
=======================================
  Files         236      236           
  Lines       21953    21953           
=======================================
  Hits        16514    16514           
  Misses       4554     4554           
  Partials      885      885           
Impacted Files Coverage Δ
action/protocol/rewarding/fund.go 85.07% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb78dbd...6701cc0. Read the comment docs.

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 this pull request may close these issues.

2 participants