diff --git a/e2e/core/basesuite.go b/e2e/core/basesuite.go index 3af71979a..b9ffa6a09 100644 --- a/e2e/core/basesuite.go +++ b/e2e/core/basesuite.go @@ -85,6 +85,7 @@ func (s *BaseSuite) SendTxBlockWithExpectErrorString(msg sdk.Msg, from keys.KeyM } s.Client.SetKeyManager(from) _, err := s.Client.BroadcastTx([]sdk.Msg{msg}, txOpt) + s.T().Logf("tx failed, err: %s, expect error string: %s", err, expectErrorString) s.Require().Error(err) s.Require().True(strings.Contains(err.Error(), expectErrorString)) } diff --git a/e2e/tests/permission_test.go b/e2e/tests/permission_test.go index ce0d77d33..a63ffd7aa 100644 --- a/e2e/tests/permission_test.go +++ b/e2e/tests/permission_test.go @@ -7,7 +7,6 @@ import ( "math" "time" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/bnb-chain/greenfield/e2e/core" @@ -632,9 +631,7 @@ func (s *StorageTestSuite) TestGrantsPermissionToGroup() { headGroupMemberRequest := storagetypes.QueryHeadGroupMemberRequest{Member: user[1].GetAddr().String(), GroupOwner: user[0].GetAddr().String(), GroupName: testGroupName} headGroupMemberResponse, err := s.Client.HeadGroupMember(ctx, &headGroupMemberRequest) s.Require().NoError(err) - resGroupId, err := sdkmath.ParseUint(headGroupMemberResponse.GroupId) - s.Require().NoError(err) - s.Require().Equal(resGroupId, headGroupResponse.GetGroupInfo().Id) + s.Require().Equal(headGroupMemberResponse.GroupMember.GroupId, headGroupResponse.GetGroupInfo().Id) // Put bucket policy statement := &types.Statement{ diff --git a/e2e/tests/storage_test.go b/e2e/tests/storage_test.go index 8d4043020..57038251d 100644 --- a/e2e/tests/storage_test.go +++ b/e2e/tests/storage_test.go @@ -215,13 +215,13 @@ func (s *StorageTestSuite) TestCreateGroup() { } queryHeadGroupMemberResp, err := s.Client.HeadGroupMember(ctx, &queryHeadGroupMemberReq) s.Require().NoError(err) - s.Require().Equal(queryHeadGroupMemberResp.GroupId, queryHeadGroupResp.GroupInfo.Id.String()) + s.Require().Equal(queryHeadGroupMemberResp.GroupMember.GroupId, queryHeadGroupResp.GroupInfo.Id) // 4. UpdateGroupMember member2 := s.GenAndChargeAccounts(1, 1000000)[0] membersToAdd := []sdk.AccAddress{member2.GetAddr()} membersToDelete := []sdk.AccAddress{member.GetAddr()} - msgUpdateGroupMember := storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), groupName, membersToAdd, membersToDelete) + msgUpdateGroupMember := storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), owner.GetAddr(), groupName, membersToAdd, membersToDelete) s.SendTxBlock(msgUpdateGroupMember, owner) // 5. HeadGroupMember (delete) @@ -240,7 +240,11 @@ func (s *StorageTestSuite) TestCreateGroup() { } queryHeadGroupMemberRespAdd, err := s.Client.HeadGroupMember(ctx, &queryHeadGroupMemberReqAdd) s.Require().NoError(err) - s.Require().Equal(queryHeadGroupMemberRespAdd.GroupId, queryHeadGroupResp.GroupInfo.Id.String()) + s.Require().Equal(queryHeadGroupMemberRespAdd.GroupMember.GroupId, queryHeadGroupResp.GroupInfo.Id) + + // 6. Create a group with the same name + msgCreateGroup = storagetypes.NewMsgCreateGroup(owner.GetAddr(), groupName, []sdk.AccAddress{member.GetAddr()}) + s.SendTxBlockWithExpectErrorString(msgCreateGroup, owner, "exists") } func (s *StorageTestSuite) TestDeleteBucket() { diff --git a/proto/greenfield/permission/common.proto b/proto/greenfield/permission/common.proto index b612336f2..cc4fb5348 100644 --- a/proto/greenfield/permission/common.proto +++ b/proto/greenfield/permission/common.proto @@ -12,19 +12,19 @@ option go_package = "github.com/bnb-chain/greenfield/x/permission/types"; enum ActionType { option (gogoproto.goproto_enum_prefix) = false; - ACTION_UPDATE_BUCKET_INFO = 0; - ACTION_DELETE_BUCKET = 1; + ACTION_UNSPECIFIED = 0; + ACTION_UPDATE_BUCKET_INFO = 1; + ACTION_DELETE_BUCKET = 2; - ACTION_CREATE_OBJECT = 2; - ACTION_DELETE_OBJECT = 3; - ACTION_COPY_OBJECT = 4; - ACTION_GET_OBJECT = 5; - ACTION_EXECUTE_OBJECT = 6; - ACTION_LIST_OBJECT = 7; + ACTION_CREATE_OBJECT = 3; + ACTION_DELETE_OBJECT = 4; + ACTION_COPY_OBJECT = 5; + ACTION_GET_OBJECT = 6; + ACTION_EXECUTE_OBJECT = 7; + ACTION_LIST_OBJECT = 8; - ACTION_UPDATE_GROUP_MEMBER = 8; - ACTION_DELETE_GROUP = 9; - ACTION_GROUP_MEMBER = 10; + ACTION_UPDATE_GROUP_MEMBER = 9; + ACTION_DELETE_GROUP = 10; ACTION_TYPE_ALL = 99; } @@ -33,10 +33,9 @@ enum ActionType { enum Effect { option (gogoproto.goproto_enum_prefix) = false; - EFFECT_ALLOW = 0; - EFFECT_DENY = 1; - // Use internally, means skipped. there is no explicit ALLOW or DENY, and further permission checks are required. - EFFECT_PASS = 2; + EFFECT_UNSPECIFIED = 0; + EFFECT_ALLOW = 1; + EFFECT_DENY = 2; } message Statement { @@ -50,24 +49,28 @@ message Statement { // However, if the sub-resource is defined as 'bucket/test_*,' in the statement, then only objects with a 'test_' // prefix can be accessed by the principal. repeated string resources = 3; - // expiration_time defines how long the permission is valid + // expiration_time defines how long the permission is valid. If not explicitly specified, it means it will not expire. google.protobuf.Timestamp expiration_time = 4 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = true ]; - // limit_size defines the total data size that is allowed to operate + // limit_size defines the total data size that is allowed to operate. If not explicitly specified, it means it will not limit. common.UInt64Value limit_size = 5 [(gogoproto.nullable) = true]; } +// PrincipalType refers to the identity type of system users or entities. +// In Greenfield, it usually refers to accounts or groups. enum PrincipalType { option (gogoproto.goproto_enum_prefix) = false; - // Reserved for extended use - TYPE_GNFD_ACCOUNT = 0; - TYPE_GNFD_GROUP = 1; + PRINCIPAL_TYPE_UNSPECIFIED = 0; + PRINCIPAL_TYPE_GNFD_ACCOUNT = 1; + PRINCIPAL_TYPE_GNFD_GROUP = 2; } // Principal define the roles that can grant permissions. Currently, it can be account or group. message Principal { PrincipalType type = 1; + // When the type is an account, its value is sdk.AccAddress().String(); + // when the type is a group, its value is math.Uint().String() string value = 2; } diff --git a/proto/greenfield/permission/params.proto b/proto/greenfield/permission/params.proto index 64aef1251..9c67a2de3 100644 --- a/proto/greenfield/permission/params.proto +++ b/proto/greenfield/permission/params.proto @@ -9,6 +9,10 @@ option go_package = "github.com/bnb-chain/greenfield/x/permission/types"; message Params { option (gogoproto.goproto_stringer) = false; + // maximum_statements_num defines the maximum number of statements allowed in a policy uint64 maximum_statements_num = 1; + // maximum_group_num used to set the upper limit on the number of groups to which a resource can grant access permissions. + // By placing a cap on the number of group permissions, permission control policies can be made more robust and better + // enforced, thereby reducing the chances of DDos and other security incidents. uint64 maximum_group_num = 2; } diff --git a/proto/greenfield/permission/types.proto b/proto/greenfield/permission/types.proto index 9b91b2987..db60bfcf7 100644 --- a/proto/greenfield/permission/types.proto +++ b/proto/greenfield/permission/types.proto @@ -34,8 +34,6 @@ message Policy { (gogoproto.stdtime) = true, (gogoproto.nullable) = true ]; - // member_statement defines a special policy which indicates that the principal is a member of the group - permission.Statement member_statement = 7; } // PolicyGroup refers to a group of policies which grant permission to Group, which is limited to MaxGroupNum (default 10). @@ -57,3 +55,20 @@ message PolicyGroup { // items define a pair of policy_id and group_id. Each resource can only grant its own permissions to a limited number of groups repeated Item items = 1; } + +message GroupMember { + // id is an unique u256 sequence for each group member. It also be used as NFT tokenID + string id = 1 [ + (cosmos_proto.scalar) = "cosmos.Uint", + (gogoproto.customtype) = "Uint", + (gogoproto.nullable) = false + ]; + // group_id is the unique id of the group + string group_id = 2 [ + (cosmos_proto.scalar) = "cosmos.Uint", + (gogoproto.customtype) = "Uint", + (gogoproto.nullable) = false + ]; + // member is the account address of the member + string member = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} diff --git a/proto/greenfield/resource/types.proto b/proto/greenfield/resource/types.proto index fed85ca5e..32088f25e 100644 --- a/proto/greenfield/resource/types.proto +++ b/proto/greenfield/resource/types.proto @@ -9,7 +9,8 @@ option go_package = "github.com/bnb-chain/greenfield/types/resource"; enum ResourceType { option (gogoproto.goproto_enum_prefix) = false; - RESOURCE_TYPE_BUCKET = 0; - RESOURCE_TYPE_OBJECT = 1; - RESOURCE_TYPE_GROUP = 2; + RESOURCE_TYPE_UNSPECIFIED = 0; + RESOURCE_TYPE_BUCKET = 1; + RESOURCE_TYPE_OBJECT = 2; + RESOURCE_TYPE_GROUP = 3; } diff --git a/proto/greenfield/sp/types.proto b/proto/greenfield/sp/types.proto index 51ce67464..de7e521cf 100644 --- a/proto/greenfield/sp/types.proto +++ b/proto/greenfield/sp/types.proto @@ -35,8 +35,6 @@ enum Status { } // StorageProvider defines the meta info of storage provider -// TODO: add endpoint for RPC/HTTP/Websocket and p2p identity -// TODO: add more account address for different role. message StorageProvider { option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; diff --git a/proto/greenfield/storage/query.proto b/proto/greenfield/storage/query.proto index 9e5b5b9c5..32a46b03c 100644 --- a/proto/greenfield/storage/query.proto +++ b/proto/greenfield/storage/query.proto @@ -91,7 +91,7 @@ service Query { // Queries a list of ListGroup items. rpc ListGroup(QueryListGroupRequest) returns (QueryListGroupResponse) { - option (google.api.http).get = "/bnb-chain/greenfield/storage/list_group"; + option (google.api.http).get = "/greenfield/storage/list_group/{group_owner}"; } // Queries a list of HeadGroupMember items. @@ -226,7 +226,7 @@ message QueryHeadGroupMemberRequest { } message QueryHeadGroupMemberResponse { - string group_id = 1; + permission.GroupMember group_member = 1; } message QueryPolicyForGroupRequest { diff --git a/proto/greenfield/storage/tx.proto b/proto/greenfield/storage/tx.proto index d72a1b1b9..379fb6730 100644 --- a/proto/greenfield/storage/tx.proto +++ b/proto/greenfield/storage/tx.proto @@ -217,12 +217,14 @@ message MsgUpdateGroupMember { // operator is the account address of the operator who has the UpdateGroupMember permission of the group. string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // group_owner is the account address of the group owner + string group_owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // group_name is the name of the group which to be updated - string group_name = 2; + string group_name = 3; // members_to_add is a list of members account address which will be add to the group - repeated string members_to_add = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated string members_to_add = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // members_to_delete is a list of members account address which will be remove from the group - repeated string members_to_delete = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated string members_to_delete = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message MsgUpdateGroupMemberResponse {} diff --git a/swagger/static/swagger.yaml b/swagger/static/swagger.yaml index 1f6de1673..53173c572 100644 --- a/swagger/static/swagger.yaml +++ b/swagger/static/swagger.yaml @@ -62,7 +62,7 @@ paths: schema: type: object properties: - autoSettleRecord: + auto_settle_record: type: array items: type: object @@ -204,7 +204,7 @@ paths: schema: type: object properties: - autoSettleRecord: + auto_settle_record: type: object properties: timestamp: @@ -259,202 +259,6 @@ paths: type: string tags: - Query - /greenfield/payment/bnb_price: - get: - operationId: BnbPriceAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - BnbPrice: - type: array - items: - type: object - properties: - time: - type: string - format: int64 - title: time is the submit time of the price - price: - type: string - format: uint64 - description: >- - price is the price of BNB in USD. - - It is multiplied by 10^8. - - For example, if the price is 278.34 USD, the price is - 27834000000. - title: BNBPrice is the price of BNB in USD at a given time - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /greenfield/payment/bnb_price/{time}: - get: - summary: Queries a list of BnbPrice items. - operationId: BnbPrice - responses: - '200': - description: A successful response. - schema: - type: object - properties: - BnbPrice: - type: object - properties: - time: - type: string - format: int64 - title: time is the submit time of the price - price: - type: string - format: uint64 - description: >- - price is the price of BNB in USD. - - It is multiplied by 10^8. - - For example, if the price is 278.34 USD, the price is - 27834000000. - title: BNBPrice is the price of BNB in USD at a given time - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: time - in: path - required: true - type: string - format: int64 - tags: - - Query /greenfield/payment/dynamic_balance/{account}: get: summary: Queries a list of DynamicBalance items. @@ -465,9 +269,9 @@ paths: schema: type: object properties: - dynamicBalance: + dynamic_balance: type: string - streamRecord: + stream_record: type: object properties: account: @@ -484,50 +288,55 @@ paths: It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: >- The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, + usually SP(service provider) rate: type: string - title: flow rate in USD + title: flow rate title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD + OutFlow defines the accumulative outflow stream rate in + BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account title: Stream Payment Record of a stream account - currentTimestamp: + current_timestamp: type: string format: int64 default: @@ -682,7 +491,7 @@ paths: schema: type: object properties: - paymentAccount: + payment_account: type: array items: type: object @@ -816,7 +625,7 @@ paths: schema: type: object properties: - paymentAccount: + payment_account: type: object properties: addr: @@ -868,7 +677,7 @@ paths: schema: type: object properties: - paymentAccountCount: + payment_account_count: type: array items: type: object @@ -1002,7 +811,7 @@ paths: schema: type: object properties: - paymentAccountCount: + payment_account_count: type: object properties: owner: @@ -1054,7 +863,7 @@ paths: schema: type: object properties: - streamRecord: + stream_record: type: array items: type: object @@ -1074,47 +883,52 @@ paths: It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: >- The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: >- the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, + usually SP(service provider) rate: type: string - title: flow rate in USD + title: flow rate title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD + OutFlow defines the accumulative outflow stream rate + in BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account @@ -1238,7 +1052,7 @@ paths: schema: type: object properties: - streamRecord: + stream_record: type: object properties: account: @@ -1255,45 +1069,50 @@ paths: It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: >- The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, + usually SP(service provider) rate: type: string - title: flow rate in USD + title: flow rate title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD + OutFlow defines the accumulative outflow stream rate in + BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account @@ -1327,6 +1146,122 @@ paths: type: string tags: - Query + /greenfield/sp/get_secondary_sp_store_price_by_time/{timestamp}: + get: + operationId: QueryGetSecondarySpStorePriceByTime + responses: + '200': + description: A successful response. + schema: + type: object + properties: + secondary_sp_store_price: + type: object + properties: + update_time: + type: string + format: int64 + title: update time, in unix timestamp + store_price: + type: string + title: store price, in bnb wei per charge byte + title: |- + global secondary sp store price + this is the price for all secondary sps + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: timestamp + in: path + required: true + type: string + format: int64 + tags: + - Query + /greenfield/sp/get_sp_storage_price_by_time/{sp_addr}/{timestamp}: + get: + operationId: QueryGetSpStoragePriceByTime + responses: + '200': + description: A successful response. + schema: + type: object + properties: + sp_storage_price: + type: object + properties: + sp_address: + type: string + title: sp address + update_time: + type: string + format: int64 + title: update time, in unix timestamp + read_price: + type: string + title: read price, in bnb wei per charge byte + free_read_quota: + type: string + format: uint64 + title: free read quota, in byte + store_price: + type: string + title: store price, in bnb wei per charge byte + title: storage price of a specific sp + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: sp_addr + in: path + required: true + type: string + - name: timestamp + in: path + required: true + type: string + format: int64 + tags: + - Query /greenfield/sp/params: get: summary: Parameters queries the parameters of the module. @@ -1341,10 +1276,6 @@ paths: description: params holds all the parameters of this module. type: object properties: - max_storage_providers: - type: integer - format: int64 - description: max_storage_providers is the maximum number of validators. deposit_denom: type: string description: deposit_denom defines the staking coin denomination. @@ -1687,6 +1618,402 @@ paths: type: boolean tags: - Query + /bnb-chain/greenfield/storage/head_group_member: + get: + summary: Queries a list of HeadGroupMember items. + operationId: HeadGroupMember + responses: + '200': + description: A successful response. + schema: + type: object + properties: + group_member: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each group member. It + also be used as NFT tokenID + group_id: + type: string + title: group_id is the unique id of the group + member: + type: string + title: member is the account address of the member + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: member + in: query + required: false + type: string + - name: group_owner + in: query + required: false + type: string + - name: group_name + in: query + required: false + type: string + tags: + - Query + /bnb-chain/greenfield/storage/list_group/{group_owner}: + get: + summary: Queries a list of ListGroup items. + operationId: ListGroup + responses: + '200': + description: A successful response. + schema: + type: object + properties: + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + group_infos: + type: array + items: + type: object + properties: + owner: + type: string + description: >- + owner is the owner of the group. It can not changed once + it created. + group_name: + type: string + description: >- + group_name is the name of group which is unique under an + account. + source_type: + title: source_type + type: string + enum: + - SOURCE_TYPE_ORIGIN + - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING + default: SOURCE_TYPE_ORIGIN + id: + type: string + title: id is the unique identifier of group + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: group_owner + in: path + required: true + type: string + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /bnb-chain/greenfield/storage/policy_for_group/{resource}/{principal_group_id}: + get: + summary: Queries a policy that grants permission to a group + operationId: QueryPolicyForGroup + responses: + '200': + description: A successful response. + schema: + type: object + properties: + policy: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each policy. It also be + used as NFT tokenID + principal: + title: >- + principal defines the accounts/group which the permission + grants to + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: >- + PrincipalType refers to the identity type of system + users or entities. + + In Greenfield, it usually refers to accounts or + groups. + value: + type: string + title: >- + When the type is an account, its value is + sdk.AccAddress().String(); + + when the type is a group, its value is + math.Uint().String() + description: >- + Principal define the roles that can grant permissions. + Currently, it can be account or group. + resource_type: + title: >- + resource_type defines the type of resource that grants + permission for + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + resource_id: + type: string + title: >- + resource_id defines the bucket/object/group id of the + resource that grants permission for + statements: + type: array + items: + type: object + properties: + effect: + title: >- + effect define the impact of permissions, which can + be Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute + in greenfield storage network + description: >- + action_type define the operation type you can act. + greenfield defines a set of permission + + that you can specify in a permissionInfo. see + ActionType enum for detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match + and limit to 5 + + If no sub-resource is specified in a statement, then + all objects in the bucket are accessible by the + principal. + + However, if the sub-resource is defined as + 'bucket/test_*,' in the statement, then only objects + with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is + valid. If not explicitly specified, it means it will + not expire. + limit_size: + description: >- + limit_size defines the total data size that is + allowed to operate. If not explicitly specified, it + means it will not limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + title: >- + statements defines the details content of the permission, + including effect/actions/sub-resources + expiration_time: + type: string + format: date-time + title: >- + expiration_time defines the whole expiration time of all + the statements. + + Notices: Its priority is higher than the expiration time + inside the Statement + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: resource + in: path + required: true + type: string + - name: principal_group_id + in: path + required: true + type: string + tags: + - Query /greenfield/storage/head_bucket/{bucket_name}: get: summary: Queries a bucket with specify name. @@ -1725,6 +2052,7 @@ paths: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -1742,34 +2070,43 @@ paths: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read - type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD - - from a stream account or a bucket to a SP - title: payment_out_flows + format: uint64 + title: >- + read_quota defines the traffic quota for read in bytes per + month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the + charge rate of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to + calculate the charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: >- + size is the total size of the objects in the + secondary sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics default: description: An unexpected error response. schema: @@ -1837,6 +2174,7 @@ paths: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -1854,34 +2192,43 @@ paths: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: - type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD - - from a stream account or a bucket to a SP - title: payment_out_flows + format: uint64 + title: >- + read_quota defines the traffic quota for read in bytes per + month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the + charge rate of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to + calculate the charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: >- + size is the total size of the objects in the + secondary sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics default: description: An unexpected error response. schema: @@ -1975,6 +2322,73 @@ paths: type: string tags: - Query + /greenfield/storage/head_group/{group_owner}/{group_name}: + get: + summary: Queries a group with specify owner and name . + operationId: HeadGroup + responses: + '200': + description: A successful response. + schema: + type: object + properties: + group_info: + type: object + properties: + owner: + type: string + description: >- + owner is the owner of the group. It can not changed once + it created. + group_name: + type: string + description: >- + group_name is the name of group which is unique under an + account. + source_type: + title: source_type + type: string + enum: + - SOURCE_TYPE_ORIGIN + - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING + default: SOURCE_TYPE_ORIGIN + id: + type: string + title: id is the unique identifier of group + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: group_owner + in: path + required: true + type: string + - name: group_name + in: path + required: true + type: string + tags: + - Query /greenfield/storage/head_group_nft/{token_id}: get: summary: Queries a group with EIP712 standard metadata info @@ -2094,16 +2508,23 @@ paths: can be multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: >- + SourceType represents the source of resource creation, + which can + + from Greenfield native or from a cross-chain transfer from + BSC checksums: type: array items: @@ -2119,9 +2540,6 @@ paths: title: >- secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' default: description: An unexpected error response. schema: @@ -2157,7 +2575,7 @@ paths: - Query /greenfield/storage/head_object_by_id/{object_id}: get: - summary: Queries a object by id + summary: Queries an object by id operationId: HeadObjectById responses: '200': @@ -2210,16 +2628,23 @@ paths: can be multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: >- + SourceType represents the source of resource creation, + which can + + from Greenfield native or from a cross-chain transfer from + BSC checksums: type: array items: @@ -2235,9 +2660,6 @@ paths: title: >- secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' default: description: An unexpected error response. schema: @@ -2371,6 +2793,7 @@ paths: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -2390,34 +2813,43 @@ paths: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: - type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: >- - OutFlowInUSD defines the accumulative outflow stream - rate in USD - - from a stream account or a bucket to a SP - title: payment_out_flows + format: uint64 + title: >- + read_quota defines the traffic quota for read in bytes + per month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the + charge rate of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to + calculate the charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: >- + size is the total size of the objects in the + secondary sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics pagination: type: object properties: @@ -2586,16 +3018,23 @@ paths: can be multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: >- + SourceType represents the source of resource creation, + which can + + from Greenfield native or from a cross-chain transfer + from BSC checksums: type: array items: @@ -2611,9 +3050,6 @@ paths: title: >- secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' pagination: type: object properties: @@ -2786,16 +3222,23 @@ paths: can be multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: >- + SourceType represents the source of resource creation, + which can + + from Greenfield native or from a cross-chain transfer + from BSC checksums: type: array items: @@ -2811,9 +3254,6 @@ paths: title: >- secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' pagination: type: object properties: @@ -2865,109 +3305,376 @@ paths: type: string format: byte parameters: - - name: bucket_id + - name: bucket_id + in: path + required: true + type: string + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /greenfield/storage/params: + get: + summary: Parameters queries the parameters of the module. + operationId: StorageParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + max_segment_size: + type: string + format: uint64 + title: >- + max_segment_size is the maximum size of a segment. + default: 16M + redundant_data_chunk_num: + type: integer + format: int64 + title: >- + redundant_data_check_num is the num of data chunks of EC + redundancy algorithm + redundant_parity_chunk_num: + type: integer + format: int64 + title: >- + redundant_data_check_num is the num of parity chunks of EC + redundancy algorithm + max_payload_size: + type: string + format: uint64 + title: >- + max_payload_size is the maximum size of the payload, + default: 2G + min_charge_size: + type: string + format: uint64 + title: >- + min_charge_size is the minimum charge size of the payload, + objects smaller than this size will be charged as this + size + mirror_bucket_relayer_fee: + type: string + title: relayer fee for the mirror bucket tx + mirror_bucket_ack_relayer_fee: + type: string + title: >- + relayer fee for the ACK or FAIL_ACK package of the mirror + bucket tx + mirror_object_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_object_ack_relayer_fee: + type: string + title: >- + Relayer fee for the ACK or FAIL_ACK package of the mirror + object tx + mirror_group_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_group_ack_relayer_fee: + type: string + title: >- + Relayer fee for the ACK or FAIL_ACK package of the mirror + object tx + max_buckets_per_account: + type: integer + format: int64 + title: >- + The maximum number of buckets that can be created per + account + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /greenfield/storage/policy_for_account/{resource}/{principal_address}: + get: + summary: Queries a policy which grants permission to account + operationId: QueryPolicyForAccount + responses: + '200': + description: A successful response. + schema: + type: object + properties: + policy: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each policy. It also be + used as NFT tokenID + principal: + title: >- + principal defines the accounts/group which the permission + grants to + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: >- + PrincipalType refers to the identity type of system + users or entities. + + In Greenfield, it usually refers to accounts or + groups. + value: + type: string + title: >- + When the type is an account, its value is + sdk.AccAddress().String(); + + when the type is a group, its value is + math.Uint().String() + description: >- + Principal define the roles that can grant permissions. + Currently, it can be account or group. + resource_type: + title: >- + resource_type defines the type of resource that grants + permission for + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + resource_id: + type: string + title: >- + resource_id defines the bucket/object/group id of the + resource that grants permission for + statements: + type: array + items: + type: object + properties: + effect: + title: >- + effect define the impact of permissions, which can + be Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute + in greenfield storage network + description: >- + action_type define the operation type you can act. + greenfield defines a set of permission + + that you can specify in a permissionInfo. see + ActionType enum for detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match + and limit to 5 + + If no sub-resource is specified in a statement, then + all objects in the bucket are accessible by the + principal. + + However, if the sub-resource is defined as + 'bucket/test_*,' in the statement, then only objects + with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is + valid. If not explicitly specified, it means it will + not expire. + limit_size: + description: >- + limit_size defines the total data size that is + allowed to operate. If not explicitly specified, it + means it will not limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + title: >- + statements defines the details content of the permission, + including effect/actions/sub-resources + expiration_time: + type: string + format: date-time + title: >- + expiration_time defines the whole expiration time of all + the statements. + + Notices: Its priority is higher than the expiration time + inside the Statement + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: resource in: path required: true type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false + - name: principal_address + in: path + required: true type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean tags: - Query - /greenfield/storage/params: + /greenfield/storage/verify_permission/{operator}/{bucket_name}/{object_name}/{action_type}: get: - summary: Parameters queries the parameters of the module. - operationId: StorageParams + summary: Queries a list of VerifyPermission items. + operationId: VerifyPermission responses: '200': description: A successful response. schema: type: object properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_segment_size: - type: string - format: uint64 - title: >- - max_segment_size is the maximum size of a segment. - default: 16M - redundant_data_chunk_num: - type: integer - format: int64 - title: >- - redundant_data_check_num is the num of data chunks of EC - redundancy algorithm - redundant_parity_chunk_num: - type: integer - format: int64 - title: >- - redundant_data_check_num is the num of parity chunks of EC - redundancy algorithm - max_payload_size: - type: string - format: uint64 - title: >- - max_payload_size is the maximum size of the payload, - default: 2G - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. + effect: + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + title: >- + Effect define the effect of the operation permission, include + Allow or deny default: description: An unexpected error response. schema: @@ -2990,6 +3697,36 @@ paths: value: type: string format: byte + parameters: + - name: operator + in: path + required: true + type: string + - name: bucket_name + in: path + required: true + type: string + - name: object_name + in: path + required: true + type: string + - name: action_type + in: path + required: true + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL tags: - Query /cosmos/auth/v1beta1/accounts: @@ -12407,6 +13144,7 @@ paths: package: type: string format: byte + title: content of the cross chain package description: >- QueryCrossChainPackageResponse is the response type for the Query/CrossChainPackage RPC method. @@ -12434,11 +13172,13 @@ paths: format: byte parameters: - name: channel_id + description: channel id of the cross chain package. in: query required: false type: integer format: int64 - name: sequence + description: sequence of the cross chain package. in: query required: false type: string @@ -12461,6 +13201,9 @@ paths: properties: init_module_balance: type: string + title: >- + initial balance to mint for crosschain module when the + chain starts description: >- QueryParamsResponse is the response type for the Query/Params RPC method. @@ -12501,6 +13244,7 @@ paths: sequence: type: string format: uint64 + title: sequence of the cross chain package description: >- QuerySendSequenceResponse is the response type for the Query/ReceiveSequence RPC method. @@ -12528,6 +13272,7 @@ paths: format: byte parameters: - name: channel_id + description: channel id of the cross chain package. in: query required: false type: integer @@ -12547,6 +13292,7 @@ paths: sequence: type: string format: uint64 + title: sequence of the cross chain package description: >- QuerySendSequenceResponse is the response type for the Query/SendSequence RPC method. @@ -12574,6 +13320,7 @@ paths: format: byte parameters: - name: channel_id + description: channel id of the cross chain package. in: query required: false type: integer @@ -18021,6 +18768,59 @@ paths: format: byte tags: - Query + /cosmos/oracle/v1/inturn_relayer: + get: + summary: >- + InturnRelayer returns the inturn relayer bls pub key and its relay + interval + operationId: InturnRelayer + responses: + '200': + description: A successful response. + schema: + type: object + properties: + bls_pub_key: + type: string + relay_interval: + type: object + properties: + start: + type: string + format: uint64 + end: + type: string + format: uint64 + title: >- + RelayInterval holds start and end(exclusive) time of in-turn + relayer, [start, end) + description: >- + QueryInturnRelayerResponse is the response type for the Query + In-turn relayer RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query /cosmos/oracle/v1/params: get: summary: Params returns the total set of cross chain parameters. @@ -18039,10 +18839,10 @@ paths: type: string format: uint64 title: Timeout for the in turn relayer - relayer_backoff_time: + relayer_interval: type: string format: uint64 - title: Backoff time for the other relayers + title: RelayInterval is for in-turn relayer relayer_reward_share: type: integer format: int64 @@ -19939,13 +20739,18 @@ paths: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the + validator's authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the - validator's authorized relayer/operator; + bls_key defines the bls pubkey of the validator's + authorized relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -20553,13 +21358,18 @@ paths: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's + authorized relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -21182,13 +21992,18 @@ paths: type: string description: >- relayer_address defines the address of the - validator's authorized relayer/operator;. - relayer_bls_key: + validator's authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the + validator's authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the - validator's authorized relayer/operator; + bls_key defines the bls pubkey of the validator's + authorized relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -22176,13 +22991,18 @@ paths: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the + validator's authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the - validator's authorized relayer/operator; + bls_key defines the bls pubkey of the validator's + authorized relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -22788,13 +23608,18 @@ paths: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's + authorized relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -26663,32 +27488,19 @@ definitions: and settle the stream account if the timestamp is less than the current time. - bnbchain.greenfield.payment.BnbPrice: + bnbchain.greenfield.payment.OutFlow: type: object properties: - time: - type: string - format: int64 - title: time is the submit time of the price - price: - type: string - format: uint64 - description: |- - price is the price of BNB in USD. - It is multiplied by 10^8. - For example, if the price is 278.34 USD, the price is 27834000000. - title: BNBPrice is the price of BNB in USD at a given time - bnbchain.greenfield.payment.OutFlowInUSD: - type: object - properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, usually SP(service + provider) rate: type: string - title: flow rate in USD + title: flow rate title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD + OutFlow defines the accumulative outflow stream rate in BNB from a stream account or a bucket to a SP bnbchain.greenfield.payment.Params: type: object @@ -26750,7 +27562,7 @@ definitions: bnbchain.greenfield.payment.QueryAllAutoSettleRecordResponse: type: object properties: - autoSettleRecord: + auto_settle_record: type: array items: type: object @@ -26798,59 +27610,10 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - bnbchain.greenfield.payment.QueryAllBnbPriceResponse: - type: object - properties: - BnbPrice: - type: array - items: - type: object - properties: - time: - type: string - format: int64 - title: time is the submit time of the price - price: - type: string - format: uint64 - description: >- - price is the price of BNB in USD. - - It is multiplied by 10^8. - - For example, if the price is 278.34 USD, the price is - 27834000000. - title: BNBPrice is the price of BNB in USD at a given time - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } bnbchain.greenfield.payment.QueryAllPaymentAccountCountResponse: type: object properties: - paymentAccountCount: + payment_account_count: type: array items: type: object @@ -26894,7 +27657,7 @@ definitions: bnbchain.greenfield.payment.QueryAllPaymentAccountResponse: type: object properties: - paymentAccount: + payment_account: type: array items: type: object @@ -26938,7 +27701,7 @@ definitions: bnbchain.greenfield.payment.QueryAllStreamRecordResponse: type: object properties: - streamRecord: + stream_record: type: array items: type: object @@ -26955,44 +27718,47 @@ definitions: description: |- The per-second rate that an account's balance is changing. It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, usually + SP(service provider) rate: type: string - title: flow rate in USD - title: >- - OutFlowInUSD defines the accumulative outflow stream rate in - USD - + title: flow rate + title: |- + OutFlow defines the accumulative outflow stream rate in BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account title: Stream Payment Record of a stream account @@ -27025,9 +27791,9 @@ definitions: bnbchain.greenfield.payment.QueryDynamicBalanceResponse: type: object properties: - dynamicBalance: + dynamic_balance: type: string - streamRecord: + stream_record: type: object properties: account: @@ -27042,52 +27808,57 @@ definitions: description: |- The per-second rate that an account's balance is changing. It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, usually + SP(service provider) rate: type: string - title: flow rate in USD + title: flow rate title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD + OutFlow defines the accumulative outflow stream rate in BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account title: Stream Payment Record of a stream account - currentTimestamp: + current_timestamp: type: string format: int64 bnbchain.greenfield.payment.QueryGetAutoSettleRecordResponse: type: object properties: - autoSettleRecord: + auto_settle_record: type: object properties: timestamp: @@ -27107,28 +27878,10 @@ definitions: and settle the stream account if the timestamp is less than the current time. - bnbchain.greenfield.payment.QueryGetBnbPriceResponse: - type: object - properties: - BnbPrice: - type: object - properties: - time: - type: string - format: int64 - title: time is the submit time of the price - price: - type: string - format: uint64 - description: |- - price is the price of BNB in USD. - It is multiplied by 10^8. - For example, if the price is 278.34 USD, the price is 27834000000. - title: BNBPrice is the price of BNB in USD at a given time bnbchain.greenfield.payment.QueryGetPaymentAccountCountResponse: type: object properties: - paymentAccountCount: + payment_account_count: type: object properties: owner: @@ -27144,7 +27897,7 @@ definitions: bnbchain.greenfield.payment.QueryGetPaymentAccountResponse: type: object properties: - paymentAccount: + payment_account: type: object properties: addr: @@ -27167,7 +27920,7 @@ definitions: bnbchain.greenfield.payment.QueryGetStreamRecordResponse: type: object properties: - streamRecord: + stream_record: type: object properties: account: @@ -27182,42 +27935,47 @@ definitions: description: |- The per-second rate that an account's balance is changing. It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, usually + SP(service provider) rate: type: string - title: flow rate in USD + title: flow rate title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD + OutFlow defines the accumulative outflow stream rate in BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account title: Stream Payment Record of a stream account @@ -27258,6 +28016,12 @@ definitions: type: string title: The denom of fee charged in payment module description: QueryParamsResponse is response type for the Query/Params RPC method. + bnbchain.greenfield.payment.StreamAccountStatus: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE bnbchain.greenfield.payment.StreamRecord: type: object properties: @@ -27273,42 +28037,47 @@ definitions: description: |- The per-second rate that an account's balance is changing. It is the sum of the account's inbound and outbound flow rates. - staticBalance: + static_balance: type: string description: The balance of the stream account at the latest CRUD timestamp. - bufferBalance: + buffer_balance: type: string title: >- reserved balance of the stream account If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` - lockBalance: + lock_balance: type: string title: >- the locked balance of the stream account after it puts a new object and before the object is sealed status: - type: integer - format: int32 title: the status of the stream account - settleTimestamp: + type: string + enum: + - STREAM_ACCOUNT_STATUS_ACTIVE + - STREAM_ACCOUNT_STATUS_FROZEN + default: STREAM_ACCOUNT_STATUS_ACTIVE + settle_timestamp: type: string format: int64 title: the unix timestamp when the stream account will be settled - outFlowsInUSD: + out_flows: type: array items: type: object properties: - sp_address: + to_address: type: string - title: SP(service provider) stream account address + title: >- + stream account address who receives the flow, usually SP(service + provider) rate: type: string - title: flow rate in USD + title: flow rate title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD + OutFlow defines the accumulative outflow stream rate in BNB from a stream account or a bucket to a SP title: the accumulated outflow rates of the stream account title: Stream Payment Record of a stream account @@ -27413,10 +28182,6 @@ definitions: bnbchain.greenfield.sp.Params: type: object properties: - max_storage_providers: - type: integer - format: int64 - description: max_storage_providers is the maximum number of validators. deposit_denom: type: string description: deposit_denom defines the staking coin denomination. @@ -27426,6 +28191,46 @@ definitions: min_deposit_amount defines the minimum deposit amount for storage providers. description: Params defines the parameters for the module. + bnbchain.greenfield.sp.QueryGetSecondarySpStorePriceByTimeResponse: + type: object + properties: + secondary_sp_store_price: + type: object + properties: + update_time: + type: string + format: int64 + title: update time, in unix timestamp + store_price: + type: string + title: store price, in bnb wei per charge byte + title: |- + global secondary sp store price + this is the price for all secondary sps + bnbchain.greenfield.sp.QueryGetSpStoragePriceByTimeResponse: + type: object + properties: + sp_storage_price: + type: object + properties: + sp_address: + type: string + title: sp address + update_time: + type: string + format: int64 + title: update time, in unix timestamp + read_price: + type: string + title: read price, in bnb wei per charge byte + free_read_quota: + type: string + format: uint64 + title: free read quota, in byte + store_price: + type: string + title: store price, in bnb wei per charge byte + title: storage price of a specific sp bnbchain.greenfield.sp.QueryParamsResponse: type: object properties: @@ -27433,10 +28238,6 @@ definitions: description: params holds all the parameters of this module. type: object properties: - max_storage_providers: - type: integer - format: int64 - description: max_storage_providers is the maximum number of validators. deposit_denom: type: string description: deposit_denom defines the staking coin denomination. @@ -27617,6 +28418,40 @@ definitions: PageRequest.count_total was set, its value is undefined otherwise + bnbchain.greenfield.sp.SecondarySpStorePrice: + type: object + properties: + update_time: + type: string + format: int64 + title: update time, in unix timestamp + store_price: + type: string + title: store price, in bnb wei per charge byte + title: |- + global secondary sp store price + this is the price for all secondary sps + bnbchain.greenfield.sp.SpStoragePrice: + type: object + properties: + sp_address: + type: string + title: sp address + update_time: + type: string + format: int64 + title: update time, in unix timestamp + read_price: + type: string + title: read price, in bnb wei per charge byte + free_read_quota: + type: string + format: uint64 + title: free read quota, in byte + store_price: + type: string + title: store price, in bnb wei per charge byte + title: storage price of a specific sp bnbchain.greenfield.sp.Status: type: string enum: @@ -27692,6 +28527,329 @@ definitions: StorageProvider defines the meta info of storage provider TODO: add endpoint for RPC/HTTP/Websocket and p2p identity TODO: add more account address for different role. + bnbchain.greenfield.common.UInt64Value: + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + description: |- + Wrapper message for `uint64`. + + The JSON representation for `UInt64Value` is JSON string. + bnbchain.greenfield.permission.ActionType: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute in greenfield storage + network + bnbchain.greenfield.permission.Effect: + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + title: >- + Effect define the effect of the operation permission, include Allow or + deny + bnbchain.greenfield.permission.GroupMember: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each group member. It also be used + as NFT tokenID + group_id: + type: string + title: group_id is the unique id of the group + member: + type: string + title: member is the account address of the member + bnbchain.greenfield.permission.Policy: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each policy. It also be used as NFT + tokenID + principal: + title: principal defines the accounts/group which the permission grants to + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: >- + PrincipalType refers to the identity type of system users or + entities. + + In Greenfield, it usually refers to accounts or groups. + value: + type: string + title: >- + When the type is an account, its value is + sdk.AccAddress().String(); + + when the type is a group, its value is math.Uint().String() + description: >- + Principal define the roles that can grant permissions. Currently, it + can be account or group. + resource_type: + title: resource_type defines the type of resource that grants permission for + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + resource_id: + type: string + title: >- + resource_id defines the bucket/object/group id of the resource that + grants permission for + statements: + type: array + items: + type: object + properties: + effect: + title: effect define the impact of permissions, which can be Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute in + greenfield storage network + description: >- + action_type define the operation type you can act. greenfield + defines a set of permission + + that you can specify in a permissionInfo. see ActionType enum + for detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match and limit to + 5 + + If no sub-resource is specified in a statement, then all objects + in the bucket are accessible by the principal. + + However, if the sub-resource is defined as 'bucket/test_*,' in + the statement, then only objects with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is valid. If not + explicitly specified, it means it will not expire. + limit_size: + description: >- + limit_size defines the total data size that is allowed to + operate. If not explicitly specified, it means it will not + limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + title: >- + statements defines the details content of the permission, including + effect/actions/sub-resources + expiration_time: + type: string + format: date-time + title: >- + expiration_time defines the whole expiration time of all the + statements. + + Notices: Its priority is higher than the expiration time inside the + Statement + bnbchain.greenfield.permission.Principal: + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: |- + PrincipalType refers to the identity type of system users or entities. + In Greenfield, it usually refers to accounts or groups. + value: + type: string + title: |- + When the type is an account, its value is sdk.AccAddress().String(); + when the type is a group, its value is math.Uint().String() + description: >- + Principal define the roles that can grant permissions. Currently, it can + be account or group. + bnbchain.greenfield.permission.PrincipalType: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: |- + PrincipalType refers to the identity type of system users or entities. + In Greenfield, it usually refers to accounts or groups. + bnbchain.greenfield.permission.Statement: + type: object + properties: + effect: + title: effect define the impact of permissions, which can be Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute in greenfield + storage network + description: >- + action_type define the operation type you can act. greenfield defines + a set of permission + + that you can specify in a permissionInfo. see ActionType enum for + detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match and limit to 5 + + If no sub-resource is specified in a statement, then all objects in + the bucket are accessible by the principal. + + However, if the sub-resource is defined as 'bucket/test_*,' in the + statement, then only objects with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is valid. If not + explicitly specified, it means it will not expire. + limit_size: + description: >- + limit_size defines the total data size that is allowed to operate. If + not explicitly specified, it means it will not limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + bnbchain.greenfield.resource.ResourceType: + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + bnbchain.greenfield.storage.BillingInfo: + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the charge rate of + the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to calculate the + charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: size is the total size of the objects in the secondary sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics + title: BillingInfo is the billing information of the bucket bnbchain.greenfield.storage.BucketInfo: type: object properties: @@ -27719,6 +28877,7 @@ definitions: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -27735,32 +28894,39 @@ definitions: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read - type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD - from a stream account or a bucket to a SP - title: payment_out_flows + format: uint64 + title: read_quota defines the traffic quota for read in bytes per month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the charge rate + of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to calculate the + charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: size is the total size of the objects in the secondary sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics bnbchain.greenfield.storage.BucketMetaData: type: object properties: @@ -27786,6 +28952,26 @@ definitions: value: type: string title: attributes + bnbchain.greenfield.storage.GroupInfo: + type: object + properties: + owner: + type: string + description: owner is the owner of the group. It can not changed once it created. + group_name: + type: string + description: group_name is the name of group which is unique under an account. + source_type: + title: source_type + type: string + enum: + - SOURCE_TYPE_ORIGIN + - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING + default: SOURCE_TYPE_ORIGIN + id: + type: string + title: id is the unique identifier of group bnbchain.greenfield.storage.GroupMetaData: type: object properties: @@ -27856,16 +29042,20 @@ definitions: multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: |- + SourceType represents the source of resource creation, which can + from Greenfield native or from a cross-chain transfer from BSC checksums: type: array items: @@ -27877,9 +29067,6 @@ definitions: items: type: string title: secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' bnbchain.greenfield.storage.ObjectMetaData: type: object properties: @@ -27911,6 +29098,17 @@ definitions: - OBJECT_STATUS_CREATED - OBJECT_STATUS_SEALED default: OBJECT_STATUS_CREATED + description: >- + ObjectStatus represents the creation status of an object. After a user + successfully + + sends a CreateObject transaction onto the chain, the status is set to + 'Created'. + + After the Primary Service Provider successfully sends a Seal Object + transaction onto + + the chain, the status is set to 'Sealed'. bnbchain.greenfield.storage.Params: type: object properties: @@ -27934,6 +29132,34 @@ definitions: type: string format: uint64 title: 'max_payload_size is the maximum size of the payload, default: 2G' + min_charge_size: + type: string + format: uint64 + title: >- + min_charge_size is the minimum charge size of the payload, objects + smaller than this size will be charged as this size + mirror_bucket_relayer_fee: + type: string + title: relayer fee for the mirror bucket tx + mirror_bucket_ack_relayer_fee: + type: string + title: relayer fee for the ACK or FAIL_ACK package of the mirror bucket tx + mirror_object_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_object_ack_relayer_fee: + type: string + title: Relayer fee for the ACK or FAIL_ACK package of the mirror object tx + mirror_group_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_group_ack_relayer_fee: + type: string + title: Relayer fee for the ACK or FAIL_ACK package of the mirror object tx + max_buckets_per_account: + type: integer + format: int64 + title: The maximum number of buckets that can be created per account description: Params defines the parameters for the module. bnbchain.greenfield.storage.QueryBucketNFTResponse: type: object @@ -28021,6 +29247,7 @@ definitions: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -28037,32 +29264,83 @@ definitions: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read + type: string + format: uint64 + title: read_quota defines the traffic quota for read in bytes per month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the charge + rate of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to calculate + the charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: >- + size is the total size of the objects in the secondary + sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics + bnbchain.greenfield.storage.QueryHeadGroupMemberResponse: + type: object + properties: + group_member: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each group member. It also be + used as NFT tokenID + group_id: + type: string + title: group_id is the unique id of the group + member: + type: string + title: member is the account address of the member + bnbchain.greenfield.storage.QueryHeadGroupResponse: + type: object + properties: + group_info: + type: object + properties: + owner: + type: string + description: >- + owner is the owner of the group. It can not changed once it + created. + group_name: + type: string + description: group_name is the name of group which is unique under an account. + source_type: + title: source_type type: string enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: + - SOURCE_TYPE_ORIGIN + - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING + default: SOURCE_TYPE_ORIGIN + id: type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: |- - OutFlowInUSD defines the accumulative outflow stream rate in USD - from a stream account or a bucket to a SP - title: payment_out_flows + title: id is the unique identifier of group bnbchain.greenfield.storage.QueryHeadObjectResponse: type: object properties: @@ -28111,16 +29389,20 @@ definitions: multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: |- + SourceType represents the source of resource creation, which can + from Greenfield native or from a cross-chain transfer from BSC checksums: type: array items: @@ -28132,9 +29414,6 @@ definitions: items: type: string title: secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' bnbchain.greenfield.storage.QueryListBucketsResponse: type: object properties: @@ -28167,6 +29446,7 @@ definitions: enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN create_at: type: string @@ -28183,34 +29463,70 @@ definitions: leave this SP, unless you explicitly shift them to another SP. read_quota: - title: read_quota defines the traffic quota for read type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - payment_price_time: - type: string - format: int64 - title: 'payment_price_time TODO(Owen): refine the comments' - payment_out_flows: - type: array - items: - type: object - properties: - sp_address: - type: string - title: SP(service provider) stream account address - rate: - type: string - title: flow rate in USD - title: >- - OutFlowInUSD defines the accumulative outflow stream rate in - USD + format: uint64 + title: read_quota defines the traffic quota for read in bytes per month + billing_info: + title: billing info of the bucket + type: object + properties: + price_time: + type: string + format: int64 + title: >- + the time of the payment price, used to calculate the charge + rate of the bucket + total_charge_size: + type: string + format: uint64 + title: >- + the total size of the objects in the bucket, used to + calculate the charge rate of the bucket + secondary_sp_objects_size: + type: array + items: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: >- + size is the total size of the objects in the secondary + sp + title: secondary sp objects size statistics + title: secondary sp objects size statistics + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - from a stream account or a bucket to a SP - title: payment_out_flows + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + bnbchain.greenfield.storage.QueryListGroupResponse: + type: object + properties: pagination: type: object properties: @@ -28237,6 +29553,32 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } + group_infos: + type: array + items: + type: object + properties: + owner: + type: string + description: >- + owner is the owner of the group. It can not changed once it + created. + group_name: + type: string + description: >- + group_name is the name of group which is unique under an + account. + source_type: + title: source_type + type: string + enum: + - SOURCE_TYPE_ORIGIN + - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING + default: SOURCE_TYPE_ORIGIN + id: + type: string + title: id is the unique identifier of group bnbchain.greenfield.storage.QueryListObjectsResponse: type: object properties: @@ -28287,16 +29629,20 @@ definitions: multi-replication or EC. type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE source_type: description: source_type define the source of the object. type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: |- + SourceType represents the source of resource creation, which can + from Greenfield native or from a cross-chain transfer from BSC checksums: type: array items: @@ -28310,9 +29656,6 @@ definitions: items: type: string title: secondary_sp_addresses define the addresses of secondary_sps - locked_balance: - type: string - title: 'lockedBalance TODO(Owen): refine the comments' pagination: type: object properties: @@ -28394,31 +29737,366 @@ definitions: type: string format: uint64 title: 'max_payload_size is the maximum size of the payload, default: 2G' + min_charge_size: + type: string + format: uint64 + title: >- + min_charge_size is the minimum charge size of the payload, objects + smaller than this size will be charged as this size + mirror_bucket_relayer_fee: + type: string + title: relayer fee for the mirror bucket tx + mirror_bucket_ack_relayer_fee: + type: string + title: >- + relayer fee for the ACK or FAIL_ACK package of the mirror bucket + tx + mirror_object_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_object_ack_relayer_fee: + type: string + title: >- + Relayer fee for the ACK or FAIL_ACK package of the mirror object + tx + mirror_group_relayer_fee: + type: string + title: relayer fee for the mirror object tx + mirror_group_ack_relayer_fee: + type: string + title: >- + Relayer fee for the ACK or FAIL_ACK package of the mirror object + tx + max_buckets_per_account: + type: integer + format: int64 + title: The maximum number of buckets that can be created per account description: QueryParamsResponse is response type for the Query/Params RPC method. - bnbchain.greenfield.storage.ReadQuota: - type: string - enum: - - READ_QUOTA_FREE - - READ_QUOTA_1G - - READ_QUOTA_10G - default: READ_QUOTA_FREE - title: >- - TODO: Need to confirm the read quota enum which determined by payment - module + bnbchain.greenfield.storage.QueryPolicyForAccountResponse: + type: object + properties: + policy: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each policy. It also be used as + NFT tokenID + principal: + title: >- + principal defines the accounts/group which the permission grants + to + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: >- + PrincipalType refers to the identity type of system users or + entities. + + In Greenfield, it usually refers to accounts or groups. + value: + type: string + title: >- + When the type is an account, its value is + sdk.AccAddress().String(); - TODO: Make this field be configured through governance + when the type is a group, its value is math.Uint().String() + description: >- + Principal define the roles that can grant permissions. Currently, + it can be account or group. + resource_type: + title: >- + resource_type defines the type of resource that grants permission + for + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + resource_id: + type: string + title: >- + resource_id defines the bucket/object/group id of the resource + that grants permission for + statements: + type: array + items: + type: object + properties: + effect: + title: >- + effect define the impact of permissions, which can be + Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute in + greenfield storage network + description: >- + action_type define the operation type you can act. + greenfield defines a set of permission + + that you can specify in a permissionInfo. see ActionType + enum for detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match and limit + to 5 + + If no sub-resource is specified in a statement, then all + objects in the bucket are accessible by the principal. + + However, if the sub-resource is defined as 'bucket/test_*,' + in the statement, then only objects with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is valid. If + not explicitly specified, it means it will not expire. + limit_size: + description: >- + limit_size defines the total data size that is allowed to + operate. If not explicitly specified, it means it will not + limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + title: >- + statements defines the details content of the permission, + including effect/actions/sub-resources + expiration_time: + type: string + format: date-time + title: >- + expiration_time defines the whole expiration time of all the + statements. + + Notices: Its priority is higher than the expiration time inside + the Statement + bnbchain.greenfield.storage.QueryPolicyForGroupResponse: + type: object + properties: + policy: + type: object + properties: + id: + type: string + title: >- + id is an unique u256 sequence for each policy. It also be used as + NFT tokenID + principal: + title: >- + principal defines the accounts/group which the permission grants + to + type: object + properties: + type: + type: string + enum: + - PRINCIPAL_TYPE_UNSPECIFIED + - PRINCIPAL_TYPE_GNFD_ACCOUNT + - PRINCIPAL_TYPE_GNFD_GROUP + default: PRINCIPAL_TYPE_UNSPECIFIED + description: >- + PrincipalType refers to the identity type of system users or + entities. + + In Greenfield, it usually refers to accounts or groups. + value: + type: string + title: >- + When the type is an account, its value is + sdk.AccAddress().String(); + + when the type is a group, its value is math.Uint().String() + description: >- + Principal define the roles that can grant permissions. Currently, + it can be account or group. + resource_type: + title: >- + resource_type defines the type of resource that grants permission + for + type: string + enum: + - RESOURCE_TYPE_UNSPECIFIED + - RESOURCE_TYPE_BUCKET + - RESOURCE_TYPE_OBJECT + - RESOURCE_TYPE_GROUP + default: RESOURCE_TYPE_UNSPECIFIED + resource_id: + type: string + title: >- + resource_id defines the bucket/object/group id of the resource + that grants permission for + statements: + type: array + items: + type: object + properties: + effect: + title: >- + effect define the impact of permissions, which can be + Allow/Deny + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + actions: + type: array + items: + type: string + enum: + - ACTION_UNSPECIFIED + - ACTION_UPDATE_BUCKET_INFO + - ACTION_DELETE_BUCKET + - ACTION_CREATE_OBJECT + - ACTION_DELETE_OBJECT + - ACTION_COPY_OBJECT + - ACTION_GET_OBJECT + - ACTION_EXECUTE_OBJECT + - ACTION_LIST_OBJECT + - ACTION_UPDATE_GROUP_MEMBER + - ACTION_DELETE_GROUP + - ACTION_TYPE_ALL + default: ACTION_UNSPECIFIED + title: >- + ActionType defines the operations you can execute in + greenfield storage network + description: >- + action_type define the operation type you can act. + greenfield defines a set of permission + + that you can specify in a permissionInfo. see ActionType + enum for detail. + resources: + type: array + items: + type: string + description: >- + CAN ONLY USED IN bucket level. Support fuzzy match and limit + to 5 + + If no sub-resource is specified in a statement, then all + objects in the bucket are accessible by the principal. + + However, if the sub-resource is defined as 'bucket/test_*,' + in the statement, then only objects with a 'test_' + + prefix can be accessed by the principal. + expiration_time: + type: string + format: date-time + description: >- + expiration_time defines how long the permission is valid. If + not explicitly specified, it means it will not expire. + limit_size: + description: >- + limit_size defines the total data size that is allowed to + operate. If not explicitly specified, it means it will not + limit. + type: object + properties: + value: + type: string + format: uint64 + description: The uint64 value. + title: >- + statements defines the details content of the permission, + including effect/actions/sub-resources + expiration_time: + type: string + format: date-time + title: >- + expiration_time defines the whole expiration time of all the + statements. + + Notices: Its priority is higher than the expiration time inside + the Statement + bnbchain.greenfield.storage.QueryVerifyPermissionResponse: + type: object + properties: + effect: + type: string + enum: + - EFFECT_UNSPECIFIED + - EFFECT_ALLOW + - EFFECT_DENY + default: EFFECT_UNSPECIFIED + title: >- + Effect define the effect of the operation permission, include Allow or + deny bnbchain.greenfield.storage.RedundancyType: type: string enum: - - REDUNDANCY_REPLICA_TYPE - REDUNDANCY_EC_TYPE - default: REDUNDANCY_REPLICA_TYPE + - REDUNDANCY_REPLICA_TYPE + default: REDUNDANCY_EC_TYPE + description: |- + RedundancyType represents the redundancy algorithm type for object data, + which can be either multi-replica or erasure coding. + bnbchain.greenfield.storage.SecondarySpObjectsSize: + type: object + properties: + sp_address: + type: string + title: address is the address of the secondary sp + total_charge_size: + type: string + format: uint64 + title: size is the total size of the objects in the secondary sp + title: secondary sp objects size statistics bnbchain.greenfield.storage.SourceType: type: string enum: - SOURCE_TYPE_ORIGIN - SOURCE_TYPE_BSC_CROSS_CHAIN + - SOURCE_TYPE_MIRROR_PENDING default: SOURCE_TYPE_ORIGIN + title: |- + SourceType represents the source of resource creation, which can + from Greenfield native or from a cross-chain transfer from BSC bnbchain.greenfield.storage.Trait: type: object properties: @@ -36878,6 +38556,7 @@ definitions: properties: init_module_balance: type: string + title: initial balance to mint for crosschain module when the chain starts description: Params holds parameters for the cross chain module. cosmos.crosschain.v1.QueryCrossChainPackageResponse: type: object @@ -36885,6 +38564,7 @@ definitions: package: type: string format: byte + title: content of the cross chain package description: >- QueryCrossChainPackageResponse is the response type for the Query/CrossChainPackage RPC method. @@ -36897,6 +38577,9 @@ definitions: properties: init_module_balance: type: string + title: >- + initial balance to mint for crosschain module when the chain + starts description: QueryParamsResponse is the response type for the Query/Params RPC method. cosmos.crosschain.v1.QueryReceiveSequenceResponse: type: object @@ -36904,6 +38587,7 @@ definitions: sequence: type: string format: uint64 + title: sequence of the cross chain package description: >- QuerySendSequenceResponse is the response type for the Query/ReceiveSequence RPC method. @@ -36913,6 +38597,7 @@ definitions: sequence: type: string format: uint64 + title: sequence of the cross chain package description: >- QuerySendSequenceResponse is the response type for the Query/SendSequence RPC method. @@ -39354,10 +41039,10 @@ definitions: type: string format: uint64 title: Timeout for the in turn relayer - relayer_backoff_time: + relayer_interval: type: string format: uint64 - title: Backoff time for the other relayers + title: RelayInterval is for in-turn relayer relayer_reward_share: type: integer format: int64 @@ -39367,6 +41052,26 @@ definitions: the other relayers signed the bls message will share the reward evenly. description: Params holds parameters for the oracle module. + cosmos.oracle.v1.QueryInturnRelayerResponse: + type: object + properties: + bls_pub_key: + type: string + relay_interval: + type: object + properties: + start: + type: string + format: uint64 + end: + type: string + format: uint64 + title: >- + RelayInterval holds start and end(exclusive) time of in-turn relayer, + [start, end) + description: >- + QueryInturnRelayerResponse is the response type for the Query In-turn + relayer RPC method. cosmos.oracle.v1.QueryParamsResponse: type: object properties: @@ -39378,10 +41083,10 @@ definitions: type: string format: uint64 title: Timeout for the in turn relayer - relayer_backoff_time: + relayer_interval: type: string format: uint64 - title: Backoff time for the other relayers + title: RelayInterval is for in-turn relayer relayer_reward_share: type: integer format: int64 @@ -39391,6 +41096,18 @@ definitions: the other relayers signed the bls message will share the reward evenly. description: QueryParamsResponse is the response type for the Query/Params RPC method. + cosmos.oracle.v1.RelayInterval: + type: object + properties: + start: + type: string + format: uint64 + end: + type: string + format: uint64 + title: >- + RelayInterval holds start and end(exclusive) time of in-turn relayer, + [start, end) cosmos.params.v1beta1.ParamChange: type: object properties: @@ -40183,13 +41900,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -40746,13 +42468,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's authorized - relayer/operator;. - relayer_bls_key: + relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -41064,13 +42791,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -41489,13 +43221,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -42111,13 +43848,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's authorized - relayer/operator;. - relayer_bls_key: + relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -42499,13 +44241,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's - authorized relayer/operator;. - relayer_bls_key: + authorized relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's + authorized challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's - authorized relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the @@ -43093,13 +44840,18 @@ definitions: type: string description: >- relayer_address defines the address of the validator's authorized - relayer/operator;. - relayer_bls_key: + relayer;. + challenger_address: + type: string + description: >- + challenger_address defines the address of the validator's authorized + challenger;. + bls_key: type: string format: byte title: >- - relayer_bls_key defines the bls pubkey of the validator's authorized - relayer/operator; + bls_key defines the bls pubkey of the validator's authorized + relayer/challenger/operator; description: >- Validator defines a validator, together with the total amount of the diff --git a/types/resource/types.pb.go b/types/resource/types.pb.go index 914806eae..4ac6ba2ce 100644 --- a/types/resource/types.pb.go +++ b/types/resource/types.pb.go @@ -25,21 +25,24 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ResourceType int32 const ( - RESOURCE_TYPE_BUCKET ResourceType = 0 - RESOURCE_TYPE_OBJECT ResourceType = 1 - RESOURCE_TYPE_GROUP ResourceType = 2 + RESOURCE_TYPE_UNSPECIFIED ResourceType = 0 + RESOURCE_TYPE_BUCKET ResourceType = 1 + RESOURCE_TYPE_OBJECT ResourceType = 2 + RESOURCE_TYPE_GROUP ResourceType = 3 ) var ResourceType_name = map[int32]string{ - 0: "RESOURCE_TYPE_BUCKET", - 1: "RESOURCE_TYPE_OBJECT", - 2: "RESOURCE_TYPE_GROUP", + 0: "RESOURCE_TYPE_UNSPECIFIED", + 1: "RESOURCE_TYPE_BUCKET", + 2: "RESOURCE_TYPE_OBJECT", + 3: "RESOURCE_TYPE_GROUP", } var ResourceType_value = map[string]int32{ - "RESOURCE_TYPE_BUCKET": 0, - "RESOURCE_TYPE_OBJECT": 1, - "RESOURCE_TYPE_GROUP": 2, + "RESOURCE_TYPE_UNSPECIFIED": 0, + "RESOURCE_TYPE_BUCKET": 1, + "RESOURCE_TYPE_OBJECT": 2, + "RESOURCE_TYPE_GROUP": 3, } func (x ResourceType) String() string { @@ -57,20 +60,21 @@ func init() { func init() { proto.RegisterFile("greenfield/resource/types.proto", fileDescriptor_062551b92776326d) } var fileDescriptor_062551b92776326d = []byte{ - // 227 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0x2f, 0x4a, 0x4d, 0xcd, 0x4b, 0xcb, 0x4c, 0xcd, 0x49, 0xd1, 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x49, 0xca, 0x4b, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x43, 0xa8, 0xd4, 0x83, 0xa9, 0x94, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07, 0xab, 0xd5, 0x87, 0x70, 0x20, 0x1a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, - 0xf3, 0x21, 0xe2, 0x20, 0x16, 0x44, 0x54, 0x2b, 0x91, 0x8b, 0x27, 0x08, 0xaa, 0x39, 0xa4, 0xb2, - 0x20, 0x55, 0x48, 0x82, 0x4b, 0x24, 0xc8, 0x35, 0xd8, 0x3f, 0x34, 0xc8, 0xd9, 0x35, 0x3e, 0x24, - 0x32, 0xc0, 0x35, 0xde, 0x29, 0xd4, 0xd9, 0xdb, 0x35, 0x44, 0x80, 0x01, 0x53, 0xc6, 0xdf, 0xc9, - 0xcb, 0xd5, 0x39, 0x44, 0x80, 0x51, 0x48, 0x9c, 0x4b, 0x18, 0x55, 0xc6, 0x3d, 0xc8, 0x3f, 0x34, - 0x40, 0x80, 0x49, 0x8a, 0xa5, 0x63, 0xb1, 0x1c, 0x83, 0x93, 0xc7, 0x89, 0x47, 0x72, 0x8c, 0x17, - 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, - 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, - 0xea, 0x27, 0xe5, 0x25, 0xe9, 0x82, 0xfd, 0xa5, 0x8f, 0x14, 0x02, 0x60, 0x8f, 0xc3, 0xc3, 0x21, - 0x89, 0x0d, 0xec, 0x66, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x2d, 0x73, 0x49, 0x25, - 0x01, 0x00, 0x00, + 0xf3, 0x21, 0xe2, 0x20, 0x16, 0x44, 0x54, 0xab, 0x81, 0x91, 0x8b, 0x27, 0x08, 0xaa, 0x3b, 0xa4, + 0xb2, 0x20, 0x55, 0x48, 0x96, 0x4b, 0x32, 0xc8, 0x35, 0xd8, 0x3f, 0x34, 0xc8, 0xd9, 0x35, 0x3e, + 0x24, 0x32, 0xc0, 0x35, 0x3e, 0xd4, 0x2f, 0x38, 0xc0, 0xd5, 0xd9, 0xd3, 0xcd, 0xd3, 0xd5, 0x45, + 0x80, 0x41, 0x48, 0x82, 0x4b, 0x04, 0x55, 0xda, 0x29, 0xd4, 0xd9, 0xdb, 0x35, 0x44, 0x80, 0x11, + 0x53, 0xc6, 0xdf, 0xc9, 0xcb, 0xd5, 0x39, 0x44, 0x80, 0x49, 0x48, 0x9c, 0x4b, 0x18, 0x55, 0xc6, + 0x3d, 0xc8, 0x3f, 0x34, 0x40, 0x80, 0x59, 0x8a, 0xa5, 0x63, 0xb1, 0x1c, 0x83, 0x93, 0xc7, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x27, 0xe5, 0x25, 0xe9, 0x82, 0xfd, 0xad, 0x8f, 0x14, 0x42, 0xe0, + 0x80, 0x81, 0x87, 0x53, 0x12, 0x1b, 0xd8, 0x4f, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0c, + 0x75, 0x75, 0x4c, 0x45, 0x01, 0x00, 0x00, } diff --git a/x/permission/keeper/keeper.go b/x/permission/keeper/keeper.go index e633b1e12..ad505de84 100644 --- a/x/permission/keeper/keeper.go +++ b/x/permission/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "fmt" "cosmossdk.io/math" + storagetypes "github.com/bnb-chain/greenfield/x/storage/types" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,7 +14,6 @@ import ( "github.com/bnb-chain/greenfield/internal/sequence" "github.com/bnb-chain/greenfield/types/resource" "github.com/bnb-chain/greenfield/x/permission/types" - storagetypes "github.com/bnb-chain/greenfield/x/storage/types" ) type ( @@ -25,7 +25,8 @@ type ( accountKeeper types.AccountKeeper // policy sequence - policySeq sequence.U256 + policySeq sequence.U256 + groupMemberSeq sequence.U256 } ) @@ -50,6 +51,7 @@ func NewKeeper( accountKeeper: accountKeeper, } k.policySeq = sequence.NewSequence256(types.PolicySequencePrefix) + k.groupMemberSeq = sequence.NewSequence256(types.GroupMemberByIDPrefix) return k } @@ -59,34 +61,52 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func (k Keeper) AddGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error { store := ctx.KVStore(k.storeKey) - policy, found := k.GetPolicyForAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) - if !found { - policy = types.NewDefaultPolicyForGroupMember(groupID, member) - policy.Id = k.policySeq.NextVal(store) - } else { - if policy.MemberStatement != nil { - return storagetypes.ErrGroupMemberAlreadyExists - } - policy.MemberStatement = types.NewMemberStatement() + memberKey := types.GetGroupMemberKey(groupID, member) + if store.Has(memberKey) { + return storagetypes.ErrGroupMemberAlreadyExists + } + groupMember := types.GroupMember{ + GroupId: groupID, + Member: member.String(), } + id := k.groupMemberSeq.NextVal(store) + store.Set(memberKey, id.Bytes()) + store.Set(types.GetGroupMemberByIDKey(id), k.cdc.MustMarshal(&groupMember)) + return nil +} - k.setPolicyForAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member, policy) +func (k Keeper) RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error { + store := ctx.KVStore(k.storeKey) + memberKey := types.GetGroupMemberKey(groupID, member) + bz := store.Get(memberKey) + if bz == nil { + return storagetypes.ErrNoSuchGroup + } + store.Delete(memberKey) + store.Delete(types.GetGroupMemberByIDKey(sequence.DecodeSequence(bz))) return nil } -func (k Keeper) RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) { +func (k Keeper) GetGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) (*types.GroupMember, bool) { store := ctx.KVStore(k.storeKey) + memberKey := types.GetGroupMemberKey(groupID, member) + bz := store.Get(memberKey) + if bz == nil { + return nil, false + } - policy, found := k.GetPolicyForAccount(ctx, groupID, resource.RESOURCE_TYPE_GROUP, member) - if found { - if policy.Statements == nil { - store.Delete(types.GetPolicyByIDKey(policy.Id)) - store.Delete(types.GetPolicyForAccountKey(groupID, resource.RESOURCE_TYPE_GROUP, member)) - } else { - policy.MemberStatement = nil - store.Set(types.GetPolicyByIDKey(policy.Id), k.cdc.MustMarshal(policy)) - } + return k.GetGroupMemberByID(ctx, sequence.DecodeSequence(bz)) +} + +func (k Keeper) GetGroupMemberByID(ctx sdk.Context, groupMemberID math.Uint) (*types.GroupMember, bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GetGroupMemberByIDKey(groupMemberID)) + if bz == nil { + return nil, false } + var groupMember types.GroupMember + k.cdc.MustUnmarshal(bz, &groupMember) + return &groupMember, true } func (k Keeper) updatePolicy(ctx sdk.Context, policy *types.Policy, newPolicy *types.Policy) *types.Policy { @@ -100,7 +120,7 @@ func (k Keeper) PutPolicy(ctx sdk.Context, policy *types.Policy) (math.Uint, err store := ctx.KVStore(k.storeKey) var newPolicy *types.Policy - if policy.Principal.Type == types.TYPE_GNFD_ACCOUNT { + if policy.Principal.Type == types.PRINCIPAL_TYPE_GNFD_ACCOUNT { policyKey := types.GetPolicyForAccountKey(policy.ResourceId, policy.ResourceType, policy.Principal.MustGetAccountAddress()) bz := store.Get(policyKey) @@ -115,7 +135,7 @@ func (k Keeper) PutPolicy(ctx sdk.Context, policy *types.Policy) (math.Uint, err store.Set(types.GetPolicyByIDKey(policy.Id), bz) newPolicy = policy } - } else if policy.Principal.Type == types.TYPE_GNFD_GROUP { + } else if policy.Principal.Type == types.PRINCIPAL_TYPE_GNFD_GROUP { policyGroupKey := types.GetPolicyForGroupKey(policy.ResourceId, policy.ResourceType) bz := store.Get(policyGroupKey) if bz != nil { @@ -226,15 +246,6 @@ func (k Keeper) GetPolicyForGroup(ctx sdk.Context, resourceID math.Uint, return nil, false } -func (k Keeper) setPolicyForAccount(ctx sdk.Context, resourceID math.Uint, - resourceType resource.ResourceType, addr sdk.AccAddress, policy *types.Policy) { - store := ctx.KVStore(k.storeKey) - policyKey := types.GetPolicyForAccountKey(resourceID, resourceType, addr) - - store.Set(policyKey, sequence.EncodeSequence(policy.Id)) - store.Set(types.GetPolicyByIDKey(policy.Id), k.cdc.MustMarshal(policy)) -} - func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, operator sdk.AccAddress, action types.ActionType, opts *types.VerifyOptions) types.Effect { // verify policy which grant permission to account @@ -243,7 +254,7 @@ func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType effect, newPolicy := policy.Eval(action, ctx.BlockTime(), opts) k.Logger(ctx).Info(fmt.Sprintf("CreateObject LimitSize update: %s, effect: %s, ctx.TxBytes : %d", newPolicy.String(), effect, ctx.TxSize())) - if effect != types.EFFECT_PASS { + if effect != types.EFFECT_UNSPECIFIED { if effect == types.EFFECT_ALLOW && action == types.ACTION_CREATE_OBJECT && newPolicy != nil && ctx.TxBytes() != nil { _, err := k.PutPolicy(ctx, newPolicy) if err != nil { @@ -269,16 +280,14 @@ func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType // check the group has the right permission of this resource p := k.MustGetPolicyByID(ctx, item.PolicyId) effect, newPolicy = p.Eval(action, ctx.BlockTime(), opts) - if effect != types.EFFECT_PASS { + if effect != types.EFFECT_UNSPECIFIED { // check the operator is the member of this group - memberPolicy, memberFound := k.GetPolicyForAccount(ctx, item.GroupId, resource.RESOURCE_TYPE_GROUP, operator) + _, memberFound := k.GetGroupMember(ctx, item.GroupId, operator) if memberFound { - if memberPolicy.MemberStatement.Effect != types.EFFECT_PASS { - if effect == types.EFFECT_ALLOW && memberPolicy.MemberStatement.Effect == types.EFFECT_ALLOW { - allowed = true - } else if effect == types.EFFECT_DENY && memberPolicy.MemberStatement.Effect == types.EFFECT_ALLOW { - return types.EFFECT_DENY - } + if effect == types.EFFECT_ALLOW { + allowed = true + } else if effect == types.EFFECT_DENY { + return types.EFFECT_DENY } } } @@ -296,7 +305,7 @@ func (k Keeper) VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType } } - return types.EFFECT_PASS + return types.EFFECT_UNSPECIFIED } func (k Keeper) DeletePolicy(ctx sdk.Context, principal *types.Principal, resourceType resource.ResourceType, @@ -304,7 +313,7 @@ func (k Keeper) DeletePolicy(ctx sdk.Context, principal *types.Principal, resour store := ctx.KVStore(k.storeKey) var policyID math.Uint - if principal.Type == types.TYPE_GNFD_ACCOUNT { + if principal.Type == types.PRINCIPAL_TYPE_GNFD_ACCOUNT { accAddr := sdk.MustAccAddressFromHex(principal.Value) policyKey := types.GetPolicyForAccountKey(resourceID, resourceType, accAddr) bz := store.Get(policyKey) @@ -313,7 +322,7 @@ func (k Keeper) DeletePolicy(ctx sdk.Context, principal *types.Principal, resour store.Delete(policyKey) store.Delete(types.GetPolicyByIDKey(policyID)) } - } else if principal.Type == types.TYPE_GNFD_GROUP { + } else if principal.Type == types.PRINCIPAL_TYPE_GNFD_GROUP { groupID, err := principal.GetGroupID() if err != nil { return math.ZeroUint(), err diff --git a/x/permission/types/common.go b/x/permission/types/common.go index 4834dcf85..858bff40d 100644 --- a/x/permission/types/common.go +++ b/x/permission/types/common.go @@ -7,26 +7,28 @@ import ( func NewPrincipalWithAccount(addr sdk.AccAddress) *Principal { return &Principal{ - Type: TYPE_GNFD_ACCOUNT, + Type: PRINCIPAL_TYPE_GNFD_ACCOUNT, Value: addr.String(), } } func NewPrincipalWithGroup(groupID sdkmath.Uint) *Principal { return &Principal{ - Type: TYPE_GNFD_GROUP, + Type: PRINCIPAL_TYPE_GNFD_GROUP, Value: groupID.String(), } } func (p *Principal) ValidateBasic() error { switch p.Type { - case TYPE_GNFD_ACCOUNT: + case PRINCIPAL_TYPE_UNSPECIFIED: + return ErrInvalidPrincipal.Wrapf("Not allowed empty principal type.") + case PRINCIPAL_TYPE_GNFD_ACCOUNT: _, err := sdk.AccAddressFromHexUnsafe(p.Value) if err != nil { return ErrInvalidPrincipal.Wrapf("Invalid account, principal: %s, err: %s", p.String(), err) } - case TYPE_GNFD_GROUP: + case PRINCIPAL_TYPE_GNFD_GROUP: groupID, err := sdkmath.ParseUint(p.Value) if err != nil { return ErrInvalidPrincipal.Wrapf("Invalid groupID, principal: %s, err: %s", p.String(), err) @@ -41,7 +43,7 @@ func (p *Principal) ValidateBasic() error { } func (p *Principal) GetAccountAddress() (sdk.AccAddress, error) { - if p.Type != TYPE_GNFD_ACCOUNT { + if p.Type != PRINCIPAL_TYPE_GNFD_ACCOUNT { panic("principal type mismatch.") } @@ -53,7 +55,7 @@ func (p *Principal) GetAccountAddress() (sdk.AccAddress, error) { } func (p *Principal) GetGroupID() (sdkmath.Uint, error) { - if p.Type != TYPE_GNFD_GROUP { + if p.Type != PRINCIPAL_TYPE_GNFD_GROUP { panic("principal type mismatch.") } @@ -65,23 +67,15 @@ func (p *Principal) GetGroupID() (sdkmath.Uint, error) { } func (p *Principal) MustGetAccountAddress() sdk.AccAddress { - if p.Type != TYPE_GNFD_ACCOUNT { - panic("principal type mismatch.") - } - - accAddr, err := sdk.AccAddressFromHexUnsafe(p.Value) + address, err := p.GetAccountAddress() if err != nil { panic(ErrInvalidPrincipal.Wrapf("Invalid account, principal: %s, err: %s", p.String(), err)) } - return accAddr + return address } func (p *Principal) MustGetGroupID() sdkmath.Uint { - if p.Type != TYPE_GNFD_GROUP { - panic("principal type mismatch.") - } - - groupID, err := sdkmath.ParseUint(p.Value) + groupID, err := p.GetGroupID() if err != nil { panic(ErrInvalidPrincipal.Wrapf("Invalid groupID, principal: %s, err: %s", p.String(), err)) } diff --git a/x/permission/types/common.pb.go b/x/permission/types/common.pb.go index bcf32e3b6..b882d89d7 100644 --- a/x/permission/types/common.pb.go +++ b/x/permission/types/common.pb.go @@ -33,47 +33,47 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ActionType int32 const ( - ACTION_UPDATE_BUCKET_INFO ActionType = 0 - ACTION_DELETE_BUCKET ActionType = 1 - ACTION_CREATE_OBJECT ActionType = 2 - ACTION_DELETE_OBJECT ActionType = 3 - ACTION_COPY_OBJECT ActionType = 4 - ACTION_GET_OBJECT ActionType = 5 - ACTION_EXECUTE_OBJECT ActionType = 6 - ACTION_LIST_OBJECT ActionType = 7 - ACTION_UPDATE_GROUP_MEMBER ActionType = 8 - ACTION_DELETE_GROUP ActionType = 9 - ACTION_GROUP_MEMBER ActionType = 10 + ACTION_UNSPECIFIED ActionType = 0 + ACTION_UPDATE_BUCKET_INFO ActionType = 1 + ACTION_DELETE_BUCKET ActionType = 2 + ACTION_CREATE_OBJECT ActionType = 3 + ACTION_DELETE_OBJECT ActionType = 4 + ACTION_COPY_OBJECT ActionType = 5 + ACTION_GET_OBJECT ActionType = 6 + ACTION_EXECUTE_OBJECT ActionType = 7 + ACTION_LIST_OBJECT ActionType = 8 + ACTION_UPDATE_GROUP_MEMBER ActionType = 9 + ACTION_DELETE_GROUP ActionType = 10 ACTION_TYPE_ALL ActionType = 99 ) var ActionType_name = map[int32]string{ - 0: "ACTION_UPDATE_BUCKET_INFO", - 1: "ACTION_DELETE_BUCKET", - 2: "ACTION_CREATE_OBJECT", - 3: "ACTION_DELETE_OBJECT", - 4: "ACTION_COPY_OBJECT", - 5: "ACTION_GET_OBJECT", - 6: "ACTION_EXECUTE_OBJECT", - 7: "ACTION_LIST_OBJECT", - 8: "ACTION_UPDATE_GROUP_MEMBER", - 9: "ACTION_DELETE_GROUP", - 10: "ACTION_GROUP_MEMBER", + 0: "ACTION_UNSPECIFIED", + 1: "ACTION_UPDATE_BUCKET_INFO", + 2: "ACTION_DELETE_BUCKET", + 3: "ACTION_CREATE_OBJECT", + 4: "ACTION_DELETE_OBJECT", + 5: "ACTION_COPY_OBJECT", + 6: "ACTION_GET_OBJECT", + 7: "ACTION_EXECUTE_OBJECT", + 8: "ACTION_LIST_OBJECT", + 9: "ACTION_UPDATE_GROUP_MEMBER", + 10: "ACTION_DELETE_GROUP", 99: "ACTION_TYPE_ALL", } var ActionType_value = map[string]int32{ - "ACTION_UPDATE_BUCKET_INFO": 0, - "ACTION_DELETE_BUCKET": 1, - "ACTION_CREATE_OBJECT": 2, - "ACTION_DELETE_OBJECT": 3, - "ACTION_COPY_OBJECT": 4, - "ACTION_GET_OBJECT": 5, - "ACTION_EXECUTE_OBJECT": 6, - "ACTION_LIST_OBJECT": 7, - "ACTION_UPDATE_GROUP_MEMBER": 8, - "ACTION_DELETE_GROUP": 9, - "ACTION_GROUP_MEMBER": 10, + "ACTION_UNSPECIFIED": 0, + "ACTION_UPDATE_BUCKET_INFO": 1, + "ACTION_DELETE_BUCKET": 2, + "ACTION_CREATE_OBJECT": 3, + "ACTION_DELETE_OBJECT": 4, + "ACTION_COPY_OBJECT": 5, + "ACTION_GET_OBJECT": 6, + "ACTION_EXECUTE_OBJECT": 7, + "ACTION_LIST_OBJECT": 8, + "ACTION_UPDATE_GROUP_MEMBER": 9, + "ACTION_DELETE_GROUP": 10, "ACTION_TYPE_ALL": 99, } @@ -89,22 +89,21 @@ func (ActionType) EnumDescriptor() ([]byte, []int) { type Effect int32 const ( - EFFECT_ALLOW Effect = 0 - EFFECT_DENY Effect = 1 - // Use internally, means skipped. there is no explicit ALLOW or DENY, and further permission checks are required. - EFFECT_PASS Effect = 2 + EFFECT_UNSPECIFIED Effect = 0 + EFFECT_ALLOW Effect = 1 + EFFECT_DENY Effect = 2 ) var Effect_name = map[int32]string{ - 0: "EFFECT_ALLOW", - 1: "EFFECT_DENY", - 2: "EFFECT_PASS", + 0: "EFFECT_UNSPECIFIED", + 1: "EFFECT_ALLOW", + 2: "EFFECT_DENY", } var Effect_value = map[string]int32{ - "EFFECT_ALLOW": 0, - "EFFECT_DENY": 1, - "EFFECT_PASS": 2, + "EFFECT_UNSPECIFIED": 0, + "EFFECT_ALLOW": 1, + "EFFECT_DENY": 2, } func (x Effect) String() string { @@ -115,22 +114,26 @@ func (Effect) EnumDescriptor() ([]byte, []int) { return fileDescriptor_33a4d646aee30990, []int{1} } +// PrincipalType refers to the identity type of system users or entities. +// In Greenfield, it usually refers to accounts or groups. type PrincipalType int32 const ( - // Reserved for extended use - TYPE_GNFD_ACCOUNT PrincipalType = 0 - TYPE_GNFD_GROUP PrincipalType = 1 + PRINCIPAL_TYPE_UNSPECIFIED PrincipalType = 0 + PRINCIPAL_TYPE_GNFD_ACCOUNT PrincipalType = 1 + PRINCIPAL_TYPE_GNFD_GROUP PrincipalType = 2 ) var PrincipalType_name = map[int32]string{ - 0: "TYPE_GNFD_ACCOUNT", - 1: "TYPE_GNFD_GROUP", + 0: "PRINCIPAL_TYPE_UNSPECIFIED", + 1: "PRINCIPAL_TYPE_GNFD_ACCOUNT", + 2: "PRINCIPAL_TYPE_GNFD_GROUP", } var PrincipalType_value = map[string]int32{ - "TYPE_GNFD_ACCOUNT": 0, - "TYPE_GNFD_GROUP": 1, + "PRINCIPAL_TYPE_UNSPECIFIED": 0, + "PRINCIPAL_TYPE_GNFD_ACCOUNT": 1, + "PRINCIPAL_TYPE_GNFD_GROUP": 2, } func (x PrincipalType) String() string { @@ -147,12 +150,14 @@ type Statement struct { // action_type define the operation type you can act. greenfield defines a set of permission // that you can specify in a permissionInfo. see ActionType enum for detail. Actions []ActionType `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=bnbchain.greenfield.permission.ActionType" json:"actions,omitempty"` - // resources define the resource list you can operate. // CAN ONLY USED IN bucket level. Support fuzzy match and limit to 5 + // If no sub-resource is specified in a statement, then all objects in the bucket are accessible by the principal. + // However, if the sub-resource is defined as 'bucket/test_*,' in the statement, then only objects with a 'test_' + // prefix can be accessed by the principal. Resources []string `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` - // expiration_time defines how long the permission is valid + // expiration_time defines how long the permission is valid. If not explicitly specified, it means it will not expire. ExpirationTime *time.Time `protobuf:"bytes,4,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` - // limit_size defines the total data size that is allowed to operate + // limit_size defines the total data size that is allowed to operate. If not explicitly specified, it means it will not limit. LimitSize *common.UInt64Value `protobuf:"bytes,5,opt,name=limit_size,json=limitSize,proto3" json:"limit_size,omitempty"` } @@ -193,7 +198,7 @@ func (m *Statement) GetEffect() Effect { if m != nil { return m.Effect } - return EFFECT_ALLOW + return EFFECT_UNSPECIFIED } func (m *Statement) GetActions() []ActionType { @@ -226,8 +231,10 @@ func (m *Statement) GetLimitSize() *common.UInt64Value { // Principal define the roles that can grant permissions. Currently, it can be account or group. type Principal struct { - Type PrincipalType `protobuf:"varint,1,opt,name=type,proto3,enum=bnbchain.greenfield.permission.PrincipalType" json:"type,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Type PrincipalType `protobuf:"varint,1,opt,name=type,proto3,enum=bnbchain.greenfield.permission.PrincipalType" json:"type,omitempty"` + // When the type is an account, its value is sdk.AccAddress().String(); + // when the type is a group, its value is math.Uint().String() + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } func (m *Principal) Reset() { *m = Principal{} } @@ -267,7 +274,7 @@ func (m *Principal) GetType() PrincipalType { if m != nil { return m.Type } - return TYPE_GNFD_ACCOUNT + return PRINCIPAL_TYPE_UNSPECIFIED } func (m *Principal) GetValue() string { @@ -290,48 +297,50 @@ func init() { } var fileDescriptor_33a4d646aee30990 = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xdd, 0x6e, 0x93, 0x50, - 0x1c, 0x87, 0xb6, 0xeb, 0xc6, 0x99, 0x6e, 0x78, 0xb6, 0x29, 0x6b, 0x94, 0x35, 0xbb, 0xd0, 0x66, - 0xc9, 0x20, 0xa9, 0xc6, 0x4b, 0x13, 0xa0, 0xa7, 0x4b, 0xb5, 0x2b, 0x0d, 0xa5, 0xea, 0xbc, 0x21, - 0xc0, 0x4e, 0xbb, 0x93, 0x14, 0x0e, 0x01, 0xaa, 0xdb, 0x9e, 0xc0, 0xcb, 0xbd, 0x83, 0x2f, 0xb3, - 0x0b, 0x2f, 0x76, 0xe9, 0x95, 0x9a, 0xed, 0x45, 0x0c, 0x1f, 0x2d, 0x6d, 0x34, 0xee, 0xae, 0xe7, - 0xf7, 0xc5, 0x9f, 0x1f, 0xff, 0x53, 0xb0, 0x3f, 0x0e, 0x31, 0xf6, 0x47, 0x04, 0x4f, 0x4e, 0xe5, - 0x00, 0x87, 0x1e, 0x89, 0x22, 0x42, 0x7d, 0xd9, 0xa5, 0x9e, 0x47, 0x7d, 0x29, 0x08, 0x69, 0x4c, - 0xa1, 0xe8, 0xf8, 0x8e, 0x7b, 0x66, 0x13, 0x5f, 0x2a, 0xc4, 0x52, 0x21, 0xae, 0xed, 0xba, 0x34, - 0xf2, 0x68, 0x64, 0xa5, 0x6a, 0x39, 0x3b, 0x64, 0xd6, 0xda, 0xf6, 0x98, 0x8e, 0x69, 0x86, 0x27, - 0xbf, 0x72, 0x74, 0x6f, 0x4c, 0xe9, 0x78, 0x82, 0xe5, 0xf4, 0xe4, 0x4c, 0x47, 0x72, 0x4c, 0x3c, - 0x1c, 0xc5, 0xb6, 0x17, 0xcc, 0x05, 0xc5, 0x54, 0xd9, 0x28, 0xf2, 0x97, 0xd0, 0x0e, 0x02, 0x1c, - 0x66, 0x82, 0xfd, 0xef, 0x25, 0xc0, 0x0d, 0x62, 0x3b, 0xc6, 0x1e, 0xf6, 0x63, 0xf8, 0x06, 0x54, - 0xf1, 0x68, 0x84, 0xdd, 0x58, 0x60, 0xeb, 0x6c, 0x63, 0xa3, 0xf9, 0x5c, 0xfa, 0xff, 0xc4, 0x12, - 0x4a, 0xd5, 0x46, 0xee, 0x82, 0x2d, 0xb0, 0x6a, 0xbb, 0x31, 0xa1, 0x7e, 0x24, 0x94, 0xea, 0xe5, - 0xc6, 0x46, 0xf3, 0xe0, 0xbe, 0x00, 0x25, 0x95, 0x9b, 0x17, 0x01, 0x36, 0x66, 0x56, 0xf8, 0x14, - 0x70, 0x21, 0x8e, 0xe8, 0x34, 0x74, 0x71, 0x24, 0x94, 0xeb, 0xe5, 0x06, 0x67, 0x14, 0x00, 0x3c, - 0x06, 0x9b, 0xf8, 0x3c, 0x20, 0xa1, 0x9d, 0x88, 0xad, 0xe4, 0x85, 0x85, 0x4a, 0x9d, 0x6d, 0xac, - 0x37, 0x6b, 0x52, 0xd6, 0x86, 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 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xac, 0x28, 0x46, 0x4d, 0x94, 0x04, 0x00, 0x00, + // 680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcd, 0x4e, 0xdb, 0x48, + 0x1c, 0x8f, 0x93, 0x10, 0xc8, 0xb0, 0x0b, 0xde, 0x01, 0x76, 0x4d, 0xb6, 0x75, 0x22, 0x0e, 0x6d, + 0x84, 0x84, 0x2d, 0xa5, 0x55, 0x8f, 0x95, 0x1c, 0x67, 0x82, 0xdc, 0x1a, 0xdb, 0x72, 0x9c, 0xb6, + 0xf4, 0x62, 0xd9, 0x66, 0x12, 0x46, 0x8a, 0x3f, 0x64, 0x3b, 0x2d, 0xf0, 0x04, 0x3d, 0xf2, 0x0e, + 0x7d, 0x98, 0x72, 0xe8, 0x81, 0x63, 0x4f, 0x6d, 0x05, 0x2f, 0x52, 0xf9, 0x23, 0x71, 0x42, 0x51, + 0xb9, 0x65, 0x7e, 0x5f, 0xf3, 0x9f, 0xdf, 0x4c, 0x0c, 0xf6, 0xc6, 0x21, 0xc6, 0xde, 0x88, 0xe0, + 0xc9, 0x09, 0x1f, 0xe0, 0xd0, 0x25, 0x51, 0x44, 0x7c, 0x8f, 0x77, 0x7c, 0xd7, 0xf5, 0x3d, 0x2e, + 0x08, 0xfd, 0xd8, 0x87, 0xac, 0xed, 0xd9, 0xce, 0xa9, 0x45, 0x3c, 0xae, 0x10, 0x73, 0x85, 0xb8, + 0xb1, 0xeb, 0xf8, 0x91, 0xeb, 0x47, 0x66, 0xaa, 0xe6, 0xb3, 0x45, 0x66, 0x6d, 0x6c, 0x8f, 0xfd, + 0xb1, 0x9f, 0xe1, 0xc9, 0xaf, 0x1c, 0x6d, 0x8e, 0x7d, 0x7f, 0x3c, 0xc1, 0x7c, 0xba, 0xb2, 0xa7, + 0x23, 0x3e, 0x26, 0x2e, 0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 0xf4, 0x99, 0x2d, 0xed, 0x4b, 0xa0, 0x96, 0x3d, 0xe1, 0x64, 0x57, 0xd4, 0xef, 0x23, + 0xd1, 0xb8, 0x53, 0x22, 0x0d, 0xfe, 0xca, 0x71, 0x41, 0x96, 0xd5, 0xb7, 0x34, 0x05, 0x37, 0xc1, + 0x7a, 0x8e, 0xf4, 0x90, 0x72, 0x4c, 0x97, 0xf3, 0xa8, 0x29, 0xf8, 0x7b, 0xe9, 0x06, 0x93, 0x79, + 0x35, 0x5d, 0x52, 0x44, 0x49, 0x13, 0xe4, 0x6c, 0xe7, 0xe5, 0xe4, 0x26, 0xf8, 0xff, 0x0e, 0x7f, + 0xa8, 0xf4, 0x7b, 0xa6, 0x20, 0x8a, 0xea, 0x50, 0x31, 0x68, 0x2a, 0xb9, 0xbf, 0xfb, 0x04, 0xd9, + 0xb1, 0xf2, 0x6d, 0xbb, 0xf2, 0xd5, 0x0d, 0x4b, 0x5d, 0xdf, 0xb0, 0xd4, 0xcf, 0x1b, 0x96, 0xba, + 0xbc, 0x65, 0x4b, 0xd7, 0xb7, 0x6c, 0xe9, 0xdb, 0x2d, 0x5b, 0x7a, 0xdf, 0x19, 0x93, 0xf8, 0x74, + 0x6a, 0x27, 0xef, 0x96, 0xb7, 0x3d, 0xfb, 0x20, 0x7d, 0x7b, 0xfc, 0xc2, 0x07, 0xe1, 0x6c, 0xf1, + 0x43, 0x95, 0x3c, 0xb7, 0xc8, 0xae, 0xa5, 0xff, 0x9d, 0x67, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x6f, 0x40, 0x3b, 0x5b, 0xce, 0x04, 0x00, 0x00, } func (m *Statement) Marshal() (dAtA []byte, err error) { diff --git a/x/permission/types/events.pb.go b/x/permission/types/events.pb.go index 43c428665..8560f168d 100644 --- a/x/permission/types/events.pb.go +++ b/x/permission/types/events.pb.go @@ -82,7 +82,7 @@ func (m *EventPutPolicy) GetResourceType() resource.ResourceType { if m != nil { return m.ResourceType } - return resource.RESOURCE_TYPE_BUCKET + return resource.RESOURCE_TYPE_UNSPECIFIED } func (m *EventPutPolicy) GetStatements() []*Statement { diff --git a/x/permission/types/keys.go b/x/permission/types/keys.go index e349ec0bd..f2907d276 100644 --- a/x/permission/types/keys.go +++ b/x/permission/types/keys.go @@ -29,59 +29,56 @@ var ( BucketPolicyForAccountPrefix = []byte{0x11} ObjectPolicyForAccountPrefix = []byte{0x12} GroupPolicyForAccountPrefix = []byte{0x13} + GroupMemberPrefix = []byte{0x14} BucketPolicyForGroupPrefix = []byte{0x21} ObjectPolicyForGroupPrefix = []byte{0x22} - PolicyByIDPrefix = []byte{0x31} + PolicyByIDPrefix = []byte{0x31} + GroupMemberByIDPrefix = []byte{0x32} - PolicySequencePrefix = []byte{0x41} + PolicySequencePrefix = []byte{0x41} + GroupMemberSequencePrefix = []byte{0x42} ) func GetPolicyForAccountKey(resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) []byte { + var key []byte switch resourceType { case resource.RESOURCE_TYPE_BUCKET: - return GetBucketPolicyForAccountKey(resourceID, addr) + key = BucketPolicyForAccountPrefix case resource.RESOURCE_TYPE_OBJECT: - return GetObjectPolicyForAccountKey(resourceID, addr) + key = ObjectPolicyForAccountPrefix case resource.RESOURCE_TYPE_GROUP: - return GetGroupPolicyForAccountKey(resourceID, addr) + key = GroupPolicyForAccountPrefix default: return nil } -} - -func GetBucketPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(BucketPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) -} - -func GetObjectPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(ObjectPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) -} - -func GetGroupPolicyForAccountKey(resourceID math.Uint, addr sdk.AccAddress) []byte { - return append(GroupPolicyForAccountPrefix, append(resourceID.Bytes(), addr.Bytes()...)...) + key = append(key, resourceID.Bytes()...) + key = append(key, addr.Bytes()...) + return key } func GetPolicyForGroupKey(resourceID math.Uint, resourceType resource.ResourceType) []byte { + var key []byte switch resourceType { case resource.RESOURCE_TYPE_BUCKET: - return GetBucketPolicyForGroupKey(resourceID) + key = BucketPolicyForGroupPrefix case resource.RESOURCE_TYPE_OBJECT: - return GetObjectPolicyForGroupKey(resourceID) + key = ObjectPolicyForGroupPrefix default: return nil } + key = append(key, resourceID.Bytes()...) + return key } -func GetBucketPolicyForGroupKey(resourceID math.Uint) []byte { - return append(BucketPolicyForGroupPrefix, resourceID.Bytes()...) +func GetPolicyByIDKey(policyID math.Uint) []byte { + return append(PolicyByIDPrefix, policyID.Bytes()...) } -func GetObjectPolicyForGroupKey(resourceID math.Uint) []byte { - return append(ObjectPolicyForGroupPrefix, resourceID.Bytes()...) +func GetGroupMemberKey(groupID math.Uint, member sdk.AccAddress) []byte { + return append(GroupMemberPrefix, append(groupID.Bytes(), member.Bytes()...)...) } - -func GetPolicyByIDKey(policyID math.Uint) []byte { - return append(PolicyByIDPrefix, policyID.Bytes()...) +func GetGroupMemberByIDKey(memberID math.Uint) []byte { + return append(GroupMemberByIDPrefix, memberID.Bytes()...) } diff --git a/x/permission/types/params.pb.go b/x/permission/types/params.pb.go index d6f797d51..a1f0dba27 100644 --- a/x/permission/types/params.pb.go +++ b/x/permission/types/params.pb.go @@ -25,8 +25,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // maximum_statements_num defines the maximum number of statements allowed in a policy MaximumStatementsNum uint64 `protobuf:"varint,1,opt,name=maximum_statements_num,json=maximumStatementsNum,proto3" json:"maximum_statements_num,omitempty"` - MaximumGroupNum uint64 `protobuf:"varint,2,opt,name=maximum_group_num,json=maximumGroupNum,proto3" json:"maximum_group_num,omitempty"` + // maximum_group_num used to set the upper limit on the number of groups to which a resource can grant access permissions. + // By placing a cap on the number of group permissions, permission control policies can be made more robust and better + // enforced, thereby reducing the chances of DDos and other security incidents. + MaximumGroupNum uint64 `protobuf:"varint,2,opt,name=maximum_group_num,json=maximumGroupNum,proto3" json:"maximum_group_num,omitempty"` } func (m *Params) Reset() { *m = Params{} } diff --git a/x/permission/types/policy_test.go b/x/permission/types/policy_test.go index 29863b749..e97e1e728 100644 --- a/x/permission/types/policy_test.go +++ b/x/permission/types/policy_test.go @@ -49,7 +49,7 @@ func TestPolicy_BucketBasic(t *testing.T) { policyAction: types.ACTION_UPDATE_BUCKET_INFO, policyEffect: types.EFFECT_ALLOW, operateAction: types.ACTION_DELETE_BUCKET, - expectEffect: types.EFFECT_PASS, + expectEffect: types.EFFECT_UNSPECIFIED, }, { name: "basic_create_object", @@ -70,7 +70,7 @@ func TestPolicy_BucketBasic(t *testing.T) { policyAction: types.ACTION_COPY_OBJECT, policyEffect: types.EFFECT_ALLOW, operateAction: types.ACTION_CREATE_OBJECT, - expectEffect: types.EFFECT_PASS, + expectEffect: types.EFFECT_UNSPECIFIED, }, { name: "basic_delete_object", @@ -126,7 +126,7 @@ func TestPolicy_BucketExpirationBasic(t *testing.T) { policyEffect: types.EFFECT_ALLOW, policyExpirationTime: &now, operateAction: types.ACTION_UPDATE_BUCKET_INFO, - expectEffect: types.EFFECT_PASS, + expectEffect: types.EFFECT_UNSPECIFIED, operateTime: time.Now().Add(time.Duration(1 * time.Second)), }, { @@ -144,7 +144,7 @@ func TestPolicy_BucketExpirationBasic(t *testing.T) { policyEffect: types.EFFECT_ALLOW, statementExpirationTime: &now, operateAction: types.ACTION_UPDATE_BUCKET_INFO, - expectEffect: types.EFFECT_PASS, + expectEffect: types.EFFECT_UNSPECIFIED, operateTime: time.Now().Add(time.Duration(1 * time.Second)), }, { @@ -261,7 +261,7 @@ func TestPolicy_SubResource(t *testing.T) { policyResource: types2.NewObjectGRN(bucketName, "xxx").String(), operateAction: types.ACTION_GET_OBJECT, operateResource: types2.NewObjectGRN(bucketName, "1111").String(), - expectEffect: types.EFFECT_PASS, + expectEffect: types.EFFECT_UNSPECIFIED, }, } diff --git a/x/permission/types/types.go b/x/permission/types/types.go index 1983b3eed..b13985b39 100644 --- a/x/permission/types/types.go +++ b/x/permission/types/types.go @@ -5,8 +5,6 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - gnfd "github.com/bnb-chain/greenfield/types" "github.com/bnb-chain/greenfield/types/common" "github.com/bnb-chain/greenfield/types/resource" @@ -54,20 +52,11 @@ var ( } ) -func NewDefaultPolicyForGroupMember(groupID math.Uint, member sdk.AccAddress) *Policy { - return &Policy{ - Principal: NewPrincipalWithAccount(member), - ResourceType: resource.RESOURCE_TYPE_GROUP, - ResourceId: groupID, - MemberStatement: NewMemberStatement(), - } -} - func (p *Policy) Eval(action ActionType, blockTime time.Time, opts *VerifyOptions) (Effect, *Policy) { - // 1. the policy is expired, need delete + // 1. check if the policy is expired if p.ExpirationTime != nil && p.ExpirationTime.Before(blockTime) { // Notice: We do not actively delete policies that expire for users. - return EFFECT_PASS, nil + return EFFECT_UNSPECIFIED, nil } allowed := false updated := false @@ -95,25 +84,14 @@ func (p *Policy) Eval(action ActionType, blockTime time.Time, opts *VerifyOption return EFFECT_ALLOW, nil } } - return EFFECT_PASS, nil -} - -func (p *Policy) GetGroupMemberStatement() (*Statement, bool) { - for _, s := range p.Statements { - for _, act := range s.Actions { - if act == ACTION_GROUP_MEMBER { - return s, true - } - } - } - return nil, false + return EFFECT_UNSPECIFIED, nil } func NewMemberStatement() *Statement { return &Statement{ Effect: EFFECT_ALLOW, Resources: nil, - Actions: []ActionType{ACTION_GROUP_MEMBER}, + Actions: nil, } } @@ -121,7 +99,7 @@ func (s *Statement) Eval(action ActionType, opts *VerifyOptions) (Effect, *State // If 'resource' is not nil, it implies that the user intends to access a sub-resource, which would // be specified in 's.Resources'. Therefore, if the sub-resource in the statement is nil, we will ignore this statement. if opts != nil && opts.Resource != "" && s.Resources == nil { - return EFFECT_PASS, nil + return EFFECT_UNSPECIFIED, nil } // If 'resource' is not nil, and 's.Resource' is also not nil, it indicates that we should verify whether // the resource that the user intends to access matches any items in 's.Resource' @@ -139,7 +117,7 @@ func (s *Statement) Eval(action ActionType, opts *VerifyOptions) (Effect, *State } } if !isMatch { - return EFFECT_PASS, nil + return EFFECT_UNSPECIFIED, nil } } @@ -164,14 +142,16 @@ func (s *Statement) Eval(action ActionType, opts *VerifyOptions) (Effect, *State } } - return EFFECT_PASS, nil + return EFFECT_UNSPECIFIED, nil } func (s *Statement) ValidateBasic(resType resource.ResourceType) error { - if s.Effect == EFFECT_PASS { - return ErrInvalidStatement.Wrap("Not allowed to set EFFECT_PASS.") + if s.Effect == EFFECT_UNSPECIFIED { + return ErrInvalidStatement.Wrap("Please specify the Effect explicitly. Not allowed set EFFECT_UNSPECIFIED") } switch resType { + case resource.RESOURCE_TYPE_UNSPECIFIED: + return ErrInvalidStatement.Wrap("Please specify the ResourceType explicitly. Not allowed set RESOURCE_TYPE_UNSPECIFIED") case resource.RESOURCE_TYPE_BUCKET: containsCreateObject := false for _, a := range s.Actions { @@ -211,6 +191,8 @@ func (s *Statement) ValidateBasic(resType resource.ResourceType) error { if s.LimitSize != nil { return ErrInvalidStatement.Wrap("The LimitSize option can only be used with CreateObject actions at the bucket level. ") } + default: + return ErrInvalidStatement.Wrap("unknown resource type.") } return nil diff --git a/x/permission/types/types.pb.go b/x/permission/types/types.pb.go index 26e5802b4..8f721618c 100644 --- a/x/permission/types/types.pb.go +++ b/x/permission/types/types.pb.go @@ -43,8 +43,6 @@ type Policy struct { // expiration_time defines the whole expiration time of all the statements. // Notices: Its priority is higher than the expiration time inside the Statement ExpirationTime *time.Time `protobuf:"bytes,6,opt,name=expiration_time,json=expirationTime,proto3,stdtime" json:"expiration_time,omitempty"` - // member_statement defines a special policy which indicates that the principal is a member of the group - MemberStatement *Statement `protobuf:"bytes,7,opt,name=member_statement,json=memberStatement,proto3" json:"member_statement,omitempty"` } func (m *Policy) Reset() { *m = Policy{} } @@ -91,7 +89,7 @@ func (m *Policy) GetResourceType() resource.ResourceType { if m != nil { return m.ResourceType } - return resource.RESOURCE_TYPE_BUCKET + return resource.RESOURCE_TYPE_UNSPECIFIED } func (m *Policy) GetStatements() []*Statement { @@ -108,13 +106,6 @@ func (m *Policy) GetExpirationTime() *time.Time { return nil } -func (m *Policy) GetMemberStatement() *Statement { - if m != nil { - return m.MemberStatement - } - return nil -} - // PolicyGroup refers to a group of policies which grant permission to Group, which is limited to MaxGroupNum (default 10). // This means that a single resource can only grant permission to 10 groups. The reason for // this is to enable on-chain determination of whether an operator has permission within a limited time. @@ -201,48 +192,99 @@ func (m *PolicyGroup_Item) XXX_DiscardUnknown() { var xxx_messageInfo_PolicyGroup_Item proto.InternalMessageInfo +type GroupMember struct { + // id is an unique u256 sequence for each group member. It also be used as NFT tokenID + Id Uint `protobuf:"bytes,1,opt,name=id,proto3,customtype=Uint" json:"id"` + // group_id is the unique id of the group + GroupId Uint `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3,customtype=Uint" json:"group_id"` + // member is the account address of the member + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` +} + +func (m *GroupMember) Reset() { *m = GroupMember{} } +func (m *GroupMember) String() string { return proto.CompactTextString(m) } +func (*GroupMember) ProtoMessage() {} +func (*GroupMember) Descriptor() ([]byte, []int) { + return fileDescriptor_0d2afeea9f743f03, []int{2} +} +func (m *GroupMember) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GroupMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GroupMember.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 *GroupMember) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupMember.Merge(m, src) +} +func (m *GroupMember) XXX_Size() int { + return m.Size() +} +func (m *GroupMember) XXX_DiscardUnknown() { + xxx_messageInfo_GroupMember.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupMember proto.InternalMessageInfo + +func (m *GroupMember) GetMember() string { + if m != nil { + return m.Member + } + return "" +} + func init() { proto.RegisterType((*Policy)(nil), "bnbchain.greenfield.permission.Policy") proto.RegisterType((*PolicyGroup)(nil), "bnbchain.greenfield.permission.PolicyGroup") proto.RegisterType((*PolicyGroup_Item)(nil), "bnbchain.greenfield.permission.PolicyGroup.Item") + proto.RegisterType((*GroupMember)(nil), "bnbchain.greenfield.permission.GroupMember") } func init() { proto.RegisterFile("greenfield/permission/types.proto", fileDescriptor_0d2afeea9f743f03) } var fileDescriptor_0d2afeea9f743f03 = []byte{ - // 499 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x8a, 0x13, 0x4d, - 0x14, 0x4d, 0x25, 0x99, 0x4c, 0x52, 0xf9, 0xbe, 0x19, 0x29, 0x5c, 0xb4, 0x11, 0xba, 0x63, 0x56, - 0x51, 0x99, 0x6a, 0x89, 0x20, 0x2e, 0x5c, 0x65, 0xe1, 0xd0, 0xa0, 0x38, 0xb4, 0x71, 0xe3, 0xa6, - 0xe9, 0x9f, 0x9a, 0x9e, 0x82, 0xd4, 0x0f, 0x55, 0x15, 0x48, 0xde, 0x62, 0x1e, 0xc6, 0x87, 0xc8, - 0xce, 0xc1, 0x95, 0xb8, 0x88, 0x92, 0x3c, 0x87, 0x20, 0xdd, 0x9d, 0x4e, 0x07, 0x1c, 0x4c, 0x76, - 0x75, 0x6f, 0x9f, 0x73, 0xfa, 0xdc, 0x7b, 0xaa, 0xe0, 0x93, 0x54, 0x11, 0xc2, 0xaf, 0x29, 0x99, - 0x26, 0xae, 0x24, 0x8a, 0x51, 0xad, 0xa9, 0xe0, 0xae, 0x59, 0x48, 0xa2, 0xb1, 0x54, 0xc2, 0x08, - 0x64, 0x47, 0x3c, 0x8a, 0x6f, 0x42, 0xca, 0x71, 0x85, 0xc5, 0x15, 0xb6, 0xf7, 0x28,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, 0xff, 0x24, 0x20, 0x90, 0xc0, 0x02, - 0x04, 0x00, 0x00, + // 525 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6f, 0x12, 0x41, + 0x18, 0xc6, 0x19, 0xa0, 0x08, 0x83, 0xd6, 0x64, 0xd2, 0xc3, 0x8a, 0xc9, 0x82, 0x9c, 0x50, 0xc3, + 0x6c, 0x83, 0x89, 0xf1, 0xe0, 0x45, 0x0e, 0x36, 0x24, 0x36, 0x36, 0xdb, 0x7a, 0xf1, 0x42, 0xd8, + 0xdd, 0xe9, 0x76, 0x12, 0xe6, 0x4f, 0x66, 0x86, 0x04, 0xbe, 0x45, 0x3f, 0x84, 0x89, 0x5f, 0xa0, + 0x1f, 0x82, 0x9b, 0x4d, 0x4f, 0xc6, 0x03, 0x1a, 0xf8, 0x22, 0x66, 0x67, 0x77, 0xbb, 0x24, 0x36, + 0x52, 0xbd, 0xcd, 0x3b, 0xfc, 0x9e, 0x77, 0x9e, 0x79, 0x9f, 0x61, 0xe1, 0xb3, 0x58, 0x11, 0xc2, + 0xcf, 0x29, 0x99, 0x46, 0x9e, 0x24, 0x8a, 0x51, 0xad, 0xa9, 0xe0, 0x9e, 0x59, 0x48, 0xa2, 0xb1, + 0x54, 0xc2, 0x08, 0xe4, 0x06, 0x3c, 0x08, 0x2f, 0x26, 0x94, 0xe3, 0x82, 0xc5, 0x05, 0xdb, 0x7a, + 0x12, 0x0a, 0xcd, 0x84, 0x1e, 0x5b, 0xda, 0x4b, 0x8b, 0x54, 0xda, 0x3a, 0x88, 0x45, 0x2c, 0xd2, + 0xfd, 0x64, 0x95, 0xed, 0xb6, 0x63, 0x21, 0xe2, 0x29, 0xf1, 0x6c, 0x15, 0xcc, 0xce, 0x3d, 0x43, + 0x19, 0xd1, 0x66, 0xc2, 0x64, 0x06, 0x74, 0xef, 0x36, 0x15, 0x0a, 0xc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 0x38, 0xf9, 0xb9, 0xfb, 0x0d, 0xc0, 0x66, 0x9a, 0xd4, 0x91, 0x12, 0x33, 0x89, 0xde, 0xc3, + 0x3d, 0x6a, 0x08, 0xd3, 0x0e, 0xb0, 0x26, 0x0f, 0x77, 0x4e, 0xbf, 0xd0, 0xe2, 0x91, 0x21, 0xcc, + 0x4f, 0xe5, 0xad, 0x39, 0xac, 0x26, 0x25, 0x7a, 0x03, 0x1b, 0xd2, 0x22, 0xe3, 0xfb, 0xbd, 0x82, + 0x7a, 0x4a, 0x8f, 0x22, 0xf4, 0x1a, 0xd6, 0xe3, 0xa4, 0x6d, 0x22, 0x2c, 0xef, 0x16, 0x3e, 0xb0, + 0xf0, 0x28, 0xea, 0x7e, 0x01, 0xb0, 0x69, 0xfd, 0x1c, 0x13, 0x16, 0x10, 0xf5, 0x6f, 0x0f, 0xf0, + 0x3f, 0x0f, 0x45, 0x87, 0xb0, 0xc6, 0xec, 0x71, 0xf6, 0xa1, 0x35, 0x86, 0xce, 0xcd, 0x55, 0xff, + 0x20, 0x23, 0xdf, 0x45, 0x91, 0x22, 0x5a, 0x9f, 0x1a, 0x45, 0x79, 0xec, 0x67, 0xdc, 0xf0, 0xc3, + 0x72, 0xed, 0x82, 0xeb, 0xb5, 0x0b, 0x7e, 0xad, 0x5d, 0x70, 0xb9, 0x71, 0x4b, 0xd7, 0x1b, 0xb7, + 0xf4, 0x7d, 0xe3, 0x96, 0x3e, 0x0f, 0x62, 0x6a, 0x2e, 0x66, 0x01, 0x0e, 0x05, 0xf3, 0x02, 0x1e, + 0xf4, 0xed, 0xf8, 0xbd, 0xad, 0xbf, 0xdc, 0xfc, 0x8f, 0xaf, 0x45, 0x50, 0xb3, 0xa1, 0xbf, 0xfa, + 0x1d, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x06, 0x51, 0x68, 0x53, 0x04, 0x00, 0x00, } func (m *Policy) Marshal() (dAtA []byte, err error) { @@ -265,25 +307,13 @@ func (m *Policy) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MemberStatement != nil { - { - size, err := m.MemberStatement.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } if m.ExpirationTime != nil { - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpirationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpirationTime):]) - if err2 != nil { - return 0, err2 + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ExpirationTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpirationTime):]) + if err1 != nil { + return 0, err1 } - i -= n2 - i = encodeVarintTypes(dAtA, i, uint64(n2)) + i -= n1 + i = encodeVarintTypes(dAtA, i, uint64(n1)) i-- dAtA[i] = 0x32 } @@ -421,6 +451,56 @@ func (m *PolicyGroup_Item) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GroupMember) 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 *GroupMember) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Member) > 0 { + i -= len(m.Member) + copy(dAtA[i:], m.Member) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Member))) + i-- + dAtA[i] = 0x1a + } + { + size := m.GroupId.Size() + i -= size + if _, err := m.GroupId.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Id.Size() + i -= size + if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -459,10 +539,6 @@ func (m *Policy) Size() (n int) { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.ExpirationTime) n += 1 + l + sovTypes(uint64(l)) } - if m.MemberStatement != nil { - l = m.MemberStatement.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -494,6 +570,23 @@ func (m *PolicyGroup_Item) Size() (n int) { return n } +func (m *GroupMember) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Id.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.GroupId.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Member) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -722,9 +815,59 @@ func (m *Policy) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PolicyGroup) 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 ErrIntOverflowTypes + } + 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: PolicyGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PolicyGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MemberStatement", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -751,10 +894,8 @@ func (m *Policy) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MemberStatement == nil { - m.MemberStatement = &Statement{} - } - if err := m.MemberStatement.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, &PolicyGroup_Item{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -779,7 +920,7 @@ func (m *Policy) Unmarshal(dAtA []byte) error { } return nil } -func (m *PolicyGroup) Unmarshal(dAtA []byte) error { +func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -802,17 +943,17 @@ func (m *PolicyGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PolicyGroup: wiretype end group for non-group") + return fmt.Errorf("proto: Item: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PolicyGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Item: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PolicyId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -822,23 +963,57 @@ func (m *PolicyGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, &PolicyGroup_Item{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PolicyId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GroupId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -863,7 +1038,7 @@ func (m *PolicyGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error { +func (m *GroupMember) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -886,15 +1061,15 @@ func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Item: wiretype end group for non-group") + return fmt.Errorf("proto: GroupMember: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Item: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GroupMember: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PolicyId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -922,7 +1097,7 @@ func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PolicyId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -960,6 +1135,38 @@ func (m *PolicyGroup_Item) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Member", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Member = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/x/sp/module_simulation.go b/x/sp/module_simulation.go index 9276097e8..72daeb62a 100644 --- a/x/sp/module_simulation.go +++ b/x/sp/module_simulation.go @@ -25,19 +25,7 @@ var ( ) const ( - opWeightMsgCreateStorageProvider = "op_weight_msg_create_storage_provider" - // TODO: Determine the simulation weight value - defaultWeightMsgCreateStorageProvider int = 100 - - opWeightMsgDeposit = "op_weight_msg_deposit" - // TODO: Determine the simulation weight value - defaultWeightMsgDeposit int = 100 - - opWeightMsgEditStorageProvider = "op_weight_msg_edit_storage_provider" - // TODO: Determine the simulation weight value - defaultWeightMsgEditStorageProvider int = 100 - - // this line is used by starport scaffolding # simapp/module/const +// this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module @@ -70,41 +58,6 @@ func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgCreateStorageProvider int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCreateStorageProvider, &weightMsgCreateStorageProvider, nil, - func(_ *rand.Rand) { - weightMsgCreateStorageProvider = defaultWeightMsgCreateStorageProvider - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCreateStorageProvider, - spsimulation.SimulateMsgCreateStorageProvider(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDeposit int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDeposit, &weightMsgDeposit, nil, - func(_ *rand.Rand) { - weightMsgDeposit = defaultWeightMsgDeposit - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDeposit, - spsimulation.SimulateMsgDeposit(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgEditStorageProvider int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgEditStorageProvider, &weightMsgEditStorageProvider, nil, - func(_ *rand.Rand) { - weightMsgEditStorageProvider = defaultWeightMsgEditStorageProvider - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgEditStorageProvider, - spsimulation.SimulateMsgEditStorageProvider(am.accountKeeper, am.bankKeeper, am.keeper), - )) - // this line is used by starport scaffolding # simapp/module/operation - return operations } diff --git a/x/sp/simulation/operations.go b/x/sp/simulation/operations.go deleted file mode 100644 index c65e0f815..000000000 --- a/x/sp/simulation/operations.go +++ /dev/null @@ -1,69 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/bnb-chain/greenfield/x/sp/keeper" - "github.com/bnb-chain/greenfield/x/sp/types" -) - -// SimulateMsgCreateStorageProvider generates a MsgCreateStorageProvider with random values -func SimulateMsgCreateStorageProvider( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateStorageProvider{ - Creator: simAccount.Address.String(), - } - - // TODO: Handling the CreateStorageProvider simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateStorageProvider simulation not implemented"), nil, nil - } -} - -// SimulateMsgEditStorageProvider generates a MsgEditStorageProvider with random values -func SimulateMsgEditStorageProvider( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgEditStorageProvider{ - SpAddress: simAccount.Address.String(), - } - - // TODO: Handling the EditStorageProvider simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "EditStorageProvider simulation not implemented"), nil, nil - } -} - -// SimulateMsgDeposit generates a MsgStaking with random values -func SimulateMsgDeposit( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDeposit{ - Creator: simAccount.Address.String(), - } - - // TODO: Handling the Deposit simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "Deposit simulation not implemented"), nil, nil - } -} diff --git a/x/sp/simulation/operations_test.go b/x/sp/simulation/operations_test.go deleted file mode 100644 index 5c6452f9a..000000000 --- a/x/sp/simulation/operations_test.go +++ /dev/null @@ -1 +0,0 @@ -package simulation_test diff --git a/x/sp/types/message.go b/x/sp/types/message.go index 20735f94a..54d21dace 100644 --- a/x/sp/types/message.go +++ b/x/sp/types/message.go @@ -99,7 +99,6 @@ func (msg *MsgCreateStorageProvider) ValidateBasic() error { } // NewMsgEditStorageProvider creates a new MsgEditStorageProvider instance -// TODO(fynn): add morer modifiable items if needed. func NewMsgEditStorageProvider(spAddress sdk.AccAddress, endpoint string, description Description) *MsgEditStorageProvider { return &MsgEditStorageProvider{ SpAddress: spAddress.String(), diff --git a/x/sp/types/types.pb.go b/x/sp/types/types.pb.go index db3718c59..91c97d992 100644 --- a/x/sp/types/types.pb.go +++ b/x/sp/types/types.pb.go @@ -140,8 +140,6 @@ func (m *Description) GetDetails() string { } // StorageProvider defines the meta info of storage provider -// TODO: add endpoint for RPC/HTTP/Websocket and p2p identity -// TODO: add more account address for different role. type StorageProvider struct { // operator_address defines the account address of the storage provider's operator; It also is the unique index key of sp. OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` diff --git a/x/storage/client/cli/tx.go b/x/storage/client/cli/tx.go index 144acbbea..6655a31de 100644 --- a/x/storage/client/cli/tx.go +++ b/x/storage/client/cli/tx.go @@ -530,6 +530,7 @@ func CmdUpdateGroupMember() *cobra.Command { memberAddrsToDelete = append(memberAddrsToDelete, memberAddr) } msg := types.NewMsgUpdateGroupMember( + clientCtx.GetFromAddress(), clientCtx.GetFromAddress(), argGroupName, memberAddrsToAdd, diff --git a/x/storage/keeper/cross_app_group.go b/x/storage/keeper/cross_app_group.go index e9835fe97..e6c1754f0 100644 --- a/x/storage/keeper/cross_app_group.go +++ b/x/storage/keeper/cross_app_group.go @@ -359,7 +359,7 @@ func (app *GroupApp) handleUpdateGroupMemberSynPackage(ctx sdk.Context, header * err = app.storageKeeper.UpdateGroupMember( ctx, updateGroupPackage.Operator, - groupInfo.GroupName, + groupInfo, options, ) if err != nil { diff --git a/x/storage/keeper/keeper.go b/x/storage/keeper/keeper.go index e6b648464..26a9a7b62 100644 --- a/x/storage/keeper/keeper.go +++ b/x/storage/keeper/keeper.go @@ -457,7 +457,7 @@ func (k Keeper) SealObject( } if objectInfo.ObjectStatus != types.OBJECT_STATUS_CREATED { - return types.ErrObjectAlreadyExists + return types.ErrObjectAlreadySealed } // check the signature of secondary sps @@ -516,7 +516,7 @@ func (k Keeper) CancelCreateObject( } if objectInfo.ObjectStatus != types.OBJECT_STATUS_CREATED { - return types.ErrObjectNotInit + return types.ErrObjectNotCreated.Wrapf("Object status: %s", objectInfo.ObjectStatus.String()) } if objectInfo.SourceType != opts.SourceType { @@ -568,7 +568,7 @@ func (k Keeper) DeleteObject( } if objectInfo.ObjectStatus != types.OBJECT_STATUS_SEALED { - return types.ErrObjectNotInService + return types.ErrObjectNotSealed } // check permission @@ -700,7 +700,7 @@ func (k Keeper) RejectSealObject(ctx sdk.Context, operator sdk.AccAddress, bucke } if objectInfo.ObjectStatus != types.OBJECT_STATUS_CREATED { - return types.ErrObjectNotInit + return types.ErrObjectNotCreated.Wrapf("Object status: %s", objectInfo.ObjectStatus.String()) } sp, found := k.spKeeper.GetStorageProviderBySealAddr(ctx, operator) @@ -749,8 +749,14 @@ func (k Keeper) CreateGroup( GroupName: groupName, } + // Can not create a group with the same name. + groupKey := types.GetGroupKey(owner, groupName) + if store.Has(groupKey) { + return sdkmath.ZeroUint(), types.ErrGroupAlreadyExists + } + gbz := k.cdc.MustMarshal(&groupInfo) - store.Set(types.GetGroupKey(owner, groupName), sequence.EncodeSequence(groupInfo.Id)) + store.Set(groupKey, sequence.EncodeSequence(groupInfo.Id)) store.Set(types.GetGroupByIDKey(groupInfo.Id), gbz) // need to limit the size of Msg.Members to avoid taking too long to execute the msg @@ -856,7 +862,10 @@ func (k Keeper) LeaveGroup( } // Note: Delete group does not require the group is empty. The group member will be deleted by on-chain GC. - k.permKeeper.RemoveGroupMember(ctx, groupInfo.Id, member) + err := k.permKeeper.RemoveGroupMember(ctx, groupInfo.Id, member) + if err != nil { + return err + } if err := ctx.EventManager().EmitTypedEvents(&types.EventDeleteGroup{ OwnerAddress: groupInfo.Owner, @@ -868,11 +877,7 @@ func (k Keeper) LeaveGroup( return nil } -func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, groupName string, opts UpdateGroupMemberOptions) error { - groupInfo, found := k.GetGroupInfo(ctx, operator, groupName) - if !found { - return types.ErrNoSuchGroup - } +func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, groupInfo *types.GroupInfo, opts UpdateGroupMemberOptions) error { if groupInfo.SourceType != opts.SourceType { return types.ErrSourceTypeMismatch } @@ -901,7 +906,10 @@ func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, grou if err != nil { return err } - k.permKeeper.RemoveGroupMember(ctx, groupInfo.Id, memberAcc) + err = k.permKeeper.RemoveGroupMember(ctx, groupInfo.Id, memberAcc) + if err != nil { + return err + } } if err := ctx.EventManager().EmitTypedEvents(&types.EventUpdateGroupMember{ diff --git a/x/storage/keeper/msg_server.go b/x/storage/keeper/msg_server.go index 847fea691..33e98f249 100644 --- a/x/storage/keeper/msg_server.go +++ b/x/storage/keeper/msg_server.go @@ -243,7 +243,13 @@ func (k msgServer) UpdateGroupMember(goCtx context.Context, msg *types.MsgUpdate operator := sdk.MustAccAddressFromHex(msg.Operator) - err := k.Keeper.UpdateGroupMember(ctx, operator, msg.GroupName, UpdateGroupMemberOptions{ + groupOwner := sdk.MustAccAddressFromHex(msg.GroupOwner) + + groupInfo, found := k.GetGroupInfo(ctx, groupOwner, msg.GroupName) + if !found { + return nil, types.ErrNoSuchGroup + } + err := k.Keeper.UpdateGroupMember(ctx, operator, groupInfo, UpdateGroupMemberOptions{ SourceType: types.SOURCE_TYPE_ORIGIN, MembersToAdd: msg.MembersToAdd, MembersToDelete: msg.MembersToDelete, diff --git a/x/storage/keeper/payment.go b/x/storage/keeper/payment.go index 5492b6bcf..66f409f61 100644 --- a/x/storage/keeper/payment.go +++ b/x/storage/keeper/payment.go @@ -249,7 +249,7 @@ func (k Keeper) GetObjectLockFee(ctx sdk.Context, primarySpAddress string, price return amount, nil } -// todo(Fynn): refactor when we have a way to record the min charge size parameter history +// TODO(Fynn): refactor when we have a way to record the min charge size parameter history func (k Keeper) GetChargeSize(ctx sdk.Context, payloadSize uint64, _time int64) uint64 { minChargeSize := k.GetParams(ctx).MinChargeSize if payloadSize < minChargeSize { diff --git a/x/storage/keeper/permission.go b/x/storage/keeper/permission.go index 528faac35..55012db9e 100644 --- a/x/storage/keeper/permission.go +++ b/x/storage/keeper/permission.go @@ -27,6 +27,12 @@ var ( } ) +// VerifyBucketPermission Bucket permissions checks are divided into three steps: +// First, if the bucket is a public bucket and the action is a read-only action, it returns "allow". +// Second, if the operator is the owner of the bucket, it returns "allow", as the owner has the highest permission. +// Third, verify the policy corresponding to the bucket and the operator. +// 1. If the policy is evaluated as "allow", return "allow" to the user. +// 2. If it is evaluated as "deny" or "unspecified", return "deny". func (k Keeper) VerifyBucketPermission(ctx sdk.Context, bucketInfo *types.BucketInfo, operator sdk.AccAddress, action permtypes.ActionType, options *permtypes.VerifyOptions) permtypes.Effect { // if bucket is public, anyone can read but can not write it. @@ -46,6 +52,18 @@ func (k Keeper) VerifyBucketPermission(ctx sdk.Context, bucketInfo *types.Bucket return permtypes.EFFECT_DENY } +// VerifyObjectPermission Object permission checks are divided into four steps: +// First, if the object is a public object and the action is a read-only action, it returns "allow". +// Second, if the operator is the owner of the bucket, it returns "allow" +// Third, verify the policy corresponding to the bucket and the operator +// 1. If it is evaluated as "deny", return "deny" +// 2. If it is evaluated as "allow" or "unspecified", go ahead (Noted as EffectBucket) +// +// Four, verify the policy corresponding to the object and the operator +// 1. If it is evaluated as "deny", return "deny". +// 2. If it is evaluated as "allow", return "allow". +// 3. If it is evaluated as "unspecified", then if the EffectBucket is "allow", return allow +// 4. If it is evaluated as "unspecified", then if the EffectBucket is "unspecified", return deny func (k Keeper) VerifyObjectPermission(ctx sdk.Context, bucketInfo *types.BucketInfo, objectInfo *types.ObjectInfo, operator sdk.AccAddress, action permtypes.ActionType) permtypes.Effect { // if object is public, anyone can read but can not write it. @@ -135,10 +153,10 @@ func (k Keeper) GetPolicy(ctx sdk.Context, grn *types2.GRN, principal *permtypes var policy *permtypes.Policy var found bool - if principal.Type == permtypes.TYPE_GNFD_ACCOUNT { + if principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_ACCOUNT { policy, found = k.permKeeper.GetPolicyForAccount(ctx, resID, grn.ResourceType(), principal.MustGetAccountAddress()) - } else if principal.Type == permtypes.TYPE_GNFD_GROUP { + } else if principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_GROUP { policy, found = k.permKeeper.GetPolicyForGroup(ctx, resID, grn.ResourceType(), principal.MustGetGroupID()) } else { return nil, permtypes.ErrInvalidPrincipal @@ -147,8 +165,6 @@ func (k Keeper) GetPolicy(ctx sdk.Context, grn *types2.GRN, principal *permtypes if !found { return nil, types.ErrNoSuchPolicy.Wrapf("GRN: %s, principal:%s", grn.String(), principal.String()) } - // no need to return member statement - policy.MemberStatement = nil return policy, nil } @@ -194,7 +210,7 @@ func (k Keeper) PutPolicy(ctx sdk.Context, operator sdk.AccAddress, grn types2.G resOwner = sdk.MustAccAddressFromHex(groupInfo.Owner) resID = groupInfo.Id - if policy.Principal.Type == permtypes.TYPE_GNFD_GROUP { + if policy.Principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_GROUP { return math.ZeroUint(), permtypes.ErrInvalidPrincipal.Wrapf("Not allow grant group's permission to another group") } default: @@ -269,7 +285,7 @@ func (k Keeper) DeletePolicy(ctx sdk.Context, operator sdk.AccAddress, principal } func (k Keeper) validatePrincipal(ctx sdk.Context, resOwner sdk.AccAddress, principal *permtypes.Principal) error { - if principal.Type == permtypes.TYPE_GNFD_ACCOUNT { + if principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_ACCOUNT { principalAccAddress, err := principal.GetAccountAddress() if err != nil { return err @@ -277,7 +293,7 @@ func (k Keeper) validatePrincipal(ctx sdk.Context, resOwner sdk.AccAddress, prin if principalAccAddress.Equals(resOwner) { return gnfderrors.ErrInvalidPrincipal.Wrapf("principal account can not be the bucket owner") } - } else if principal.Type == permtypes.TYPE_GNFD_GROUP { + } else if principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_GROUP { groupID, err := math.ParseUint(principal.Value) if err != nil { return err diff --git a/x/storage/keeper/query.go b/x/storage/keeper/query.go index a4e5e6fc6..494ca8f23 100644 --- a/x/storage/keeper/query.go +++ b/x/storage/keeper/query.go @@ -14,7 +14,6 @@ import ( "github.com/bnb-chain/greenfield/internal/sequence" gnfd "github.com/bnb-chain/greenfield/types" - "github.com/bnb-chain/greenfield/types/resource" permtypes "github.com/bnb-chain/greenfield/x/permission/types" "github.com/bnb-chain/greenfield/x/storage/types" ) @@ -402,9 +401,9 @@ func (k Keeper) HeadGroupMember(goCtx context.Context, req *types.QueryHeadGroup if !found { return nil, types.ErrNoSuchGroup } - policy, found := k.permKeeper.GetPolicyForAccount(ctx, groupInfo.Id, resource.RESOURCE_TYPE_GROUP, member) - if !found || policy.MemberStatement == nil { + groupMember, found := k.permKeeper.GetGroupMember(ctx, groupInfo.Id, member) + if !found { return nil, types.ErrNoSuchGroupMember } - return &types.QueryHeadGroupMemberResponse{GroupId: groupInfo.Id.String()}, nil + return &types.QueryHeadGroupMemberResponse{GroupMember: groupMember}, nil } diff --git a/x/storage/module_simulation.go b/x/storage/module_simulation.go index 3b21d75cc..bdf96e9c7 100644 --- a/x/storage/module_simulation.go +++ b/x/storage/module_simulation.go @@ -25,63 +25,7 @@ var ( ) const ( - opWeightMsgCreateBucket = "op_weight_msg_create_bucket" - // TODO: Determine the simulation weight value - defaultWeightMsgCreateBucket int = 100 - - opWeightMsgDeleteBucket = "op_weight_msg_delete_bucket" - // TODO: Determine the simulation weight value - defaultWeightMsgDeleteBucket int = 100 - - opWeightMsgPutObject = "op_weight_msg_put_object" - // TODO: Determine the simulation weight value - defaultWeightMsgPutObject int = 100 - - opWeightMsgSealObject = "op_weight_msg_seal_object" - // TODO: Determine the simulation weight value - defaultWeightMsgSealObject int = 100 - - opWeightMsgRejectUnsealedObject = "op_weight_msg_reject_unsealed_object" - // TODO: Determine the simulation weight value - defaultWeightMsgRejectUnsealedObject int = 100 - - opWeightMsgDeleteObject = "op_weight_msg_delete_object" - // TODO: Determine the simulation weight value - defaultWeightMsgDeleteObject int = 100 - - opWeightMsgCreateGroup = "op_weight_msg_create_group" - // TODO: Determine the simulation weight value - defaultWeightMsgCreateGroup int = 100 - - opWeightMsgDeleteGroup = "op_weight_msg_delete_group" - // TODO: Determine the simulation weight value - defaultWeightMsgDeleteGroup int = 100 - - opWeightMsgUpdateGroupMember = "op_weight_msg_update_group_member" - // TODO: Determine the simulation weight value - defaultWeightMsgUpdateGroupMember int = 100 - - opWeightMsgLeaveGroup = "op_weight_msg_leave_group" - // TODO: Determine the simulation weight value - defaultWeightMsgLeaveGroup int = 100 - - opWeightMsgCopyObject = "op_weight_msg_copy_object" - // TODO: Determine the simulation weight value - defaultWeightMsgCopyObject int = 100 - - opWeightMsgUpdateBucketReadQuota = "op_weight_msg_update_bucket_read_quota" - // TODO: Determine the simulation weight value - defaultWeightMsgUpdateBucketReadQuota int = 100 - - opWeightMsgCancelCreateObject = "op_weight_msg_cancel_create_object" - // TODO: Determine the simulation weight value - defaultWeightMsgCancelCreateObject int = 100 - - opWeightMsgDeletePolicy = "op_weight_msg_delete_policy" - // TODO: Determine the simulation weight value - defaultWeightMsgDeletePolicy int = 100 - - // this line is used by starport scaffolding # simapp/module/const +// this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module @@ -114,162 +58,6 @@ func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgCreateBucket int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCreateBucket, &weightMsgCreateBucket, nil, - func(_ *rand.Rand) { - weightMsgCreateBucket = defaultWeightMsgCreateBucket - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCreateBucket, - storagesimulation.SimulateMsgCreateBucket(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDeleteBucket int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDeleteBucket, &weightMsgDeleteBucket, nil, - func(_ *rand.Rand) { - weightMsgDeleteBucket = defaultWeightMsgDeleteBucket - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDeleteBucket, - storagesimulation.SimulateMsgDeleteBucket(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgPutObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgPutObject, &weightMsgPutObject, nil, - func(_ *rand.Rand) { - weightMsgPutObject = defaultWeightMsgPutObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgPutObject, - storagesimulation.SimulateMsgCreateObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgSealObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgSealObject, &weightMsgSealObject, nil, - func(_ *rand.Rand) { - weightMsgSealObject = defaultWeightMsgSealObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgSealObject, - storagesimulation.SimulateMsgSealObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgRejectUnsealedObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgRejectUnsealedObject, &weightMsgRejectUnsealedObject, nil, - func(_ *rand.Rand) { - weightMsgRejectUnsealedObject = defaultWeightMsgRejectUnsealedObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgRejectUnsealedObject, - storagesimulation.SimulateMsgRejectUnsealedObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDeleteObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDeleteObject, &weightMsgDeleteObject, nil, - func(_ *rand.Rand) { - weightMsgDeleteObject = defaultWeightMsgDeleteObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDeleteObject, - storagesimulation.SimulateMsgDeleteObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgCreateGroup int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCreateGroup, &weightMsgCreateGroup, nil, - func(_ *rand.Rand) { - weightMsgCreateGroup = defaultWeightMsgCreateGroup - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCreateGroup, - storagesimulation.SimulateMsgCreateGroup(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDeleteGroup int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDeleteGroup, &weightMsgDeleteGroup, nil, - func(_ *rand.Rand) { - weightMsgDeleteGroup = defaultWeightMsgDeleteGroup - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDeleteGroup, - storagesimulation.SimulateMsgDeleteGroup(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUpdateGroupMember int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateGroupMember, &weightMsgUpdateGroupMember, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupMember = defaultWeightMsgUpdateGroupMember - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUpdateGroupMember, - storagesimulation.SimulateMsgUpdateGroupMember(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgLeaveGroup int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgLeaveGroup, &weightMsgLeaveGroup, nil, - func(_ *rand.Rand) { - weightMsgLeaveGroup = defaultWeightMsgLeaveGroup - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgLeaveGroup, - storagesimulation.SimulateMsgLeaveGroup(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgCopyObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCopyObject, &weightMsgCopyObject, nil, - func(_ *rand.Rand) { - weightMsgCopyObject = defaultWeightMsgCopyObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCopyObject, - storagesimulation.SimulateMsgCopyObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUpdateBucketReadQuota int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateBucketReadQuota, &weightMsgUpdateBucketReadQuota, nil, - func(_ *rand.Rand) { - weightMsgUpdateBucketReadQuota = defaultWeightMsgUpdateBucketReadQuota - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUpdateBucketReadQuota, - storagesimulation.SimulateMsgUpdateBucketInfo(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgCancelCreateObject int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCancelCreateObject, &weightMsgCancelCreateObject, nil, - func(_ *rand.Rand) { - weightMsgCancelCreateObject = defaultWeightMsgCancelCreateObject - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCancelCreateObject, - storagesimulation.SimulateMsgCancelCreateObject(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDeletePolicy int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDeletePolicy, &weightMsgDeletePolicy, nil, - func(_ *rand.Rand) { - weightMsgDeletePolicy = defaultWeightMsgDeletePolicy - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDeletePolicy, - storagesimulation.SimulateMsgDeletePolicy(am.accountKeeper, am.bankKeeper, am.keeper), - )) - // this line is used by starport scaffolding # simapp/module/operation - return operations } diff --git a/x/storage/simulation/delete_policy.go b/x/storage/simulation/delete_policy.go deleted file mode 100644 index b3e315588..000000000 --- a/x/storage/simulation/delete_policy.go +++ /dev/null @@ -1,34 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - types2 "github.com/bnb-chain/greenfield/types" - permtypes "github.com/bnb-chain/greenfield/x/permission/types" - "github.com/bnb-chain/greenfield/x/storage/keeper" - "github.com/bnb-chain/greenfield/x/storage/types" -) - -func SimulateMsgDeletePolicy( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDeletePolicy{ - Operator: simAccount.Address.String(), - Principal: permtypes.NewPrincipalWithAccount(simAccount.Address), - Resource: types2.NewBucketGRN("test-bucket").String(), - } - - // TODO: Handling the DeletePolicy simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DeletePolicy simulation not implemented"), nil, nil - } -} diff --git a/x/storage/simulation/operations.go b/x/storage/simulation/operations.go deleted file mode 100644 index 9ec50118b..000000000 --- a/x/storage/simulation/operations.go +++ /dev/null @@ -1,246 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/bnb-chain/greenfield/x/storage/keeper" - "github.com/bnb-chain/greenfield/x/storage/types" -) - -func SimulateMsgCreateBucket( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateBucket{ - Creator: simAccount.Address.String(), - } - - // TODO: Handling the CreateBucket simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateBucket simulation not implemented"), nil, nil - } -} - -func SimulateMsgDeleteBucket( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDeleteBucket{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the DeleteBucket simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DeleteBucket simulation not implemented"), nil, nil - } -} - -func SimulateMsgUpdateBucketInfo( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUpdateBucketInfo{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the UpdateBucketInfo simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateBucketInfo simulation not implemented"), nil, nil - } -} - -func SimulateMsgCreateObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateObject{ - Creator: simAccount.Address.String(), - } - - // TODO: Handling the CreateObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgCancelCreateObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCancelCreateObject{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the CancelCreateObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CancelCreateObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgDeleteObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDeleteObject{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the DeleteObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DeleteObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgSealObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgSealObject{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the SealObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "SealObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgRejectUnsealedObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgRejectSealObject{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the RejectSealObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "RejectSealObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgCopyObject( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCopyObject{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the CopyObject simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CopyObject simulation not implemented"), nil, nil - } -} - -func SimulateMsgCreateGroup( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateGroup{ - Creator: simAccount.Address.String(), - } - - // TODO: Handling the CreateGroup simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateGroup simulation not implemented"), nil, nil - } -} - -func SimulateMsgDeleteGroup( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDeleteGroup{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the DeleteGroup simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DeleteGroup simulation not implemented"), nil, nil - } -} - -func SimulateMsgLeaveGroup( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgLeaveGroup{ - Member: simAccount.Address.String(), - } - - // TODO: Handling the LeaveGroup simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "LeaveGroup simulation not implemented"), nil, nil - } -} - -func SimulateMsgUpdateGroupMember( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUpdateGroupMember{ - Operator: simAccount.Address.String(), - } - - // TODO: Handling the UpdateGroupMember simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateGroupMember simulation not implemented"), nil, nil - } -} diff --git a/x/storage/simulation/operations_test.go b/x/storage/simulation/operations_test.go deleted file mode 100644 index 5c6452f9a..000000000 --- a/x/storage/simulation/operations_test.go +++ /dev/null @@ -1 +0,0 @@ -package simulation_test diff --git a/x/storage/types/errors.go b/x/storage/types/errors.go index e6779340a..28087bb15 100644 --- a/x/storage/types/errors.go +++ b/x/storage/types/errors.go @@ -18,8 +18,8 @@ var ( ErrBucketNotEmpty = errors.Register(ModuleName, 1109, "Bucket is not empty") ErrGroupMemberAlreadyExists = errors.Register(ModuleName, 1110, "Group member already exists") ErrNoSuchStorageProvider = errors.Register(ModuleName, 1111, "No such storage provider") - ErrObjectNotInit = errors.Register(ModuleName, 1112, "Not a INIT object") - ErrObjectNotInService = errors.Register(ModuleName, 1113, "Object not in service") + ErrObjectNotCreated = errors.Register(ModuleName, 1112, "Object not created") + ErrObjectNotSealed = errors.Register(ModuleName, 1113, "Object not sealed") ErrSourceTypeMismatch = errors.Register(ModuleName, 1114, "Object source type mismatch") ErrTooLargeObject = errors.Register(ModuleName, 1115, "Object payload size is too large") ErrInvalidApproval = errors.Register(ModuleName, 1116, "Invalid approval of sp") diff --git a/x/storage/types/expected_keepers.go b/x/storage/types/expected_keepers.go index b501d9d36..d708d1b96 100644 --- a/x/storage/types/expected_keepers.go +++ b/x/storage/types/expected_keepers.go @@ -46,11 +46,13 @@ type PermissionKeeper interface { VerifyPolicy(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, operator sdk.AccAddress, action permtypes.ActionType, opts *permtypes.VerifyOptions) permtypes.Effect AddGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error - RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) + RemoveGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) error GetPolicyByID(ctx sdk.Context, policyID math.Uint) (*permtypes.Policy, bool) GetPolicyForAccount(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, addr sdk.AccAddress) (policy *permtypes.Policy, isFound bool) GetPolicyForGroup(ctx sdk.Context, resourceID math.Uint, resourceType resource.ResourceType, groupID math.Uint) (policy *permtypes.Policy, isFound bool) + GetGroupMember(ctx sdk.Context, groupID math.Uint, member sdk.AccAddress) (*permtypes.GroupMember, bool) + GetGroupMemberByID(ctx sdk.Context, groupMemberID math.Uint) (*permtypes.GroupMember, bool) } type CrossChainKeeper interface { diff --git a/x/storage/types/message.go b/x/storage/types/message.go index 2d140fd7e..40d3db9bb 100644 --- a/x/storage/types/message.go +++ b/x/storage/types/message.go @@ -796,7 +796,7 @@ func (msg *MsgLeaveGroup) ValidateBasic() error { } func NewMsgUpdateGroupMember( - operator sdk.AccAddress, groupName string, membersToAdd []sdk.AccAddress, + operator sdk.AccAddress, groupOwner sdk.AccAddress, groupName string, membersToAdd []sdk.AccAddress, membersToDelete []sdk.AccAddress) *MsgUpdateGroupMember { var membersAddrToAdd, membersAddrToDelete []string for _, member := range membersToAdd { @@ -807,6 +807,7 @@ func NewMsgUpdateGroupMember( } return &MsgUpdateGroupMember{ Operator: operator.String(), + GroupOwner: groupOwner.String(), GroupName: groupName, MembersToAdd: membersAddrToAdd, MembersToDelete: membersAddrToDelete, @@ -844,6 +845,12 @@ func (msg *MsgUpdateGroupMember) ValidateBasic() error { if err != nil { return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid operator address (%s)", err) } + + _, err = sdk.AccAddressFromHexUnsafe(msg.GroupOwner) + if err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid group owner address (%s)", err) + } + err = s3util.CheckValidGroupName(msg.GroupName) if err != nil { return err @@ -911,7 +918,7 @@ func (msg *MsgPutPolicy) ValidateBasic() error { return errors.Wrapf(gnfderrors.ErrInvalidGRN, "invalid greenfield resource name (%s)", err) } - if msg.Principal.Type == permtypes.TYPE_GNFD_GROUP && grn.ResourceType() == resource.RESOURCE_TYPE_GROUP { + if msg.Principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_GROUP && grn.ResourceType() == resource.RESOURCE_TYPE_GROUP { return gnfderrors.ErrInvalidPrincipal.Wrapf("Not allow grant group's permission to another group") } @@ -971,7 +978,7 @@ func (msg *MsgDeletePolicy) ValidateBasic() error { return errors.Wrapf(gnfderrors.ErrInvalidGRN, "invalid greenfield resource name (%s)", err) } - if msg.Principal.Type == permtypes.TYPE_GNFD_GROUP && grn.ResourceType() == resource.RESOURCE_TYPE_GROUP { + if msg.Principal.Type == permtypes.PRINCIPAL_TYPE_GNFD_GROUP && grn.ResourceType() == resource.RESOURCE_TYPE_GROUP { return gnfderrors.ErrInvalidPrincipal.Wrapf("Not allow grant group's permission to another group") } return nil @@ -1014,7 +1021,7 @@ func (msg *MsgMirrorBucket) GetSignBytes() []byte { func (msg *MsgMirrorBucket) ValidateBasic() error { _, err := sdk.AccAddressFromHexUnsafe(msg.Operator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil @@ -1057,7 +1064,7 @@ func (msg *MsgMirrorObject) GetSignBytes() []byte { func (msg *MsgMirrorObject) ValidateBasic() error { _, err := sdk.AccAddressFromHexUnsafe(msg.Operator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil @@ -1100,7 +1107,7 @@ func (msg *MsgMirrorGroup) GetSignBytes() []byte { func (msg *MsgMirrorGroup) ValidateBasic() error { _, err := sdk.AccAddressFromHexUnsafe(msg.Operator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil diff --git a/x/storage/types/message_test.go b/x/storage/types/message_test.go index 029e91a66..8c9ee473c 100644 --- a/x/storage/types/message_test.go +++ b/x/storage/types/message_test.go @@ -464,6 +464,7 @@ func TestMsgUpdateGroupMember_ValidateBasic(t *testing.T) { name: "normal", msg: MsgUpdateGroupMember{ Operator: sample.AccAddress(), + GroupOwner: sample.AccAddress(), GroupName: testGroupName, MembersToAdd: []string{sample.AccAddress(), sample.AccAddress()}, MembersToDelete: []string{sample.AccAddress(), sample.AccAddress()}, diff --git a/x/storage/types/query.pb.go b/x/storage/types/query.pb.go index 1a202813e..b2b4780a6 100644 --- a/x/storage/types/query.pb.go +++ b/x/storage/types/query.pb.go @@ -977,7 +977,7 @@ func (m *QueryVerifyPermissionRequest) GetActionType() types.ActionType { if m != nil { return m.ActionType } - return types.ACTION_UPDATE_BUCKET_INFO + return types.ACTION_UNSPECIFIED } type QueryVerifyPermissionResponse struct { @@ -1021,7 +1021,7 @@ func (m *QueryVerifyPermissionResponse) GetEffect() types.Effect { if m != nil { return m.Effect } - return types.EFFECT_ALLOW + return types.EFFECT_UNSPECIFIED } type QueryHeadGroupRequest struct { @@ -1285,7 +1285,7 @@ func (m *QueryHeadGroupMemberRequest) GetGroupName() string { } type QueryHeadGroupMemberResponse struct { - GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + GroupMember *types.GroupMember `protobuf:"bytes,1,opt,name=group_member,json=groupMember,proto3" json:"group_member,omitempty"` } func (m *QueryHeadGroupMemberResponse) Reset() { *m = QueryHeadGroupMemberResponse{} } @@ -1321,11 +1321,11 @@ func (m *QueryHeadGroupMemberResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryHeadGroupMemberResponse proto.InternalMessageInfo -func (m *QueryHeadGroupMemberResponse) GetGroupId() string { +func (m *QueryHeadGroupMemberResponse) GetGroupMember() *types.GroupMember { if m != nil { - return m.GroupId + return m.GroupMember } - return "" + return nil } type QueryPolicyForGroupRequest struct { @@ -1459,109 +1459,110 @@ func init() { func init() { proto.RegisterFile("greenfield/storage/query.proto", fileDescriptor_b1b80b580af04cb0) } var fileDescriptor_b1b80b580af04cb0 = []byte{ - // 1631 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xa6, 0xfd, 0xe6, 0x9b, 0x8c, 0x4b, 0x5b, 0x86, 0x16, 0x12, 0xb7, 0x75, 0xdb, 0x45, - 0x2a, 0x51, 0x69, 0xbd, 0xf9, 0xd1, 0xd2, 0x9a, 0x8a, 0x4a, 0x09, 0x24, 0x69, 0x80, 0xa6, 0xc1, - 0x54, 0x15, 0xaa, 0x40, 0xcb, 0xec, 0xee, 0xd8, 0x5d, 0x1a, 0xef, 0xb8, 0x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d0, - 0x2f, 0x70, 0xe8, 0xf3, 0x58, 0x1b, 0x0c, 0x3d, 0x52, 0xfc, 0x20, 0x85, 0x1e, 0x2b, 0xc1, 0xef, - 0x00, 0x31, 0x39, 0x90, 0xe7, 0xf5, 0x90, 0x29, 0x54, 0x8a, 0x17, 0x47, 0x37, 0x04, 0x0e, 0x37, - 0x38, 0x87, 0x4d, 0xbc, 0x31, 0x98, 0x43, 0xa4, 0xf0, 0x21, 0x91, 0x32, 0xcb, 0x3e, 0xd0, 0x41, - 0xdd, 0xe5, 0xf5, 0x87, 0x4f, 0x4a, 0xca, 0xa3, 0x27, 0x25, 0xe5, 0xf1, 0x93, 0x92, 0xf2, 0xf9, - 0x76, 0x69, 0xec, 0xd1, 0x76, 0x69, 0xec, 0xcf, 0xed, 0xd2, 0xd8, 0x4d, 0xad, 0x6e, 0xfb, 0xb7, - 0x5a, 0x46, 0xd9, 0x64, 0x8d, 0x6c, 0x9f, 0x9f, 0xc4, 0x7f, 0x50, 0x31, 0x26, 0xf8, 0x2f, 0x2a, - 0x8b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xc5, 0x54, 0xc4, 0x93, 0x1a, 0x00, 0x00, + // 1636 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcf, 0x8f, 0x14, 0x45, + 0x14, 0xde, 0x1e, 0x70, 0xdd, 0xad, 0x41, 0xc0, 0x12, 0x74, 0x19, 0x60, 0x80, 0x36, 0x41, 0x82, + 0xcb, 0x34, 0xbb, 0x0b, 0xc2, 0x48, 0x24, 0xd9, 0xd5, 0xdd, 0x65, 0x55, 0x96, 0x75, 0x24, 0xc4, + 0x10, 0x4d, 0x5b, 0xdd, 0x5d, 0x33, 0xb4, 0xec, 0x74, 0x0d, 0xdd, 0x3d, 0xe8, 0x64, 0x32, 0x07, + 0x39, 0x79, 0xd3, 0x84, 0x9b, 0x67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, 0x7b, 0xe4, 0x34, 0x00, 0xd0, + 0x50, 0x8f, 0x25, 0xff, 0x07, 0x84, 0x98, 0x24, 0x28, 0xf2, 0x82, 0xc8, 0x14, 0x2b, 0x95, 0x8b, + 0xe3, 0x1b, 0x02, 0x87, 0x1b, 0x9c, 0xc3, 0x06, 0x5e, 0x1f, 0xcd, 0x21, 0x52, 0xfc, 0x70, 0x24, + 0x99, 0xa5, 0xef, 0x6b, 0xa1, 0xc1, 0xd2, 0xda, 0xc3, 0x27, 0x55, 0xe9, 0xd1, 0x93, 0xaa, 0xf4, + 0xf8, 0x49, 0x55, 0xfa, 0x6a, 0xab, 0x3a, 0xf1, 0x68, 0xab, 0x3a, 0xf1, 0xd7, 0x56, 0x75, 0xe2, + 0xa6, 0xd2, 0x32, 0xdd, 0x5b, 0x5d, 0xad, 0xa6, 0xb3, 0x76, 0xb6, 0xcf, 0xcf, 0xe2, 0xbf, 0xc4, + 0x68, 0x93, 0xfc, 0xa7, 0x98, 0x85, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x56, 0x66, 0xd4, 0xaa, + 0xcc, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3235,10 +3236,15 @@ func (m *QueryHeadGroupMemberResponse) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if len(m.GroupId) > 0 { - i -= len(m.GroupId) - copy(dAtA[i:], m.GroupId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GroupId))) + if m.GroupMember != nil { + { + size, err := m.GroupMember.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -3726,8 +3732,8 @@ func (m *QueryHeadGroupMemberResponse) Size() (n int) { } var l int _ = l - l = len(m.GroupId) - if l > 0 { + if m.GroupMember != nil { + l = m.GroupMember.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -6385,9 +6391,9 @@ func (m *QueryHeadGroupMemberResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GroupMember", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -6397,23 +6403,27 @@ func (m *QueryHeadGroupMemberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.GroupId = string(dAtA[iNdEx:postIndex]) + if m.GroupMember == nil { + m.GroupMember = &types.GroupMember{} + } + if err := m.GroupMember.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/storage/types/query.pb.gw.go b/x/storage/types/query.pb.gw.go index 9da0c82ef..d5cd2ce18 100644 --- a/x/storage/types/query.pb.gw.go +++ b/x/storage/types/query.pb.gw.go @@ -911,13 +911,31 @@ func local_request_Query_HeadGroup_0(ctx context.Context, marshaler runtime.Mars } var ( - filter_Query_ListGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_ListGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{"group_owner": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_ListGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryListGroupRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["group_owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_owner") + } + + protoReq.GroupOwner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_owner", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -934,6 +952,24 @@ func local_request_Query_ListGroup_0(ctx context.Context, marshaler runtime.Mars var protoReq QueryListGroupRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["group_owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "group_owner") + } + + protoReq.GroupOwner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "group_owner", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -1868,7 +1904,7 @@ var ( pattern_Query_HeadGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"greenfield", "storage", "head_group", "group_owner", "group_name"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ListGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"bnb-chain", "greenfield", "storage", "list_group"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ListGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"greenfield", "storage", "list_group", "group_owner"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_HeadGroupMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"bnb-chain", "greenfield", "storage", "head_group_member"}, "", runtime.AssumeColonVerbOpt(false))) diff --git a/x/storage/types/tx.pb.go b/x/storage/types/tx.pb.go index bab8312b4..e26cd4a93 100644 --- a/x/storage/types/tx.pb.go +++ b/x/storage/types/tx.pb.go @@ -1062,12 +1062,14 @@ var xxx_messageInfo_MsgDeleteGroupResponse proto.InternalMessageInfo type MsgUpdateGroupMember struct { // operator is the account address of the operator who has the UpdateGroupMember permission of the group. Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // group_owner is the account address of the group owner + GroupOwner string `protobuf:"bytes,2,opt,name=group_owner,json=groupOwner,proto3" json:"group_owner,omitempty"` // group_name is the name of the group which to be updated - GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` // members_to_add is a list of members account address which will be add to the group - MembersToAdd []string `protobuf:"bytes,3,rep,name=members_to_add,json=membersToAdd,proto3" json:"members_to_add,omitempty"` + MembersToAdd []string `protobuf:"bytes,4,rep,name=members_to_add,json=membersToAdd,proto3" json:"members_to_add,omitempty"` // members_to_delete is a list of members account address which will be remove from the group - MembersToDelete []string `protobuf:"bytes,4,rep,name=members_to_delete,json=membersToDelete,proto3" json:"members_to_delete,omitempty"` + MembersToDelete []string `protobuf:"bytes,5,rep,name=members_to_delete,json=membersToDelete,proto3" json:"members_to_delete,omitempty"` } func (m *MsgUpdateGroupMember) Reset() { *m = MsgUpdateGroupMember{} } @@ -1110,6 +1112,13 @@ func (m *MsgUpdateGroupMember) GetOperator() string { return "" } +func (m *MsgUpdateGroupMember) GetGroupOwner() string { + if m != nil { + return m.GroupOwner + } + return "" +} + func (m *MsgUpdateGroupMember) GetGroupName() string { if m != nil { return m.GroupName @@ -1983,110 +1992,110 @@ func init() { func init() { proto.RegisterFile("greenfield/storage/tx.proto", fileDescriptor_ddb71b028305a3cc) } var fileDescriptor_ddb71b028305a3cc = []byte{ - // 1639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcf, 0x6f, 0x13, 0xc7, - 0x1e, 0xcf, 0xc6, 0x26, 0xb1, 0xbf, 0x76, 0x7e, 0xb0, 0x04, 0x62, 0x9c, 0x97, 0x38, 0x58, 0x7a, - 0x28, 0x90, 0x87, 0x0d, 0x01, 0x21, 0xe0, 0xf0, 0xa4, 0x04, 0xf4, 0x50, 0xa4, 0x67, 0x08, 0xeb, - 0x70, 0x69, 0x2b, 0x59, 0xeb, 0xdd, 0x61, 0x59, 0xf0, 0xee, 0x6c, 0x67, 0xd6, 0x80, 0x39, 0x54, - 0x2d, 0xed, 0x1f, 0x80, 0x7a, 0xea, 0xa1, 0xe2, 0x56, 0xa9, 0x97, 0x4a, 0x3d, 0x70, 0xa8, 0xd4, - 0x6b, 0x0f, 0x1c, 0x11, 0xa7, 0xaa, 0x52, 0x69, 0x05, 0x87, 0xfe, 0x1b, 0xd5, 0xee, 0xcc, 0xee, - 0x8e, 0xd7, 0xc6, 0xbb, 0x26, 0x89, 0xca, 0x09, 0x66, 0xf6, 0xf3, 0xfd, 0xfd, 0x6b, 0xbe, 0x0e, - 0x2c, 0x19, 0x04, 0x21, 0xfb, 0x8e, 0x89, 0x3a, 0x7a, 0x9d, 0xba, 0x98, 0xa8, 0x06, 0xaa, 0xbb, - 0x8f, 0x6a, 0x0e, 0xc1, 0x2e, 0x96, 0x97, 0xda, 0x76, 0x5b, 0xbb, 0xab, 0x9a, 0x76, 0x2d, 0x42, - 0xd5, 0x38, 0xaa, 0xbc, 0xa8, 0x61, 0x6a, 0x61, 0x5a, 0xb7, 0xa8, 0x51, 0x7f, 0x70, 0xce, 0xfb, - 0x87, 0x51, 0x95, 0x8f, 0xb3, 0x0f, 0x2d, 0xff, 0x54, 0x67, 0x07, 0xfe, 0x69, 0xc1, 0xc0, 0x06, - 0x66, 0xf7, 0xde, 0xff, 0xf8, 0x6d, 0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4, 0xb0, 0xed, 0x7a, 0x19, 0xec, 0xf6, 0x1c, 0xc4, 0x12, 0x4f, 0x29, 0xf0, - 0xbb, 0xdd, 0x9e, 0x83, 0x0e, 0x2a, 0xb3, 0x4e, 0xc1, 0x3c, 0x7a, 0xe4, 0x78, 0xa6, 0x69, 0x77, - 0x91, 0x76, 0x9f, 0x76, 0x2d, 0x5a, 0xca, 0xad, 0x66, 0xd6, 0x8a, 0xca, 0x1c, 0xbb, 0xbf, 0x1a, - 0x5c, 0xcb, 0xbb, 0x30, 0x47, 0x90, 0xde, 0xb5, 0x75, 0xd5, 0xd6, 0x7a, 0x4c, 0xcf, 0xfc, 0xaa, - 0xb4, 0x36, 0xbb, 0xb1, 0x3e, 0x52, 0xba, 0x12, 0xd2, 0x78, 0x76, 0x28, 0xb3, 0xa4, 0xef, 0x2c, - 0x7f, 0x0c, 0xcb, 0x5c, 0x01, 0x8a, 0x34, 0x6c, 0xeb, 0xfd, 0x25, 0x88, 0x68, 0x09, 0x56, 0x33, + // 1646 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcd, 0x6f, 0x13, 0x47, + 0x1b, 0xcf, 0xc6, 0x26, 0xb1, 0x1f, 0x3b, 0x1f, 0x2c, 0x81, 0x18, 0xe7, 0x4d, 0x1c, 0x2c, 0xbd, + 0x28, 0x90, 0x17, 0x1b, 0x02, 0x42, 0x90, 0xc3, 0x2b, 0x25, 0xa0, 0x17, 0x45, 0x7a, 0x0d, 0x61, + 0x1d, 0x2e, 0x6d, 0x25, 0x6b, 0xbd, 0x3b, 0x2c, 0x0b, 0xde, 0x9d, 0xed, 0xcc, 0x1a, 0x30, 0x87, + 0x4a, 0xa5, 0xfd, 0x03, 0x50, 0x4f, 0x3d, 0x54, 0xdc, 0x2a, 0xf5, 0x52, 0xa9, 0x07, 0x0e, 0x95, + 0xb8, 0xf6, 0xc0, 0x11, 0x71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d, 0x17, 0xd1, 0x69, 0xcb, 0x27, 0x26, 0x13, + 0x43, 0x41, 0x1c, 0x93, 0x57, 0xd3, 0xd5, 0x83, 0x0f, 0x2e, 0x5f, 0xdc, 0x05, 0x58, 0x14, 0x28, + 0x8e, 0xa7, 0xab, 0xe9, 0x02, 0x96, 0x52, 0xe0, 0x90, 0x11, 0x54, 0xfe, 0x52, 0x82, 0xa3, 0x83, + 0xf3, 0xe7, 0x85, 0x74, 0x4d, 0x4e, 0x20, 0x29, 0x5f, 0xdd, 0x35, 0x89, 0x58, 0x42, 0xc2, 0x90, + 0x96, 0x58, 0x42, 0x11, 0x36, 0xb9, 0x84, 0x06, 0x47, 0x2a, 0xcf, 0xc5, 0xe2, 0x89, 0xbc, 0x9a, + 0x2e, 0x31, 0x52, 0xba, 0x78, 0xc8, 0x39, 0x2b, 0x9b, 0x90, 0x8f, 0xae, 0xff, 0x67, 0x92, 0x38, + 0x84, 0xd0, 0xf2, 0x85, 0xd4, 0xd0, 0xc1, 0xf6, 0xc0, 0xa5, 0xa5, 0x6c, 0x0f, 0x5c, 0xe0, 0xa5, + 0xdd, 0xa0, 0x03, 0x99, 0x9b, 0x5b, 0xaf, 0xde, 0x2d, 0x49, 0xaf, 0xdf, 0x2d, 0x49, 0x7f, 0xbe, + 0x5b, 0x92, 0x9e, 0xbd, 0x5f, 0x1a, 0x7b, 0xfd, 0x7e, 0x69, 0xec, 0xd7, 0xf7, 0x4b, 0x63, 0x9f, + 0xd4, 0x0d, 0xd3, 0xbd, 0xd7, 0x6d, 0xd7, 0x34, 0x6c, 0xd5, 0xdb, 0x76, 0xfb, 0x9c, 0xcf, 0xba, + 0x2e, 0xfc, 0xba, 0xf7, 0x38, 0xfa, 0xa1, 0xb2, 0xe7, 0x20, 0xda, 0x9e, 0xf0, 0x87, 0x82, 0x8b, + 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x07, 0x59, 0xd8, 0x54, 0xcb, 0x1c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3581,7 +3590,7 @@ func (m *MsgUpdateGroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.MembersToDelete[iNdEx]) i = encodeVarintTx(dAtA, i, uint64(len(m.MembersToDelete[iNdEx]))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } } if len(m.MembersToAdd) > 0 { @@ -3590,7 +3599,7 @@ func (m *MsgUpdateGroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.MembersToAdd[iNdEx]) i = encodeVarintTx(dAtA, i, uint64(len(m.MembersToAdd[iNdEx]))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } if len(m.GroupName) > 0 { @@ -3598,6 +3607,13 @@ func (m *MsgUpdateGroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.GroupName) i = encodeVarintTx(dAtA, i, uint64(len(m.GroupName))) i-- + dAtA[i] = 0x1a + } + if len(m.GroupOwner) > 0 { + i -= len(m.GroupOwner) + copy(dAtA[i:], m.GroupOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.GroupOwner))) + i-- dAtA[i] = 0x12 } if len(m.Operator) > 0 { @@ -4576,6 +4592,10 @@ func (m *MsgUpdateGroupMember) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.GroupOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.GroupName) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -7208,6 +7228,38 @@ func (m *MsgUpdateGroupMember) Unmarshal(dAtA []byte) error { m.Operator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupOwner", 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.GroupOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field GroupName", wireType) } @@ -7239,7 +7291,7 @@ func (m *MsgUpdateGroupMember) Unmarshal(dAtA []byte) error { } m.GroupName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MembersToAdd", wireType) } @@ -7271,7 +7323,7 @@ func (m *MsgUpdateGroupMember) Unmarshal(dAtA []byte) error { } m.MembersToAdd = append(m.MembersToAdd, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MembersToDelete", wireType) }