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

fix: add ErrInvalidApproval errorcode for sp's approval invalid #175

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

jingjunLi
Copy link
Contributor

@jingjunLi jingjunLi commented Apr 13, 2023

Description

If the user creates a bucket on sp1 and then creates an object on sp2, the error message will be more accurate. Use the ErrInvalidApproval error code to indicate an invalid approval from sp.

Changes

Notable changes:

  • AccAddressFromHexUnsafe to MustAccAddressFromHex, to get sp's ApprovalAddress.
  • ...

@jingjunLi jingjunLi changed the title add invalid approval fix: add invalid approval Apr 13, 2023
@jingjunLi jingjunLi changed the title fix: add invalid approval fix: add invalid approval errorcode for sp's approval invalid Apr 13, 2023
@jingjunLi jingjunLi changed the title fix: add invalid approval errorcode for sp's approval invalid fix: add ErrInvalidApproval errorcode for sp's approval invalid Apr 13, 2023
@jingjunLi jingjunLi added the r4r label Apr 13, 2023
if err != nil {
return err
}
approvalAccAddress := sdk.MustAccAddressFromHex(sp.ApprovalAddress)

Copy link

Choose a reason for hiding this comment

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

Don't need to check the "err" value returned any more?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here the AccAddressFromHexUnsafe function is replaced with MustAccAddressFromHex.

It is agreed on the chain that the address stored on the chain must be correct, and the MustAccAddressFromHex interface is judged. If there is an error in parsing the address, it will panic.

Copy link
Contributor

@fynnss fynnss left a comment

Choose a reason for hiding this comment

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

LGTM

@unclezoro unclezoro merged commit 54103d4 into develop Apr 17, 2023
@unclezoro unclezoro deleted the chris/improve-error-code branch April 18, 2023 09:19
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.

4 participants