Skip to content

Commit

Permalink
add confirmFindingPaid cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
skyargos committed Nov 15, 2023
1 parent e24a7ff commit 3a7e395
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 92 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.18

require (
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.45.6
github.com/cosmos/cosmos-sdk v0.45.11
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v4 v4.0.0-rc2
github.com/cosmos/ibc-go/v4 v4.2.1
github.com/cosmos/tools/cmd/runsim v1.0.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7u
github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4=
github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok=
github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v4 v4.0.0-rc2 h1:rnCEMkDxhOYYFF8TN5IYO2jTuD6Qu15z7njYAQuhL/4=
github.com/cosmos/ibc-go/v4 v4.0.0-rc2/go.mod h1:4LK+uPycPhebJrJ8ebIqvsMEZ0lVRVNTiEyeI9zfB0U=
github.com/cosmos/ibc-go/v4 v4.2.1 h1:AlP2YGktkbkKOeN0bEVMKNKsfCQJrjF+dTWxERNRkRU=
github.com/cosmos/ibc-go/v4 v4.2.1/go.mod h1:EFFqkrJHQPHWUlw155QUxGuis4Ett4lvewAT5nvX0yU=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cosmos/tools/cmd/runsim v1.0.0 h1:xEHe8ieMX7vORhbQBL4mrjtGQ7ZqusHvsDVktv8Xun8=
Expand Down
28 changes: 25 additions & 3 deletions x/bounty/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func NewTxCmd() *cobra.Command {
NewCloseProgramCmd(),
NewSubmitFindingCmd(),
NewEditFindingCmd(),
NewConfirmFinding(),
NewConfirmFindingCmd(),
NewConfirmFindingPaidCmd(),
NewCloseFindingCmd(),
NewReleaseFindingCmd(),
)
Expand Down Expand Up @@ -290,11 +291,11 @@ func NewEditFindingCmd() *cobra.Command {
return cmd
}

func NewConfirmFinding() *cobra.Command {
func NewConfirmFindingCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "confirm-finding [finding id]",
Args: cobra.ExactArgs(1),
Short: "release the specific finding",
Short: "confirm the specific finding",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand All @@ -318,6 +319,27 @@ func NewConfirmFinding() *cobra.Command {
return cmd
}

func NewConfirmFindingPaidCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "confirm-finding-paid [finding id]",
Args: cobra.ExactArgs(1),
Short: "confirm the specific finding paid",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
submitAddr := clientCtx.GetFromAddress()
msg := types.NewMsgConfirmFindingPaid(args[0], submitAddr)
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}

func NewCloseFindingCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "close-finding [finding id]",
Expand Down
9 changes: 9 additions & 0 deletions x/bounty/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,39 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
case *types.MsgCreateProgram:
res, err := msgServer.CreateProgram(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 20 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L18-L20

Added lines #L18 - L20 were not covered by tests

case *types.MsgEditProgram:
res, err := msgServer.EditProgram(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 24 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L22-L24

Added lines #L22 - L24 were not covered by tests

case *types.MsgActivateProgram:
res, err := msgServer.ActivateProgram(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 28 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L26-L28

Added lines #L26 - L28 were not covered by tests

case *types.MsgCloseProgram:
res, err := msgServer.CloseProgram(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 32 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L30-L32

Added lines #L30 - L32 were not covered by tests

case *types.MsgSubmitFinding:
res, err := msgServer.SubmitFinding(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 36 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L34-L36

Added lines #L34 - L36 were not covered by tests

case *types.MsgEditFinding:
res, err := msgServer.EditFinding(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 40 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L38-L40

Added lines #L38 - L40 were not covered by tests

case *types.MsgConfirmFinding:
res, err := msgServer.ConfirmFinding(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 44 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L42-L44

Added lines #L42 - L44 were not covered by tests

case *types.MsgCloseFinding:
res, err := msgServer.CloseFinding(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 48 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L46-L48

Added lines #L46 - L48 were not covered by tests

case *types.MsgReleaseFinding:
res, err := msgServer.ReleaseFinding(sdk.WrapSDKContext(ctx), msg)
return sdk.WrapServiceResult(ctx, res, err)

Check warning on line 52 in x/bounty/handler.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/handler.go#L50-L52

Added lines #L50 - L52 were not covered by tests

default:
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
}
Expand Down
9 changes: 5 additions & 4 deletions x/bounty/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func (k msgServer) CreateProgram(goCtx context.Context, msg *types.MsgCreateProg
return nil, types.ErrProgramAlreadyExists
}

Check warning on line 35 in x/bounty/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/keeper/msg_server.go#L34-L35

Added lines #L34 - L35 were not covered by tests

program, err := types.NewProgram(msg.ProgramId, msg.Name, msg.Detail, operatorAddr, types.ProgramStatusInactive, msg.BountyLevels)
createTime := ctx.BlockHeader().Time
program, err := types.NewProgram(msg.ProgramId, msg.Name, msg.Detail, operatorAddr, types.ProgramStatusInactive, msg.BountyLevels, createTime)
if err != nil {
return nil, err
}

Check warning on line 41 in x/bounty/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/keeper/msg_server.go#L40-L41

Added lines #L40 - L41 were not covered by tests
Expand Down Expand Up @@ -66,7 +67,7 @@ func (k msgServer) EditProgram(goCtx context.Context, msg *types.MsgEditProgram)

program, found := k.GetProgram(ctx, msg.ProgramId)
if !found {
return nil, types.ErrNoProgramFound
return nil, types.ErrProgramNotExists
}

Check warning on line 71 in x/bounty/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/keeper/msg_server.go#L68-L71

Added lines #L68 - L71 were not covered by tests

// check the status.
Expand Down Expand Up @@ -183,8 +184,8 @@ func (k msgServer) SubmitFinding(goCtx context.Context, msg *types.MsgSubmitFind
return nil, types.ErrFindingAlreadyExists
}

submitTime := ctx.BlockHeader().Time
finding, err := types.NewFinding(msg.ProgramId, msg.FindingId, msg.Title, msg.Detail, msg.FindingHash, operatorAddr, submitTime, msg.SeverityLevel)
createTime := ctx.BlockHeader().Time
finding, err := types.NewFinding(msg.ProgramId, msg.FindingId, msg.Title, msg.Detail, msg.FindingHash, operatorAddr, createTime, msg.SeverityLevel)
if err != nil {
return nil, err
}

Check warning on line 191 in x/bounty/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/keeper/msg_server.go#L190-L191

Added lines #L190 - L191 were not covered by tests
Expand Down
24 changes: 9 additions & 15 deletions x/bounty/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ const (
errProgramFindingListMarshal
errProgramFindingListUnmarshal
errProgramAlreadyExists
errProgramNotExists
errProgramAlreadyActive
errProgramAlreadyClosed
errProgramNotExists
errProgramInactive
errProgramNotInactive
errProgramStatusInvalid
errProgramCreatorInvalid
errProgramNotAllowed
errProgramExpired
errProgramPubKey
errProgramID
errNoProgramFound
)

// Finding
Expand All @@ -46,20 +44,16 @@ var (
ErrProgramFindingListMarshal = sdkerrors.Register(ModuleName, errProgramFindingListMarshal, "convert uint64 to byte list error")
ErrProgramFindingListUnmarshal = sdkerrors.Register(ModuleName, errProgramFindingListUnmarshal, "convert to uint64 list error")
ErrProgramAlreadyExists = sdkerrors.Register(ModuleName, errProgramAlreadyExists, "program already exists")
ErrProgramNotExists = sdkerrors.Register(ModuleName, errProgramNotExists, "program does not exists")
ErrProgramAlreadyActive = sdkerrors.Register(ModuleName, errProgramAlreadyActive, "program already active")
ErrProgramAlreadyClosed = sdkerrors.Register(ModuleName, errProgramAlreadyClosed, "program already closed")

ErrProgramNotExists = sdkerrors.Register(ModuleName, errProgramNotExists, "program does not exists")
ErrProgramNotActive = sdkerrors.Register(ModuleName, errProgramInactive, "program status is not active")
ErrProgramNotInactive = sdkerrors.Register(ModuleName, errProgramNotInactive, "program status is not inactive")
ErrProgramStatusInvalid = sdkerrors.Register(ModuleName, errProgramStatusInvalid, "program status invalid")

ErrProgramCreatorInvalid = sdkerrors.Register(ModuleName, errProgramCreatorInvalid, "invalid program creator")
ErrProgramOperatorNotAllowed = sdkerrors.Register(ModuleName, errProgramNotAllowed, "program access denied")
ErrProgramExpired = sdkerrors.Register(ModuleName, errProgramExpired, "cannot end an expired program")
ErrProgramPubKey = sdkerrors.Register(ModuleName, errProgramPubKey, "invalid program public key")
ErrProgramID = sdkerrors.Register(ModuleName, errProgramID, "invalid program id")
ErrNoProgramFound = sdkerrors.Register(ModuleName, errNoProgramFound, "program does not exist")
ErrProgramNotActive = sdkerrors.Register(ModuleName, errProgramInactive, "program status is not active")
ErrProgramNotInactive = sdkerrors.Register(ModuleName, errProgramNotInactive, "program status is not inactive")
ErrProgramStatusInvalid = sdkerrors.Register(ModuleName, errProgramStatusInvalid, "program status invalid")
ErrProgramCreatorInvalid = sdkerrors.Register(ModuleName, errProgramCreatorInvalid, "invalid program creator")
ErrProgramOperatorNotAllowed = sdkerrors.Register(ModuleName, errProgramNotAllowed, "program access denied")
ErrProgramExpired = sdkerrors.Register(ModuleName, errProgramExpired, "cannot end an expired program")
ErrProgramID = sdkerrors.Register(ModuleName, errProgramID, "invalid program id")
)

// [2xx] Finding
Expand Down
4 changes: 2 additions & 2 deletions x/bounty/types/finding.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// Findings is an array of finding
type Findings []Finding

func NewFinding(pid, fid, title, detail, hash string, operator sdk.AccAddress, submitTime time.Time, level SeverityLevel) (Finding, error) {
func NewFinding(pid, fid, title, detail, hash string, operator sdk.AccAddress, createTime time.Time, level SeverityLevel) (Finding, error) {
return Finding{
ProgramId: pid,
FindingId: fid,
Expand All @@ -21,7 +21,7 @@ func NewFinding(pid, fid, title, detail, hash string, operator sdk.AccAddress, s
SeverityLevel: level,
Status: FindingStatusSubmitted,
Detail: detail,
CreateTime: submitTime,
CreateTime: createTime,
}, nil

Check warning on line 25 in x/bounty/types/finding.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/types/finding.go#L14-L25

Added lines #L14 - L25 were not covered by tests
}

Expand Down
67 changes: 31 additions & 36 deletions x/bounty/types/msgs.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package types

import (
"errors"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
Expand Down Expand Up @@ -67,16 +65,16 @@ func (msg MsgCreateProgram) GetSignBytes() []byte {
func (msg MsgCreateProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.ProgramId) == 0 {
return errors.New("empty programId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
if len(msg.Name) == 0 {
return errors.New("empty name is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty name")
}
if len(msg.Detail) == 0 {
return errors.New("empty detail is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty detail")
}
return nil
}
Expand Down Expand Up @@ -122,10 +120,10 @@ func (msg MsgEditProgram) GetSignBytes() []byte {
func (msg MsgEditProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.ProgramId) == 0 {
return errors.New("empty programId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
return nil
}
Expand Down Expand Up @@ -173,19 +171,22 @@ func (msg MsgSubmitFinding) GetSignBytes() []byte {
func (msg MsgSubmitFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.SubmitterAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.ProgramId) == 0 {
return errors.New("empty programId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
if len(msg.FindingId) == 0 {
return errors.New("empty findingId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingId")
}
if len(msg.Title) == 0 {
return errors.New("empty title is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty title")
}
if len(msg.FindingHash) == 0 {
return errors.New("empty findingHash is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingHash")
}
if len(msg.Detail) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty detail")
}
if !ValidFindingSeverityLevel(msg.SeverityLevel) {
return sdkerrors.Wrap(ErrFindingSeverityLevelInvalid, msg.SeverityLevel.String())
Expand Down Expand Up @@ -235,16 +236,10 @@ func (msg MsgEditFinding) GetSignBytes() []byte {
func (msg MsgEditFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.SubmitterAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.FindingId) == 0 {
return errors.New("empty fid is not allowed")
}
if len(msg.Title) == 0 {
return errors.New("empty title is not allowed")
}
if len(msg.FindingHash) == 0 {
return errors.New("empty findingHash is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingId")
}
if !ValidFindingSeverityLevel(msg.SeverityLevel) {
return sdkerrors.Wrap(ErrFindingSeverityLevelInvalid, msg.SeverityLevel.String())
Expand Down Expand Up @@ -282,10 +277,10 @@ func (msg MsgActivateProgram) GetSignBytes() []byte {
func (msg MsgActivateProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.ProgramId) == 0 {
return errors.New("empty programId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
return nil
}
Expand Down Expand Up @@ -320,10 +315,10 @@ func (msg MsgCloseProgram) GetSignBytes() []byte {
func (msg MsgCloseProgram) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.ProgramId) == 0 {
return errors.New("empty programId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
return nil
}
Expand Down Expand Up @@ -364,13 +359,13 @@ func (msg MsgConfirmFinding) GetSigners() []sdk.AccAddress {
func (msg MsgConfirmFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}
if len(msg.FindingId) == 0 {
return errors.New("empty findingId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty programId")
}
if len(msg.Fingerprint) == 0 {
return errors.New("empty fingerprint is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty fingerprint")
}

Check warning on line 369 in x/bounty/types/msgs.go

View check run for this annotation

Codecov / codecov/patch

x/bounty/types/msgs.go#L368-L369

Added lines #L368 - L369 were not covered by tests
return nil
}
Expand Down Expand Up @@ -410,11 +405,11 @@ func (msg MsgConfirmFindingPaid) GetSigners() []sdk.AccAddress {
func (msg MsgConfirmFindingPaid) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}

if len(msg.FindingId) == 0 {
return errors.New("empty findingId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingId")
}
return nil
}
Expand Down Expand Up @@ -454,11 +449,11 @@ func (msg MsgCloseFinding) GetSigners() []sdk.AccAddress {
func (msg MsgCloseFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}

if len(msg.FindingId) == 0 {
return errors.New("empty findingId is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingId")
}
return nil
}
Expand Down Expand Up @@ -500,17 +495,17 @@ func (msg MsgReleaseFinding) GetSignBytes() []byte {
func (msg MsgReleaseFinding) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.OperatorAddress)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error())
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}

if len(msg.FindingId) == 0 {
return errors.New("empty fid is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty findingId")
}
if len(msg.Description) == 0 {
return errors.New("empty description is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "description")
}
if len(msg.ProofOfConcept) == 0 {
return errors.New("empty proofOfConcept is not allowed")
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "empty proofOfConcept")
}
return nil
}
Loading

0 comments on commit 3a7e395

Please sign in to comment.