Skip to content

Commit

Permalink
Add bounty admin
Browse files Browse the repository at this point in the history
  • Loading branch information
skyargos committed Nov 10, 2023
1 parent 9e94af0 commit 7446fad
Show file tree
Hide file tree
Showing 17 changed files with 1,120 additions and 1,325 deletions.
23 changes: 12 additions & 11 deletions proto/shentu/bounty/v1/bounty.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ message Program {
string program_id = 1 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""];
string name = 2 [(gogoproto.moretags) = "yaml:\"name\""];
// JSON by ProgramDetail
string description = 3 [(gogoproto.moretags) = "yaml:\"description\""];
string detail = 3 [(gogoproto.moretags) = "yaml:\"detail\""];
string admin_address = 4 [(gogoproto.moretags) = "yaml:\"admin_address\""];
repeated string member_accounts = 5 [(gogoproto.moretags) = "yaml:\"member_accounts\""];
ProgramStatus status = 6 [(gogoproto.moretags) = "yaml:\"status\""];
repeated BountyLevel bounty_levels = 7 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
ProgramStatus status = 5 [(gogoproto.moretags) = "yaml:\"status\""];
repeated BountyLevel bounty_levels = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
}

message Finding {
Expand All @@ -30,14 +29,16 @@ message Finding {
string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string finding_id = 2 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""];
string title = 3;
// JSON by FindingDetail
string description = 4 [(gogoproto.moretags) = "yaml:\"description\""];
// hash(desc + pos + submitter)
string finding_hash = 5 [(gogoproto.moretags) = "yaml:\"finding_hash\""];
string submitter_address = 6 [(gogoproto.moretags) = "yaml:\"submitter_address\""];
SeverityLevel severity_level = 7 [(gogoproto.moretags) = "yaml:\"severity_level\""];
FindingStatus status = 8 [(gogoproto.moretags) = "yaml:\"status\""];
google.protobuf.Timestamp create_time = 9
string proof_of_concept = 5 [(gogoproto.moretags) = "yaml:\"proof_of_concept\""];
// hash(desc + poc + submitter)
string finding_hash = 6 [(gogoproto.moretags) = "yaml:\"finding_hash\""];
string submitter_address = 7 [(gogoproto.moretags) = "yaml:\"submitter_address\""];
SeverityLevel severity_level = 8 [(gogoproto.moretags) = "yaml:\"severity_level\""];
FindingStatus status = 9 [(gogoproto.moretags) = "yaml:\"status\""];
// JSON by FindingDetail
string detail = 10 [(gogoproto.moretags) = "yaml:\"detail\""];
google.protobuf.Timestamp create_time = 11
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"create_time\""];
}

Expand Down
73 changes: 29 additions & 44 deletions proto/shentu/bounty/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ service Msg {
// EditProgram defines a method for modifying a program.
rpc EditProgram(MsgEditProgram) returns (MsgEditProgramResponse);

// Open a program status by program_id
rpc OpenProgram(MsgOpenProgram) returns (MsgOpenProgramResponse);
// Activate a program status by program_id
rpc ActivateProgram(MsgActivateProgram) returns (MsgActivateProgramResponse);

// Closed a program status by program_id
rpc CloseProgram(MsgCloseProgram) returns (MsgCloseProgramResponse);
Expand All @@ -31,11 +31,8 @@ service Msg {
// EditFinding defines a method for editing a new finding.
rpc EditFinding(MsgEditFinding) returns (MsgEditFindingResponse);

// AcceptFinding defines a method for host accept a finding.
rpc AcceptFinding(MsgAcceptFinding) returns (MsgAcceptFindingResponse);

// RejectFinding defines a method for host reject a finding.
rpc RejectFinding(MsgRejectFinding) returns (MsgRejectFindingResponse);
// ConfirmFinding defines a method for host confirm a finding.
rpc ConfirmFinding(MsgConfirmFinding) returns (MsgConfirmFindingResponse);

// CloseFinding defines a method for submitter or certifier close a finding
rpc CloseFinding(MsgCloseFinding) returns (MsgCloseFindingResponse);
Expand All @@ -49,25 +46,23 @@ message MsgCreateProgram {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string name = 1;
string description = 2;
string operator_address = 3 [(gogoproto.moretags) = "yaml:\"operator_address\""];
repeated string member_accounts = 4 [(gogoproto.moretags) = "yaml:\"member_accounts\""];
string program_id = 5 [(gogoproto.moretags) = "yaml:\"program_id\""];
repeated BountyLevel bounty_levels = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string name = 2;
string detail = 3;
repeated BountyLevel bounty_levels = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
string operator_address = 5 [(gogoproto.moretags) = "yaml:\"operator_address\""];
}

// MsgEditProgram defines a SDK message for editing a program.
message MsgEditProgram {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string name = 1;
string description = 2;
string operator_address = 3 [(gogoproto.moretags) = "yaml:\"operator_address\""];
repeated string member_accounts = 4 [(gogoproto.moretags) = "yaml:\"member_accounts\""];
string program_id = 5 [(gogoproto.moretags) = "yaml:\"program_id\""];
repeated BountyLevel bounty_levels = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string name = 2;
string detail = 3;
repeated BountyLevel bounty_levels = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"bounty_levels\""];
string operator_address = 5 [(gogoproto.moretags) = "yaml:\"operator_address\""];
}

// MsgCreateProgramResponse defines the Msg/CreateProgram response type.
Expand All @@ -77,15 +72,15 @@ message MsgCreateProgramResponse {
// MsgModifyProgramResponse defines the Msg/ModifyProgram response type.
message MsgEditProgramResponse {}

message MsgOpenProgram {
message MsgActivateProgram {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string operator_address = 2 [(gogoproto.moretags) = "yaml:\"operator_address\""];
}

message MsgOpenProgramResponse {}
message MsgActivateProgramResponse {}

message MsgCloseProgram {
option (gogoproto.equal) = false;
Expand All @@ -105,10 +100,10 @@ message MsgSubmitFinding {
string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string finding_id = 2 [(gogoproto.moretags) = "yaml:\"finding_id\""];
string title = 3;
string description = 4;
string finding_hash = 5 [(gogoproto.moretags) = "yaml:\"finding_hash\""];
string submitter_address = 6 [(gogoproto.moretags) = "yaml:\"submitter_address\""];
SeverityLevel severity_level = 7 [(gogoproto.moretags) = "yaml:\"severity_level\""];
string finding_hash = 4 [(gogoproto.moretags) = "yaml:\"finding_hash\""];
string submitter_address = 5 [(gogoproto.moretags) = "yaml:\"submitter_address\""];
SeverityLevel severity_level = 6 [(gogoproto.moretags) = "yaml:\"severity_level\""];
string detail = 7;
}

// MsgSubmitFindingResponse defines the MsgSubmitFinding response type.
Expand All @@ -122,16 +117,17 @@ message MsgEditFinding {
string program_id = 1 [(gogoproto.moretags) = "yaml:\"program_id\""];
string finding_id = 2 [(gogoproto.moretags) = "yaml:\"finding_id\""];
string title = 3;
string description = 4;
string finding_hash = 4 [(gogoproto.moretags) = "yaml:\"finding_hash\""];
string submitter_address = 5 [(gogoproto.moretags) = "yaml:\"submitter_address\""];
SeverityLevel severity_level = 6 [(gogoproto.moretags) = "yaml:\"severity_level\""];
string detail = 7;
}

// MsgEditFindingResponse defines the MsgEditFinding response type.
message MsgEditFindingResponse {}

// MsgAcceptFinding defines a message to accept a finding to an existing finding.
message MsgAcceptFinding {
// MsgConfirmFinding defines a message to accept a finding to an existing finding.
message MsgConfirmFinding {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -140,20 +136,8 @@ message MsgAcceptFinding {
FindingStatus status = 3 [(gogoproto.moretags) = "yaml:\"status\""];
}

// MsgAcceptFindingResponse defines the Msg/AcceptFinding response type.
message MsgAcceptFindingResponse {}

// MsgRejectFinding defines a message to reject a finding to an existing finding.
message MsgRejectFinding {
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\""];
}

// MsgRejectFindingResponse defines the Msg/RejectFinding response type.
message MsgRejectFindingResponse {}
// MsgConfirmFindingResponse defines the Msg/AcceptFinding response type.
message MsgConfirmFindingResponse {}

// MsgCloseFinding defines a message to close a finding to an existing finding.
message MsgCloseFinding {
Expand All @@ -172,8 +156,9 @@ message MsgReleaseFinding {
option (gogoproto.equal) = false;

string finding_id = 1 [(gogoproto.moretags) = "yaml:\"finding_id\""];
string description = 2;
string operator_address = 3 [(gogoproto.moretags) = "yaml:\"operator_address\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
string proof_of_concept = 3 [(gogoproto.moretags) = "yaml:\"proof_of_concept\""];
string operator_address = 4 [(gogoproto.moretags) = "yaml:\"operator_address\""];
}

// MsgReleaseFindingResponse defines the MsgReleaseFinding response type.
Expand Down
7 changes: 7 additions & 0 deletions proto/shentu/cert/v1alpha1/cert.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum CertificateType {
CERT_TYPE_SHIELD_POOL_CREATOR = 5 [(gogoproto.enumvalue_customname) = "CertificateTypeShieldPoolCreator"];
CERT_TYPE_IDENTITY = 6 [(gogoproto.enumvalue_customname) = "CertificateTypeIdentity"];
CERT_TYPE_GENERAL = 7 [(gogoproto.enumvalue_customname) = "CertificateTypeGeneral"];
CERT_TYPE_BOUNTY_ADMIN = 8 [(gogoproto.enumvalue_customname) = "CertificateTypeBountyAdmin"];
}

message CompilationContent {
Expand Down Expand Up @@ -101,6 +102,12 @@ message General {
string content = 1;
}

message BountyAdmin {
option (cosmos_proto.implements_interface) = "Content";

string content = 1;
}

// Platform is a genesis type for certified platform of a validator
message Platform {
option (gogoproto.equal) = false;
Expand Down
9 changes: 6 additions & 3 deletions x/bounty/client/cli/flags.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package cli

const (
FlagProgramID = "program-id"
FlagFindingID = "finding-id"

FlagName = "name"
FlagMembers = "members"
FlagDesc = "desc"

FlagFindingTitle = "title"
FlagFindingSeverityLevel = "severity-level"
FlagFindingDescription = "description"
FlagFindingPoc = "poc"
FlagFindingAddress = "finding-address"
FlagSubmitterAddress = "submitter-address"

FlagProgramID = "program-id"
FlagFindingID = "finding-id"
FlagDetail = "detail"
)
Loading

0 comments on commit 7446fad

Please sign in to comment.