From 796581cc7b88abd5d8fa4bc03d0a060d3ce1feec Mon Sep 17 00:00:00 2001 From: zheng-bin Date: Mon, 13 Nov 2023 23:36:37 +0800 Subject: [PATCH] add confirm finding paid --- proto/shentu/bounty/v1/query.proto | 16 + proto/shentu/bounty/v1/tx.proto | 17 +- x/bounty/client/cli/flags.go | 5 +- x/bounty/client/cli/query.go | 40 +++ x/bounty/client/cli/tx.go | 72 ++-- x/bounty/keeper/grpc_query.go | 20 ++ x/bounty/keeper/msg_server.go | 45 ++- x/bounty/keeper/msg_server_test.go | 97 +++++- x/bounty/types/codec.go | 4 + x/bounty/types/events.go | 11 +- x/bounty/types/finding.go | 33 ++ x/bounty/types/msgs.go | 67 +++- x/bounty/types/query.pb.go | 471 +++++++++++++++++++++++--- x/bounty/types/query.pb.gw.go | 101 ++++++ x/bounty/types/tx.pb.go | 513 +++++++++++++++++++++++++---- 15 files changed, 1327 insertions(+), 185 deletions(-) diff --git a/proto/shentu/bounty/v1/query.proto b/proto/shentu/bounty/v1/query.proto index 5384fef98..2d2fca31b 100644 --- a/proto/shentu/bounty/v1/query.proto +++ b/proto/shentu/bounty/v1/query.proto @@ -41,6 +41,11 @@ service Query { rpc Finding(QueryFindingRequest) returns (QueryFindingResponse) { option (google.api.http).get = "/shentu/bounty/v1/findings/{finding_id}"; } + + // FindingFingerprint queries Finding Fingerprint based on FindingId. + rpc FindingFingerprint(QueryFindingFingerprintRequest) returns (QueryFindingFingerprintResponse) { + option (google.api.http).get = "/shentu/bounty/v1/findings/{finding_id}/fingerprint"; + } } // QueryHostsRequest is the request type for the Query/Hosts RPC method. @@ -113,3 +118,14 @@ message QueryFindingRequest { message QueryFindingResponse { Finding finding = 1 [(gogoproto.nullable) = false]; } + +// QueryFindingFingerPrint is the request type for the Query/Finding RPC method. +message QueryFindingFingerprintRequest { + // finding_id defines the unique id of the finding. + string finding_id = 1; +} + +// QueryFindingFingerPrintResponse is the response type for the Query/Finding RPC method. +message QueryFindingFingerprintResponse { + string fingerprint = 1; +} \ No newline at end of file diff --git a/proto/shentu/bounty/v1/tx.proto b/proto/shentu/bounty/v1/tx.proto index ead85b5a3..0dd9345e0 100644 --- a/proto/shentu/bounty/v1/tx.proto +++ b/proto/shentu/bounty/v1/tx.proto @@ -34,6 +34,9 @@ service Msg { // ConfirmFinding defines a method for host confirm a finding. rpc ConfirmFinding(MsgConfirmFinding) returns (MsgConfirmFindingResponse); + // ConfirmFindingPaid defines a method for submitter confirm a finding paid + rpc ConfirmFindingPaid(MsgConfirmFindingPaid) returns (MsgConfirmFindingPaidResponse); + // CloseFinding defines a method for submitter or certifier close a finding rpc CloseFinding(MsgCloseFinding) returns (MsgCloseFindingResponse); @@ -133,12 +136,24 @@ message MsgConfirmFinding { string finding_id = 1 [(gogoproto.moretags) = "yaml:\"finding_id\""]; string operator_address = 2 [(gogoproto.moretags) = "yaml:\"operator_address\""]; - string finger_print = 3 [(gogoproto.moretags) = "yaml:\"finger_print\""]; + string fingerprint = 3; } // MsgConfirmFindingResponse defines the Msg/AcceptFinding response type. message MsgConfirmFindingResponse {} +// MsgConfirmFindingPaid defines a message to close a finding to an existing finding. +message MsgConfirmFindingPaid { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string finding_id = 1 [(gogoproto.moretags) = "yaml:\"finding_id\""]; + string operator_address = 2 [(gogoproto.moretags) = "yaml:\"operator_address\""]; +} + +// MsgCloseFindingResponse defines the Msg/CloseFinding response type. +message MsgConfirmFindingPaidResponse {} + // MsgCloseFinding defines a message to close a finding to an existing finding. message MsgCloseFinding { option (gogoproto.equal) = false; diff --git a/x/bounty/client/cli/flags.go b/x/bounty/client/cli/flags.go index e006dc899..729844f0d 100644 --- a/x/bounty/client/cli/flags.go +++ b/x/bounty/client/cli/flags.go @@ -8,10 +8,9 @@ const ( FlagDetail = "detail" FlagFindingTitle = "title" - FlagFindingSeverityLevel = "severity-level" FlagFindingDescription = "desc" FlagFindingProofOfContent = "poc" - FlagFindingFingerPrint = "fingerPrint," - FlagFindingAddress = "finding-address" + FlagFindingSeverityLevel = "severity-level" + FlagFindingFingerprint = "fingerprint" FlagSubmitterAddress = "submitter-address" ) diff --git a/x/bounty/client/cli/query.go b/x/bounty/client/cli/query.go index 8b073279e..d8b72543e 100644 --- a/x/bounty/client/cli/query.go +++ b/x/bounty/client/cli/query.go @@ -31,6 +31,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryPrograms(), GetCmdQueryFinding(), GetCmdQueryFindings(), + GetCmdQueryFindingFingerPrint(), ) return bountyQueryCmd @@ -247,3 +248,42 @@ $ %s query bounty findings --page=1 --limit=100 flags.AddQueryFlagsToCmd(cmd) return cmd } + +// GetCmdQueryFindingFingerPrint implements the query finding fingerPrint command. +func GetCmdQueryFindingFingerPrint() *cobra.Command { + cmd := &cobra.Command{ + Use: "fingerprint [finding-id]", + Args: cobra.ExactArgs(1), + Short: "Query fingerPrint of a single finding", + Long: strings.TrimSpace( + fmt.Sprintf(`Query fingerPrint for a finding. You can find the finding-id by running "%s query bounty findings". +Example: +$ %s query bounty finding 1 +`, + version.AppName, version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + // Query the finding + res, err := queryClient.FindingFingerprint( + cmd.Context(), + &types.QueryFindingFingerprintRequest{ + FindingId: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/bounty/client/cli/tx.go b/x/bounty/client/cli/tx.go index ef5f47e5b..86f975718 100644 --- a/x/bounty/client/cli/tx.go +++ b/x/bounty/client/cli/tx.go @@ -3,16 +3,11 @@ package cli import ( "crypto/sha256" "encoding/hex" - "fmt" - "strings" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/version" - "github.com/shentufoundation/shentu/v2/x/bounty/types" ) @@ -189,13 +184,13 @@ func NewSubmitFindingCmd() *cobra.Command { if err != nil { return err } - severityLevel, err := cmd.Flags().GetInt32(FlagFindingSeverityLevel) + severityLevel, err := cmd.Flags().GetString(FlagFindingSeverityLevel) if err != nil { return err } - _, ok := types.SeverityLevel_name[severityLevel] - if !ok { - return fmt.Errorf("invalid %s value", FlagFindingSeverityLevel) + byteSeverityLevel, err := types.SeverityLevelFromString(types.NormalizeSeverityLevel(severityLevel)) + if err != nil { + return err } desc, err := cmd.Flags().GetString(FlagFindingDescription) @@ -208,7 +203,7 @@ func NewSubmitFindingCmd() *cobra.Command { } hash := sha256.Sum256([]byte(desc + poc + submitAddr.String())) - msg := types.NewMsgSubmitFinding(pid, fid, title, detail, hex.EncodeToString(hash[:]), submitAddr, types.SeverityLevel(severityLevel)) + msg := types.NewMsgSubmitFinding(pid, fid, title, detail, hex.EncodeToString(hash[:]), submitAddr, byteSeverityLevel) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -219,7 +214,7 @@ func NewSubmitFindingCmd() *cobra.Command { cmd.Flags().String(FlagFindingDescription, "", "The finding's description") cmd.Flags().String(FlagFindingProofOfContent, "", "The finding's proof of content") cmd.Flags().String(FlagDetail, "", "The finding's detail") - cmd.Flags().Int32(FlagFindingSeverityLevel, 0, "The finding's severity level") + cmd.Flags().String(FlagFindingSeverityLevel, "unspecified", "The finding's severity level") flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) @@ -259,7 +254,11 @@ func NewEditFindingCmd() *cobra.Command { if err != nil { return err } - severityLevel, err := cmd.Flags().GetInt32(FlagFindingSeverityLevel) + severityLevel, err := cmd.Flags().GetString(FlagFindingSeverityLevel) + if err != nil { + return err + } + byteSeverityLevel, err := types.SeverityLevelFromString(types.NormalizeSeverityLevel(severityLevel)) if err != nil { return err } @@ -275,7 +274,7 @@ func NewEditFindingCmd() *cobra.Command { hash := sha256.Sum256([]byte(desc + poc + submitAddr.String())) hashString := hex.EncodeToString(hash[:]) - msg := types.NewMsgEditFinding(pid, fid, title, detail, hashString, submitAddr, types.SeverityLevel(severityLevel)) + msg := types.NewMsgEditFinding(pid, fid, title, detail, hashString, submitAddr, byteSeverityLevel) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -286,7 +285,7 @@ func NewEditFindingCmd() *cobra.Command { cmd.Flags().String(FlagFindingDescription, "", "The finding's description") cmd.Flags().String(FlagFindingProofOfContent, "", "The finding's proof of content") cmd.Flags().String(FlagDetail, "", "The finding's detail") - cmd.Flags().Int32(FlagFindingSeverityLevel, 0, "The finding's severity level") + cmd.Flags().String(FlagFindingSeverityLevel, "unspecified", "The finding's severity level") flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) @@ -296,45 +295,34 @@ func NewEditFindingCmd() *cobra.Command { return cmd } -// NewConfirmFinding implements accept a finding by host. func NewConfirmFinding() *cobra.Command { cmd := &cobra.Command{ - Use: "confirm-finding [finding-id]", + Use: "confirm-finding [finding id]", Args: cobra.ExactArgs(1), - Short: "Host confirm a finding", - Long: strings.TrimSpace( - fmt.Sprintf(`Host accept a finding for a program.Meantime, you can also add some comments, which will be encrypted. -Example: -$ %s tx bounty confirm-finding 1 --comment "Looks good to me" -`, - version.AppName, - ), - ), - RunE: ConfirmFinding, + Short: "release the specific finding", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + submitAddr := clientCtx.GetFromAddress() + fingerprint, err := cmd.Flags().GetString(FlagFindingFingerprint) + if err != nil { + return err + } + msg := types.NewMsgConfirmFinding(args[0], fingerprint, submitAddr) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, } + cmd.Flags().String(FlagFindingFingerprint, "", "The finding's fingerprint") flags.AddTxFlagsToCmd(cmd) - _ = cmd.MarkFlagRequired(flags.FlagFrom) + _ = cmd.MarkFlagRequired(FlagFindingFingerprint) return cmd } -func ConfirmFinding(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - fingerPrint, err := cmd.Flags().GetString(FlagFindingFingerPrint) - - // Get host address - hostAddr := clientCtx.GetFromAddress() - msg := types.NewMsgConfirmFinding(args[0], fingerPrint, hostAddr) - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) -} - func NewCloseFindingCmd() *cobra.Command { cmd := &cobra.Command{ Use: "close-finding [finding id]", diff --git a/x/bounty/keeper/grpc_query.go b/x/bounty/keeper/grpc_query.go index e2fa3188f..f20611a86 100644 --- a/x/bounty/keeper/grpc_query.go +++ b/x/bounty/keeper/grpc_query.go @@ -2,6 +2,8 @@ package keeper import ( "context" + "crypto/sha256" + "encoding/hex" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -116,3 +118,21 @@ func (k Keeper) Finding(c context.Context, req *types.QueryFindingRequest) (*typ return &types.QueryFindingResponse{Finding: finding}, nil } + +func (k Keeper) FindingFingerprint(c context.Context, req *types.QueryFindingFingerprintRequest) (*types.QueryFindingFingerprintResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + if len(req.FindingId) == 0 { + return nil, status.Error(codes.InvalidArgument, "finding-id can not be 0") + } + + ctx := sdk.UnwrapSDKContext(c) + finding, found := k.GetFinding(ctx, req.FindingId) + if !found { + return nil, status.Errorf(codes.NotFound, "finding %s doesn't exist", req.FindingId) + } + + hash := sha256.Sum256(k.cdc.MustMarshal(&finding)) + return &types.QueryFindingFingerprintResponse{Fingerprint: hex.EncodeToString(hash[:])}, nil +} diff --git a/x/bounty/keeper/msg_server.go b/x/bounty/keeper/msg_server.go index 1cbb635a5..843d60270 100644 --- a/x/bounty/keeper/msg_server.go +++ b/x/bounty/keeper/msg_server.go @@ -313,12 +313,53 @@ func (k msgServer) hostProcess(ctx sdk.Context, msg *types.MsgConfirmFinding) (t // fingerprint comparison bz := k.cdc.MustMarshal(&finding) hash := sha256.Sum256(bz) - if msg.FingerPrint != hex.EncodeToString(hash[:]) { + if msg.Fingerprint != hex.EncodeToString(hash[:]) { return finding, types.ErrFindingHashInvalid } return finding, nil } +func (k msgServer) ConfirmFindingPaid(goCtx context.Context, msg *types.MsgConfirmFindingPaid) (*types.MsgConfirmFindingPaidResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + operatorAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) + if err != nil { + return nil, err + } + + // get finding + finding, ok := k.GetFinding(ctx, msg.FindingId) + if !ok { + return nil, types.ErrFindingNotExists + } + if finding.Status != types.FindingStatusConfirmed { + return nil, types.ErrFindingStatusInvalid + } + + // check operator: finding owner, certificate + if finding.SubmitterAddress != msg.OperatorAddress && !k.certKeeper.IsBountyAdmin(ctx, operatorAddr) { + return nil, types.ErrFindingOperatorNotAllowed + } + + finding.Status = types.FindingStatusPaid + k.SetFinding(ctx, finding) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeConfirmFindingPaid, + sdk.NewAttribute(types.AttributeKeyFindingID, msg.FindingId), + sdk.NewAttribute(types.AttributeKeyProgramID, finding.ProgramId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.OperatorAddress), + ), + }) + + return &types.MsgConfirmFindingPaidResponse{}, nil +} + func (k msgServer) CloseFinding(goCtx context.Context, msg *types.MsgCloseFinding) (*types.MsgCloseFindingResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -396,6 +437,8 @@ func (k msgServer) ReleaseFinding(goCtx context.Context, msg *types.MsgReleaseFi if program.AdminAddress != msg.OperatorAddress { return nil, types.ErrProgramCreatorInvalid } + default: + return nil, types.ErrFindingStatusInvalid } // check hash diff --git a/x/bounty/keeper/msg_server_test.go b/x/bounty/keeper/msg_server_test.go index ce4b70ec9..b7f2d181a 100644 --- a/x/bounty/keeper/msg_server_test.go +++ b/x/bounty/keeper/msg_server_test.go @@ -162,11 +162,9 @@ func (suite *KeeperTestSuite) TestConfirmFinding() { finding, found := suite.keeper.GetFinding(suite.ctx, fid) suite.Require().True(found) - // fingerprint calculate cdc := shentuapp.MakeEncodingConfig().Marshaler - bz := cdc.MustMarshal(&finding) - hash := sha256.Sum256(bz) + hash := sha256.Sum256(cdc.MustMarshal(&finding)) testCases := []struct { name string @@ -183,7 +181,7 @@ func (suite *KeeperTestSuite) TestConfirmFinding() { &types.MsgConfirmFinding{ FindingId: fid, OperatorAddress: suite.address[0].String(), - FingerPrint: hex.EncodeToString(hash[:]), + Fingerprint: hex.EncodeToString(hash[:]), }, true, }, @@ -207,6 +205,56 @@ func (suite *KeeperTestSuite) TestConfirmFinding() { } } +func (suite *KeeperTestSuite) TestConfirmFindingPaid() { + pid, fid := uuid.NewString(), uuid.NewString() + suite.InitCreateProgram(pid) + suite.InitActivateProgram(pid) + suite.InitSubmitFinding(pid, fid) + + finding, found := suite.keeper.GetFinding(suite.ctx, fid) + suite.Require().True(found) + // fingerprint calculate + cdc := shentuapp.MakeEncodingConfig().Marshaler + hash := sha256.Sum256(cdc.MustMarshal(&finding)) + suite.InitConfirmFinding(fid, hex.EncodeToString(hash[:])) + + testCases := []struct { + name string + req *types.MsgConfirmFindingPaid + expPass bool + }{ + { + "empty request", + &types.MsgConfirmFindingPaid{}, + false, + }, + { + "valid request", + &types.MsgConfirmFindingPaid{ + FindingId: fid, + OperatorAddress: suite.address[0].String(), + }, + true, + }, + } + + for _, testCase := range testCases { + suite.Run(fmt.Sprintf("Case %s", testCase.name), func() { + ctx := sdk.WrapSDKContext(suite.ctx) + _, err := suite.msgServer.ConfirmFindingPaid(ctx, testCase.req) + finding, _ := suite.keeper.GetFinding(suite.ctx, fid) + + if testCase.expPass { + suite.Require().NoError(err) + suite.Require().Equal(finding.Status, types.FindingStatusPaid) + } else { + suite.Require().Error(err) + suite.Require().Equal(finding.Status, types.FindingStatusConfirmed) + } + }) + } +} + func (suite *KeeperTestSuite) TestCloseFinding() { pid, fid := uuid.NewString(), uuid.NewString() suite.InitCreateProgram(pid) @@ -250,12 +298,21 @@ func (suite *KeeperTestSuite) TestCloseFinding() { } } -func (suite *KeeperTestSuite) TestReleaseFinding() { +func (suite *KeeperTestSuite) TestReleaseConfirmFinding() { pid, fid := uuid.NewString(), uuid.NewString() suite.InitCreateProgram(pid) suite.InitActivateProgram(pid) suite.InitSubmitFinding(pid, fid) + finding, found := suite.keeper.GetFinding(suite.ctx, fid) + suite.Require().True(found) + // fingerprint calculate + cdc := shentuapp.MakeEncodingConfig().Marshaler + hash := sha256.Sum256(cdc.MustMarshal(&finding)) + suite.InitConfirmFinding(fid, hex.EncodeToString(hash[:])) + + suite.InitConfirmFindingPaid(fid) + testCases := []struct { name string req *types.MsgReleaseFinding @@ -288,9 +345,10 @@ func (suite *KeeperTestSuite) TestReleaseFinding() { if testCase.expPass { suite.Require().NoError(err) suite.Require().Equal(finding.Description, "desc") + suite.Require().Equal(finding.ProofOfConcept, "poc") } else { suite.Require().Error(err) - suite.Require().Equal(finding.Status, types.FindingStatusSubmitted) + suite.Require().Equal(finding.Status, types.FindingStatusPaid) } }) } @@ -340,3 +398,30 @@ func (suite *KeeperTestSuite) InitSubmitFinding(pid, fid string) string { return msgSubmitFinding.FindingId } + +func (suite *KeeperTestSuite) InitConfirmFinding(fid, fingerprint string) string { + msgConfirmFinding := &types.MsgConfirmFinding{ + FindingId: fid, + OperatorAddress: suite.address[0].String(), + Fingerprint: fingerprint, + } + + ctx := sdk.WrapSDKContext(suite.ctx) + _, err := suite.msgServer.ConfirmFinding(ctx, msgConfirmFinding) + suite.Require().NoError(err) + + return msgConfirmFinding.FindingId +} + +func (suite *KeeperTestSuite) InitConfirmFindingPaid(fid string) string { + msgConfirmFindingPaid := &types.MsgConfirmFindingPaid{ + FindingId: fid, + OperatorAddress: suite.address[0].String(), + } + + ctx := sdk.WrapSDKContext(suite.ctx) + _, err := suite.msgServer.ConfirmFindingPaid(ctx, msgConfirmFindingPaid) + suite.Require().NoError(err) + + return msgConfirmFindingPaid.FindingId +} diff --git a/x/bounty/types/codec.go b/x/bounty/types/codec.go index 0650efd2b..c25489803 100644 --- a/x/bounty/types/codec.go +++ b/x/bounty/types/codec.go @@ -18,6 +18,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(MsgSubmitFinding{}, "bounty/SubmitFinding", nil) cdc.RegisterConcrete(MsgEditFinding{}, "bounty/EditFinding", nil) cdc.RegisterConcrete(MsgConfirmFinding{}, "bounty/ConfirmFinding", nil) + cdc.RegisterConcrete(MsgConfirmFindingPaid{}, "bounty/ConfirmFindingPaid", nil) cdc.RegisterConcrete(MsgCloseFinding{}, "bounty/CloseFinding", nil) cdc.RegisterConcrete(MsgReleaseFinding{}, "bounty/ReleaseFinding", nil) } @@ -26,9 +27,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateProgram{}, &MsgEditProgram{}, + &MsgActivateProgram{}, &MsgCloseProgram{}, &MsgSubmitFinding{}, + &MsgEditFinding{}, &MsgConfirmFinding{}, + &MsgConfirmFindingPaid{}, &MsgCloseFinding{}, &MsgReleaseFinding{}, ) diff --git a/x/bounty/types/events.go b/x/bounty/types/events.go index cb11abaa4..8489c4b2b 100644 --- a/x/bounty/types/events.go +++ b/x/bounty/types/events.go @@ -6,11 +6,12 @@ const ( EventTypeActivateProgram = "activate_program" EventTypeCloseProgram = "close_program" - EventTypeSubmitFinding = "submit_finding" - EventTypeEditFinding = "edit_finding" - EventTypeConfirmFinding = "confirm_finding" - EventTypeCloseFinding = "close_finding" - EventTypeReleaseFinding = "release_finding" + EventTypeSubmitFinding = "submit_finding" + EventTypeEditFinding = "edit_finding" + EventTypeConfirmFinding = "confirm_finding" + EventTypeConfirmFindingPaid = "confirm_finding_paid" + EventTypeCloseFinding = "close_finding" + EventTypeReleaseFinding = "release_finding" AttributeKeyProgramID = "program_id" AttributeKeyFindingID = "finding_id" diff --git a/x/bounty/types/finding.go b/x/bounty/types/finding.go index bbb90f90f..9aa787a7f 100644 --- a/x/bounty/types/finding.go +++ b/x/bounty/types/finding.go @@ -1,6 +1,8 @@ package types import ( + "fmt" + "strings" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -71,3 +73,34 @@ func ValidFindingSeverityLevel(level SeverityLevel) bool { } return false } + +// SeverityLevelFromString returns a SeverityLevel from a string. It returns an error +// if the string is invalid. +func SeverityLevelFromString(str string) (SeverityLevel, error) { + option, ok := SeverityLevel_value[str] + if !ok { + return Unspecified, fmt.Errorf("'%s' is not a valid SeverityLevel option", str) + } + return SeverityLevel(option), nil +} + +// NormalizeSeverityLevel - normalize user specified severity level +func NormalizeSeverityLevel(level string) string { + upperLevel := strings.ToUpper(level) + switch upperLevel { + case "UNSPECIFIED": + return Unspecified.String() + case "CRITICAL": + return Critical.String() + case "HIGH": + return High.String() + case "MEDIUM": + return Medium.String() + case "LOW": + return Low.String() + case "INFORMATIONAL": + return Informational.String() + default: + return level + } +} diff --git a/x/bounty/types/msgs.go b/x/bounty/types/msgs.go index 142037867..0f157dd86 100644 --- a/x/bounty/types/msgs.go +++ b/x/bounty/types/msgs.go @@ -8,15 +8,16 @@ import ( ) const ( - TypeMsgCreateProgram = "create_program" - TypeMsgEditProgram = "edit_program" - TypeMsgActivateProgram = "activate_program" - TypeMsgCloseProgram = "close_program" - TypeMsgSubmitFinding = "submit_finding" - TypeMsgEditFinding = "edit_finding" - TypeMsgConfirmFinding = "confirm_finding" - TypeMsgCloseFinding = "close_finding" - TypeMsgReleaseFinding = "release_finding" + TypeMsgCreateProgram = "create_program" + TypeMsgEditProgram = "edit_program" + TypeMsgActivateProgram = "activate_program" + TypeMsgCloseProgram = "close_program" + TypeMsgSubmitFinding = "submit_finding" + TypeMsgEditFinding = "edit_finding" + TypeMsgConfirmFinding = "confirm_finding" + TypeMsgConfirmFindingPaid = "confirm_finding_paid" + TypeMsgCloseFinding = "close_finding" + TypeMsgReleaseFinding = "release_finding" ) var ( @@ -296,11 +297,11 @@ func (msg MsgCloseProgram) ValidateBasic() error { return nil } -func NewMsgConfirmFinding(findingID, fingerPrint string, hostAddr sdk.AccAddress) *MsgConfirmFinding { +func NewMsgConfirmFinding(findingID, fingerprint string, hostAddr sdk.AccAddress) *MsgConfirmFinding { return &MsgConfirmFinding{ FindingId: findingID, OperatorAddress: hostAddr.String(), - FingerPrint: fingerPrint, + Fingerprint: fingerprint, } } @@ -341,6 +342,50 @@ func (msg MsgConfirmFinding) ValidateBasic() error { return nil } +func NewMsgConfirmFindingPaid(findingID string, hostAddr sdk.AccAddress) *MsgConfirmFindingPaid { + return &MsgConfirmFindingPaid{ + FindingId: findingID, + OperatorAddress: hostAddr.String(), + } +} + +// Route implements the sdk.Msg interface. +func (msg MsgConfirmFindingPaid) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgConfirmFindingPaid) Type() string { return TypeMsgConfirmFindingPaid } + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgConfirmFindingPaid) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgConfirmFindingPaid) GetSigners() []sdk.AccAddress { + // host should sign the message + hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{hostAddr} +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgConfirmFindingPaid) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid issuer address (%s)", err.Error()) + } + + if len(msg.FindingId) == 0 { + return errors.New("empty finding-id is not allowed") + } + return nil +} + func NewMsgCloseFinding(findingID string, hostAddr sdk.AccAddress) *MsgCloseFinding { return &MsgCloseFinding{ FindingId: findingID, diff --git a/x/bounty/types/query.pb.go b/x/bounty/types/query.pb.go index ca6ecfb3b..5dde878a9 100644 --- a/x/bounty/types/query.pb.go +++ b/x/bounty/types/query.pb.go @@ -587,6 +587,97 @@ func (m *QueryFindingResponse) GetFinding() Finding { return Finding{} } +// QueryFindingFingerPrint is the request type for the Query/Finding RPC method. +type QueryFindingFingerprintRequest struct { + // finding_id defines the unique id of the finding. + FindingId string `protobuf:"bytes,1,opt,name=finding_id,json=findingId,proto3" json:"finding_id,omitempty"` +} + +func (m *QueryFindingFingerprintRequest) Reset() { *m = QueryFindingFingerprintRequest{} } +func (m *QueryFindingFingerprintRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFindingFingerprintRequest) ProtoMessage() {} +func (*QueryFindingFingerprintRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_31c92d65cbd97e4b, []int{12} +} +func (m *QueryFindingFingerprintRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFindingFingerprintRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFindingFingerprintRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFindingFingerprintRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFindingFingerprintRequest.Merge(m, src) +} +func (m *QueryFindingFingerprintRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFindingFingerprintRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFindingFingerprintRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFindingFingerprintRequest proto.InternalMessageInfo + +func (m *QueryFindingFingerprintRequest) GetFindingId() string { + if m != nil { + return m.FindingId + } + return "" +} + +// QueryFindingFingerPrintResponse is the response type for the Query/Finding RPC method. +type QueryFindingFingerprintResponse struct { + Fingerprint string `protobuf:"bytes,1,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"` +} + +func (m *QueryFindingFingerprintResponse) Reset() { *m = QueryFindingFingerprintResponse{} } +func (m *QueryFindingFingerprintResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFindingFingerprintResponse) ProtoMessage() {} +func (*QueryFindingFingerprintResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_31c92d65cbd97e4b, []int{13} +} +func (m *QueryFindingFingerprintResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFindingFingerprintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFindingFingerprintResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryFindingFingerprintResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFindingFingerprintResponse.Merge(m, src) +} +func (m *QueryFindingFingerprintResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFindingFingerprintResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFindingFingerprintResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFindingFingerprintResponse proto.InternalMessageInfo + +func (m *QueryFindingFingerprintResponse) GetFingerprint() string { + if m != nil { + return m.Fingerprint + } + return "" +} + func init() { proto.RegisterType((*QueryHostsRequest)(nil), "shentu.bounty.v1.QueryHostsRequest") proto.RegisterType((*QueryHostsResponse)(nil), "shentu.bounty.v1.QueryHostsResponse") @@ -600,54 +691,60 @@ func init() { proto.RegisterType((*QueryFindingsResponse)(nil), "shentu.bounty.v1.QueryFindingsResponse") proto.RegisterType((*QueryFindingRequest)(nil), "shentu.bounty.v1.QueryFindingRequest") proto.RegisterType((*QueryFindingResponse)(nil), "shentu.bounty.v1.QueryFindingResponse") + proto.RegisterType((*QueryFindingFingerprintRequest)(nil), "shentu.bounty.v1.QueryFindingFingerprintRequest") + proto.RegisterType((*QueryFindingFingerprintResponse)(nil), "shentu.bounty.v1.QueryFindingFingerprintResponse") } func init() { proto.RegisterFile("shentu/bounty/v1/query.proto", fileDescriptor_31c92d65cbd97e4b) } var fileDescriptor_31c92d65cbd97e4b = []byte{ - // 663 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0xd4, 0x40, - 0x14, 0xde, 0xf2, 0x7b, 0x87, 0x0b, 0x0c, 0x18, 0x61, 0x85, 0x42, 0x8a, 0x2c, 0x28, 0x49, 0x27, - 0x8b, 0x5e, 0x8c, 0x27, 0x38, 0xa0, 0xc6, 0x0b, 0xec, 0xd1, 0x83, 0xa4, 0xa5, 0x43, 0xb7, 0x89, - 0xdb, 0x29, 0x9d, 0x29, 0x91, 0x20, 0x31, 0xf1, 0xe6, 0xcd, 0x44, 0xaf, 0xfe, 0x03, 0xfe, 0x25, - 0x1c, 0x49, 0xbc, 0x78, 0x32, 0x86, 0xf5, 0x0f, 0x31, 0x9d, 0xbe, 0xe9, 0xaf, 0x4d, 0xb7, 0x26, - 0x7a, 0x6b, 0xde, 0xfb, 0xde, 0xf7, 0xbd, 0xf7, 0xbd, 0xbc, 0x29, 0x5a, 0xe1, 0x3d, 0xea, 0x8b, - 0x88, 0xd8, 0x2c, 0xf2, 0xc5, 0x05, 0x39, 0xef, 0x90, 0xb3, 0x88, 0x86, 0x17, 0x66, 0x10, 0x32, - 0xc1, 0xf0, 0x5c, 0x92, 0x35, 0x93, 0xac, 0x79, 0xde, 0x69, 0x2d, 0xba, 0xcc, 0x65, 0x32, 0x49, - 0xe2, 0xaf, 0x04, 0xd7, 0x5a, 0x71, 0x19, 0x73, 0xdf, 0x50, 0x62, 0x05, 0x1e, 0xb1, 0x7c, 0x9f, -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 0x51, 0x57, 0x8f, 0xdb, 0x15, - 0xec, 0xa5, 0x77, 0xa7, 0xb5, 0x55, 0x8b, 0x83, 0x4e, 0x0c, 0xd9, 0xc9, 0x0a, 0x6e, 0x0d, 0x77, - 0x92, 0xbe, 0x12, 0x1f, 0x35, 0x34, 0x0d, 0x85, 0x78, 0x73, 0x34, 0xb1, 0xd2, 0x6f, 0xd7, 0xc1, - 0xd4, 0xeb, 0x2b, 0xe5, 0x1f, 0xe0, 0xad, 0x6a, 0x79, 0x72, 0x99, 0xdd, 0xad, 0x34, 0x43, 0x1d, - 0x4b, 0xa5, 0x19, 0xa5, 0xd3, 0xaf, 0x34, 0xa3, 0x7c, 0x75, 0xa3, 0xcc, 0x48, 0x8f, 0x2b, 0x36, - 0x03, 0x0a, 0x2b, 0xcd, 0x28, 0xde, 0x4b, 0xab, 0x5d, 0x07, 0xab, 0x37, 0x43, 0xc9, 0x93, 0xcb, - 0xec, 0xf2, 0xae, 0xf6, 0x5f, 0x5e, 0xdf, 0xea, 0xda, 0xcd, 0xad, 0xae, 0xfd, 0xba, 0xd5, 0xb5, - 0x4f, 0x03, 0xbd, 0x71, 0x33, 0xd0, 0x1b, 0x3f, 0x06, 0x7a, 0xe3, 0x55, 0xc7, 0xf5, 0x44, 0x2f, - 0xb2, 0xcd, 0x13, 0xd6, 0x07, 0xb2, 0x53, 0x16, 0xf9, 0x8e, 0x3c, 0x6b, 0xc5, 0xfe, 0x56, 0xf1, - 0x8b, 0x8b, 0x80, 0x72, 0x7b, 0x4a, 0xfe, 0x3a, 0x1f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x88, - 0x80, 0x0f, 0xf8, 0xeb, 0x07, 0x00, 0x00, + // 732 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0xd4, 0x40, + 0x14, 0xdf, 0xf2, 0x47, 0xd8, 0xe1, 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d, 0x8d, 0x41, 0x21, 0x5e, 0xe9, + 0x0f, 0xac, 0xf8, 0x6b, 0x65, 0x69, 0xea, 0x3f, 0x40, 0xd2, 0xdf, 0xc5, 0xab, 0xc5, 0xf4, 0xe4, + 0x2c, 0xbd, 0x1e, 0xd2, 0x0c, 0xb5, 0xb2, 0x85, 0x66, 0xf4, 0x1c, 0xa0, 0x42, 0x33, 0x7a, 0x77, + 0xbf, 0x9f, 0x19, 0xc9, 0x8a, 0x77, 0xcc, 0x80, 0xc2, 0x42, 0x33, 0xba, 0xb7, 0x56, 0xaf, 0x95, + 0xa5, 0x95, 0x9b, 0xa1, 0xe8, 0xc9, 0x59, 0xba, 0x6b, 0xe7, 0xf8, 0xab, 0x86, 0x70, 0x7e, 0xaf, + 0xf0, 0xfd, 0xfe, 0x7c, 0xf9, 0x1d, 0xd6, 0xeb, 0x7f, 0x51, 0x01, 0x62, 0xb7, 0xa4, 0xd8, 0x87, + 0x78, 0x73, 0x40, 0xb1, 0x24, 0xb3, 0xcf, 0x3b, 0x2f, 0x2e, 0xae, 0x0c, 0xed, 0xf2, 0xca, 0xd0, + 0x7e, 0x5d, 0x19, 0xda, 0xc7, 0x6b, 0xa3, 0x72, 0x79, 0x6d, 0x54, 0x7e, 0x5c, 0x1b, 0x95, 0x97, + 0x75, 0xd7, 0x13, 0xad, 0xa8, 0x69, 0x1d, 0xb2, 0x36, 0x00, 0x1f, 0xb1, 0xc8, 0x77, 0xe4, 0x55, + 0x54, 0x4c, 0x6f, 0x14, 0x97, 0x38, 0x0d, 0x28, 0x6f, 0xde, 0x90, 0x5f, 0x1e, 0x9b, 0x7f, 0x02, + 0x00, 0x00, 0xff, 0xff, 0xaa, 0x6a, 0xc2, 0x7e, 0x2a, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -674,6 +771,8 @@ type QueryClient interface { Findings(ctx context.Context, in *QueryFindingsRequest, opts ...grpc.CallOption) (*QueryFindingsResponse, error) // Finding queries Finding information based on programID, FindingId. Finding(ctx context.Context, in *QueryFindingRequest, opts ...grpc.CallOption) (*QueryFindingResponse, error) + // FindingFingerprint queries Finding Fingerprint based on FindingId. + FindingFingerprint(ctx context.Context, in *QueryFindingFingerprintRequest, opts ...grpc.CallOption) (*QueryFindingFingerprintResponse, error) } type queryClient struct { @@ -738,6 +837,15 @@ func (c *queryClient) Finding(ctx context.Context, in *QueryFindingRequest, opts return out, nil } +func (c *queryClient) FindingFingerprint(ctx context.Context, in *QueryFindingFingerprintRequest, opts ...grpc.CallOption) (*QueryFindingFingerprintResponse, error) { + out := new(QueryFindingFingerprintResponse) + err := c.cc.Invoke(ctx, "/shentu.bounty.v1.Query/FindingFingerprint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Hosts queries all hosts that match the given status. @@ -752,6 +860,8 @@ type QueryServer interface { Findings(context.Context, *QueryFindingsRequest) (*QueryFindingsResponse, error) // Finding queries Finding information based on programID, FindingId. Finding(context.Context, *QueryFindingRequest) (*QueryFindingResponse, error) + // FindingFingerprint queries Finding Fingerprint based on FindingId. + FindingFingerprint(context.Context, *QueryFindingFingerprintRequest) (*QueryFindingFingerprintResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -776,6 +886,9 @@ func (*UnimplementedQueryServer) Findings(ctx context.Context, req *QueryFinding func (*UnimplementedQueryServer) Finding(ctx context.Context, req *QueryFindingRequest) (*QueryFindingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Finding not implemented") } +func (*UnimplementedQueryServer) FindingFingerprint(ctx context.Context, req *QueryFindingFingerprintRequest) (*QueryFindingFingerprintResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindingFingerprint not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -889,6 +1002,24 @@ func _Query_Finding_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Query_FindingFingerprint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFindingFingerprintRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).FindingFingerprint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/shentu.bounty.v1.Query/FindingFingerprint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).FindingFingerprint(ctx, req.(*QueryFindingFingerprintRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "shentu.bounty.v1.Query", HandlerType: (*QueryServer)(nil), @@ -917,6 +1048,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Finding", Handler: _Query_Finding_Handler, }, + { + MethodName: "FindingFingerprint", + Handler: _Query_FindingFingerprint_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "shentu/bounty/v1/query.proto", @@ -1329,6 +1464,66 @@ func (m *QueryFindingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryFindingFingerprintRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFindingFingerprintRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFindingFingerprintRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FindingId) > 0 { + i -= len(m.FindingId) + copy(dAtA[i:], m.FindingId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FindingId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFindingFingerprintResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryFindingFingerprintResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFindingFingerprintResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fingerprint) > 0 { + i -= len(m.Fingerprint) + copy(dAtA[i:], m.Fingerprint) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Fingerprint))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1500,6 +1695,32 @@ func (m *QueryFindingResponse) Size() (n int) { return n } +func (m *QueryFindingFingerprintRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FindingId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFindingFingerprintResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Fingerprint) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2544,6 +2765,170 @@ func (m *QueryFindingResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryFindingFingerprintRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFindingFingerprintRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFindingFingerprintRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FindingId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FindingId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFindingFingerprintResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryFindingFingerprintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFindingFingerprintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fingerprint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fingerprint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/bounty/types/query.pb.gw.go b/x/bounty/types/query.pb.gw.go index 564e43c8e..293afed43 100644 --- a/x/bounty/types/query.pb.gw.go +++ b/x/bounty/types/query.pb.gw.go @@ -285,6 +285,60 @@ func local_request_Query_Finding_0(ctx context.Context, marshaler runtime.Marsha } +func request_Query_FindingFingerprint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFindingFingerprintRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["finding_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "finding_id") + } + + protoReq.FindingId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "finding_id", err) + } + + msg, err := client.FindingFingerprint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_FindingFingerprint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFindingFingerprintRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["finding_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "finding_id") + } + + protoReq.FindingId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "finding_id", err) + } + + msg, err := server.FindingFingerprint(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -429,6 +483,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_FindingFingerprint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_FindingFingerprint_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_FindingFingerprint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -590,6 +667,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_FindingFingerprint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_FindingFingerprint_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_FindingFingerprint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -605,6 +702,8 @@ var ( pattern_Query_Findings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"shentu", "bounty", "v1", "findings"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Finding_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"shentu", "bounty", "v1", "findings", "finding_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_FindingFingerprint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"shentu", "bounty", "v1", "findings", "finding_id", "fingerprint"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -619,4 +718,6 @@ var ( forward_Query_Findings_0 = runtime.ForwardResponseMessage forward_Query_Finding_0 = runtime.ForwardResponseMessage + + forward_Query_FindingFingerprint_0 = runtime.ForwardResponseMessage ) diff --git a/x/bounty/types/tx.pb.go b/x/bounty/types/tx.pb.go index 12b8d6069..aaafa4b31 100644 --- a/x/bounty/types/tx.pb.go +++ b/x/bounty/types/tx.pb.go @@ -504,7 +504,7 @@ var xxx_messageInfo_MsgEditFindingResponse proto.InternalMessageInfo type MsgConfirmFinding struct { FindingId string `protobuf:"bytes,1,opt,name=finding_id,json=findingId,proto3" json:"finding_id,omitempty" yaml:"finding_id"` OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` - FingerPrint string `protobuf:"bytes,3,opt,name=finger_print,json=fingerPrint,proto3" json:"finger_print,omitempty" yaml:"finger_print"` + Fingerprint string `protobuf:"bytes,3,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"` } func (m *MsgConfirmFinding) Reset() { *m = MsgConfirmFinding{} } @@ -577,6 +577,82 @@ func (m *MsgConfirmFindingResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConfirmFindingResponse proto.InternalMessageInfo +// MsgConfirmFindingPaid defines a message to close a finding to an existing finding. +type MsgConfirmFindingPaid struct { + FindingId string `protobuf:"bytes,1,opt,name=finding_id,json=findingId,proto3" json:"finding_id,omitempty" yaml:"finding_id"` + OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` +} + +func (m *MsgConfirmFindingPaid) Reset() { *m = MsgConfirmFindingPaid{} } +func (m *MsgConfirmFindingPaid) String() string { return proto.CompactTextString(m) } +func (*MsgConfirmFindingPaid) ProtoMessage() {} +func (*MsgConfirmFindingPaid) Descriptor() ([]byte, []int) { + return fileDescriptor_1e4b4296bac3db30, []int{14} +} +func (m *MsgConfirmFindingPaid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConfirmFindingPaid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConfirmFindingPaid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgConfirmFindingPaid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConfirmFindingPaid.Merge(m, src) +} +func (m *MsgConfirmFindingPaid) XXX_Size() int { + return m.Size() +} +func (m *MsgConfirmFindingPaid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConfirmFindingPaid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConfirmFindingPaid proto.InternalMessageInfo + +// MsgCloseFindingResponse defines the Msg/CloseFinding response type. +type MsgConfirmFindingPaidResponse struct { +} + +func (m *MsgConfirmFindingPaidResponse) Reset() { *m = MsgConfirmFindingPaidResponse{} } +func (m *MsgConfirmFindingPaidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgConfirmFindingPaidResponse) ProtoMessage() {} +func (*MsgConfirmFindingPaidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1e4b4296bac3db30, []int{15} +} +func (m *MsgConfirmFindingPaidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConfirmFindingPaidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConfirmFindingPaidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgConfirmFindingPaidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConfirmFindingPaidResponse.Merge(m, src) +} +func (m *MsgConfirmFindingPaidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgConfirmFindingPaidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConfirmFindingPaidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConfirmFindingPaidResponse proto.InternalMessageInfo + // MsgCloseFinding defines a message to close a finding to an existing finding. type MsgCloseFinding struct { FindingId string `protobuf:"bytes,1,opt,name=finding_id,json=findingId,proto3" json:"finding_id,omitempty" yaml:"finding_id"` @@ -587,7 +663,7 @@ func (m *MsgCloseFinding) Reset() { *m = MsgCloseFinding{} } func (m *MsgCloseFinding) String() string { return proto.CompactTextString(m) } func (*MsgCloseFinding) ProtoMessage() {} func (*MsgCloseFinding) Descriptor() ([]byte, []int) { - return fileDescriptor_1e4b4296bac3db30, []int{14} + return fileDescriptor_1e4b4296bac3db30, []int{16} } func (m *MsgCloseFinding) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -624,7 +700,7 @@ func (m *MsgCloseFindingResponse) Reset() { *m = MsgCloseFindingResponse func (m *MsgCloseFindingResponse) String() string { return proto.CompactTextString(m) } func (*MsgCloseFindingResponse) ProtoMessage() {} func (*MsgCloseFindingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e4b4296bac3db30, []int{15} + return fileDescriptor_1e4b4296bac3db30, []int{17} } func (m *MsgCloseFindingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -665,7 +741,7 @@ func (m *MsgReleaseFinding) Reset() { *m = MsgReleaseFinding{} } func (m *MsgReleaseFinding) String() string { return proto.CompactTextString(m) } func (*MsgReleaseFinding) ProtoMessage() {} func (*MsgReleaseFinding) Descriptor() ([]byte, []int) { - return fileDescriptor_1e4b4296bac3db30, []int{16} + return fileDescriptor_1e4b4296bac3db30, []int{18} } func (m *MsgReleaseFinding) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -730,7 +806,7 @@ func (m *MsgReleaseFindingResponse) Reset() { *m = MsgReleaseFindingResp func (m *MsgReleaseFindingResponse) String() string { return proto.CompactTextString(m) } func (*MsgReleaseFindingResponse) ProtoMessage() {} func (*MsgReleaseFindingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e4b4296bac3db30, []int{17} + return fileDescriptor_1e4b4296bac3db30, []int{19} } func (m *MsgReleaseFindingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -774,6 +850,8 @@ func init() { proto.RegisterType((*MsgEditFindingResponse)(nil), "shentu.bounty.v1.MsgEditFindingResponse") proto.RegisterType((*MsgConfirmFinding)(nil), "shentu.bounty.v1.MsgConfirmFinding") proto.RegisterType((*MsgConfirmFindingResponse)(nil), "shentu.bounty.v1.MsgConfirmFindingResponse") + proto.RegisterType((*MsgConfirmFindingPaid)(nil), "shentu.bounty.v1.MsgConfirmFindingPaid") + proto.RegisterType((*MsgConfirmFindingPaidResponse)(nil), "shentu.bounty.v1.MsgConfirmFindingPaidResponse") proto.RegisterType((*MsgCloseFinding)(nil), "shentu.bounty.v1.MsgCloseFinding") proto.RegisterType((*MsgCloseFindingResponse)(nil), "shentu.bounty.v1.MsgCloseFindingResponse") proto.RegisterType((*MsgReleaseFinding)(nil), "shentu.bounty.v1.MsgReleaseFinding") @@ -783,67 +861,68 @@ func init() { func init() { proto.RegisterFile("shentu/bounty/v1/tx.proto", fileDescriptor_1e4b4296bac3db30) } var fileDescriptor_1e4b4296bac3db30 = []byte{ - // 945 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x31, 0x6f, 0xdb, 0x46, - 0x14, 0x16, 0x25, 0xc5, 0xad, 0x9f, 0x6d, 0x59, 0x66, 0x1d, 0x9b, 0x62, 0x1c, 0xd1, 0x65, 0x3b, - 0x28, 0x6d, 0x21, 0x42, 0x6e, 0x86, 0xc2, 0x5b, 0x1c, 0x24, 0xa8, 0xd1, 0x1a, 0x0d, 0x98, 0xa9, - 0x45, 0x01, 0x96, 0x14, 0x4f, 0x14, 0x01, 0x91, 0x47, 0xf0, 0x4e, 0x42, 0xfc, 0x0f, 0x3a, 0x76, - 0x6c, 0x81, 0xa2, 0xf0, 0x54, 0xf4, 0xa7, 0x64, 0xcc, 0xd6, 0x4e, 0x42, 0x61, 0x2f, 0x99, 0xf5, - 0x0b, 0x0a, 0xf2, 0x48, 0x9a, 0x3c, 0xd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0xe5, - 0xa7, 0x28, 0x25, 0x20, 0x75, 0x7f, 0x35, 0x01, 0xa9, 0xf3, 0xde, 0x32, 0x44, 0xe6, 0xda, 0x82, - 0x16, 0x37, 0x26, 0x3f, 0xa9, 0x4e, 0xbc, 0x00, 0x92, 0x3f, 0xbf, 0x06, 0xa8, 0x54, 0xfd, 0xf4, - 0x84, 0x77, 0x54, 0x3f, 0xf5, 0xff, 0x68, 0x29, 0x24, 0x9f, 0x01, 0x37, 0x3a, 0xaa, 0x33, 0x28, - 0x82, 0xae, 0xc8, 0xa0, 0xba, 0xd5, 0x8e, 0xbe, 0x79, 0x7d, 0xde, 0x15, 0xde, 0x9c, 0x77, 0x85, - 0x7f, 0xcf, 0xbb, 0xc2, 0x2f, 0x17, 0xdd, 0xda, 0x9b, 0x8b, 0x6e, 0xed, 0x9f, 0x8b, 0x6e, 0xed, - 0x87, 0x81, 0xe3, 0xd2, 0xf1, 0xd4, 0xea, 0x0f, 0xb1, 0xa7, 0x31, 0x87, 0x23, 0x3c, 0xf5, 0x6d, - 0x33, 0x9a, 0x29, 0xc9, 0x86, 0xf6, 0x2a, 0xfd, 0x3f, 0xa4, 0xa7, 0x01, 0x22, 0xd6, 0x4a, 0xfc, - 0x73, 0xf8, 0xe5, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x0c, 0xb9, 0xa7, 0xf7, 0x0e, 0x00, - 0x00, + // 976 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0x93, 0x6c, 0x97, 0xbe, 0xb6, 0x69, 0x3a, 0xf4, 0x8f, 0xe3, 0x6d, 0xe3, 0x60, 0x90, + 0xc8, 0x02, 0x8a, 0x95, 0xb2, 0x07, 0xd4, 0xdb, 0x76, 0xb5, 0x2b, 0x2a, 0xa8, 0x58, 0x79, 0x4f, + 0x20, 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ff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xa2, 0xcb, 0xa3, 0x10, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -872,6 +951,8 @@ type MsgClient interface { EditFinding(ctx context.Context, in *MsgEditFinding, opts ...grpc.CallOption) (*MsgEditFindingResponse, error) // ConfirmFinding defines a method for host confirm a finding. ConfirmFinding(ctx context.Context, in *MsgConfirmFinding, opts ...grpc.CallOption) (*MsgConfirmFindingResponse, error) + // ConfirmFindingPaid defines a method for submitter confirm a finding paid + ConfirmFindingPaid(ctx context.Context, in *MsgConfirmFindingPaid, opts ...grpc.CallOption) (*MsgConfirmFindingPaidResponse, error) // CloseFinding defines a method for submitter or certifier close a finding CloseFinding(ctx context.Context, in *MsgCloseFinding, opts ...grpc.CallOption) (*MsgCloseFindingResponse, error) // MsgReleaseFinding defines a method for release a finding. @@ -949,6 +1030,15 @@ func (c *msgClient) ConfirmFinding(ctx context.Context, in *MsgConfirmFinding, o return out, nil } +func (c *msgClient) ConfirmFindingPaid(ctx context.Context, in *MsgConfirmFindingPaid, opts ...grpc.CallOption) (*MsgConfirmFindingPaidResponse, error) { + out := new(MsgConfirmFindingPaidResponse) + err := c.cc.Invoke(ctx, "/shentu.bounty.v1.Msg/ConfirmFindingPaid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) CloseFinding(ctx context.Context, in *MsgCloseFinding, opts ...grpc.CallOption) (*MsgCloseFindingResponse, error) { out := new(MsgCloseFindingResponse) err := c.cc.Invoke(ctx, "/shentu.bounty.v1.Msg/CloseFinding", in, out, opts...) @@ -983,6 +1073,8 @@ type MsgServer interface { EditFinding(context.Context, *MsgEditFinding) (*MsgEditFindingResponse, error) // ConfirmFinding defines a method for host confirm a finding. ConfirmFinding(context.Context, *MsgConfirmFinding) (*MsgConfirmFindingResponse, error) + // ConfirmFindingPaid defines a method for submitter confirm a finding paid + ConfirmFindingPaid(context.Context, *MsgConfirmFindingPaid) (*MsgConfirmFindingPaidResponse, error) // CloseFinding defines a method for submitter or certifier close a finding CloseFinding(context.Context, *MsgCloseFinding) (*MsgCloseFindingResponse, error) // MsgReleaseFinding defines a method for release a finding. @@ -1014,6 +1106,9 @@ func (*UnimplementedMsgServer) EditFinding(ctx context.Context, req *MsgEditFind func (*UnimplementedMsgServer) ConfirmFinding(ctx context.Context, req *MsgConfirmFinding) (*MsgConfirmFindingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ConfirmFinding not implemented") } +func (*UnimplementedMsgServer) ConfirmFindingPaid(ctx context.Context, req *MsgConfirmFindingPaid) (*MsgConfirmFindingPaidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmFindingPaid not implemented") +} func (*UnimplementedMsgServer) CloseFinding(ctx context.Context, req *MsgCloseFinding) (*MsgCloseFindingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CloseFinding not implemented") } @@ -1151,6 +1246,24 @@ func _Msg_ConfirmFinding_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_ConfirmFindingPaid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgConfirmFindingPaid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ConfirmFindingPaid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/shentu.bounty.v1.Msg/ConfirmFindingPaid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ConfirmFindingPaid(ctx, req.(*MsgConfirmFindingPaid)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_CloseFinding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgCloseFinding) if err := dec(in); err != nil { @@ -1219,6 +1332,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ConfirmFinding", Handler: _Msg_ConfirmFinding_Handler, }, + { + MethodName: "ConfirmFindingPaid", + Handler: _Msg_ConfirmFindingPaid_Handler, + }, { MethodName: "CloseFinding", Handler: _Msg_CloseFinding_Handler, @@ -1734,10 +1851,10 @@ func (m *MsgConfirmFinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FingerPrint) > 0 { - i -= len(m.FingerPrint) - copy(dAtA[i:], m.FingerPrint) - i = encodeVarintTx(dAtA, i, uint64(len(m.FingerPrint))) + if len(m.Fingerprint) > 0 { + i -= len(m.Fingerprint) + copy(dAtA[i:], m.Fingerprint) + i = encodeVarintTx(dAtA, i, uint64(len(m.Fingerprint))) i-- dAtA[i] = 0x1a } @@ -1781,6 +1898,66 @@ func (m *MsgConfirmFindingResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgConfirmFindingPaid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgConfirmFindingPaid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConfirmFindingPaid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FindingId) > 0 { + i -= len(m.FindingId) + copy(dAtA[i:], m.FindingId) + i = encodeVarintTx(dAtA, i, uint64(len(m.FindingId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgConfirmFindingPaidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgConfirmFindingPaidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConfirmFindingPaidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgCloseFinding) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2162,7 +2339,7 @@ func (m *MsgConfirmFinding) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.FingerPrint) + l = len(m.Fingerprint) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2178,6 +2355,32 @@ func (m *MsgConfirmFindingResponse) Size() (n int) { return n } +func (m *MsgConfirmFindingPaid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FindingId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgConfirmFindingPaidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgCloseFinding) Size() (n int) { if m == nil { return 0 @@ -3813,7 +4016,7 @@ func (m *MsgConfirmFinding) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FingerPrint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fingerprint", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3841,7 +4044,7 @@ func (m *MsgConfirmFinding) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FingerPrint = string(dAtA[iNdEx:postIndex]) + m.Fingerprint = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3914,6 +4117,170 @@ func (m *MsgConfirmFindingResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgConfirmFindingPaid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConfirmFindingPaid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConfirmFindingPaid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FindingId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FindingId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgConfirmFindingPaidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgConfirmFindingPaidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConfirmFindingPaidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgCloseFinding) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0