Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unify property names #172

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions proto/greenfield/storage/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ option go_package = "github.com/bnb-chain/greenfield/x/storage/types";

// EventCreateBucket is emitted on MsgCreateBucket
message EventCreateBucket {
// owner_address define the account address of bucket owner
string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of bucket owner
string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name is a globally unique name of bucket
string bucket_name = 2;
// visibility defines the highest permissions for bucket. When a bucket is public, everyone can get the object under it.
Expand All @@ -35,10 +35,10 @@ message EventCreateBucket {

// EventDeleteBucket is emitted on MsgDeleteBucket
message EventDeleteBucket {
// operator_address define the account address of operator who delete the bucket
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner_address define the account address of the bucket owner
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who delete the bucket
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of the bucket owner
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the deleted bucket
string bucket_name = 3;
// bucket_id define an u256 id for bucket
Expand All @@ -53,8 +53,8 @@ message EventDeleteBucket {

// EventUpdateBucketInfo is emitted on MsgUpdateBucketInfo
message EventUpdateBucketInfo {
// operator_address define the account address of operator who update the bucket
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who update the bucket
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// bucket_id define an u256 id for bucket
Expand All @@ -77,10 +77,10 @@ message EventUpdateBucketInfo {

// EventCreateObject is emitted on MsgCreateObject
message EventCreateObject {
// creator_address define the account address of msg creator
string creator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner_address define the account address of object owner
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// creator define the account address of msg creator
string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of object owner
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of bucket
string bucket_name = 3;
// object_name define the name of object
Expand Down Expand Up @@ -119,8 +119,8 @@ message EventCreateObject {

// EventSealObject is emitted on MsgSealObject
message EventCancelCreateObject {
// operator_address define the account address of operator who cancel create object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who cancel create object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// object_name define the name of the object
Expand All @@ -137,8 +137,8 @@ message EventCancelCreateObject {

// EventSealObject is emitted on MsgSealObject
message EventSealObject {
// operator_address define the account address of operator who seal object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who seal object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// object_name define the name of the object
Expand All @@ -157,8 +157,8 @@ message EventSealObject {

// EventCopyObject is emitted on MsgCopyObject
message EventCopyObject {
// operator_address define the account address of operator who copy the object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who copy the object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// src_bucket_name define the name of the src bucket
string src_bucket_name = 2;
// src_object_name define the name of the src object
Expand All @@ -183,8 +183,8 @@ message EventCopyObject {

// EventDeleteObject is emitted on MsgDeleteObject
message EventDeleteObject {
// operator_address define the account address of operator who delete the object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who delete the object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// object_name define the name of the object
Expand All @@ -203,8 +203,8 @@ message EventDeleteObject {

// EventRejectSealObject is emitted on MsgRejectSealObject
message EventRejectSealObject {
// operator_address define the account address of operator who reject seal object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who reject seal object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// object_name define the name of the object
Expand All @@ -219,8 +219,8 @@ message EventRejectSealObject {

// EventCreateGroup is emitted on MsgCreateGroup
message EventCreateGroup {
// owner_address define the account address of group owner
string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of group owner
string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_name define the name of the group
string group_name = 2;
// id define an u256 id for group
Expand All @@ -237,8 +237,8 @@ message EventCreateGroup {

// EventDeleteGroup is emitted on MsgDeleteGroup
message EventDeleteGroup {
// owner_address define the account address of group owner
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of group owner
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_name define the name of the group
string group_name = 3;
// id define an u256 id for group
Expand All @@ -253,8 +253,8 @@ message EventDeleteGroup {
message EventLeaveGroup {
// member_address define the address of the member who leave the group
string member_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner_address define the account address of group owner
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of group owner
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_name define the name of the group
string group_name = 3;
// id define an u256 id for group
Expand All @@ -267,10 +267,10 @@ message EventLeaveGroup {

// EventUpdateGroupMember is emitted on MsgUpdateGroupMember
message EventUpdateGroupMember {
// operator_address define the account address of operator who update the group member
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner_address define the account address of group owner
string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who update the group member
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of group owner
string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_name define the name of the group
string group_name = 3;
// id define an u256 id for group
Expand All @@ -287,8 +287,8 @@ message EventUpdateGroupMember {

// EventMirrorBucket is emitted on MirrorBucket
message EventMirrorBucket {
// operator_address define the account address of operator who mirror the bucket
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who mirror the bucket
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name defines the name of the bucket
string bucket_name = 2;
// bucket_id define an u256 id for bucket
Expand All @@ -315,8 +315,8 @@ message EventMirrorBucketResult {

// EventMirrorObject is emitted on MirrorObject
message EventMirrorObject {
// operator_address define the account address of operator who delete the object
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// operator define the account address of operator who delete the object
string operator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// bucket_name define the name of the bucket
string bucket_name = 2;
// object_name define the name of the object
Expand Down Expand Up @@ -347,8 +347,8 @@ message EventMirrorObjectResult {

// EventMirrorGroup is emitted on MirrorGroup
message EventMirrorGroup {
// owner_address define the account address of group owner
string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// owner define the account address of group owner
string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_name define the name of the group
string group_name = 2;
// group_id define an u256 id for group
Expand Down
66 changes: 33 additions & 33 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (k Keeper) CreateBucket(

// emit CreateBucket Event
if err = ctx.EventManager().EmitTypedEvents(&types.EventCreateBucket{
OwnerAddress: bucketInfo.Owner,
Owner: bucketInfo.Owner,
BucketName: bucketInfo.BucketName,
Visibility: bucketInfo.Visibility,
CreateAt: bucketInfo.CreateAt,
Expand Down Expand Up @@ -179,8 +179,8 @@ func (k Keeper) DeleteBucket(ctx sdk.Context, operator sdk.AccAddress, bucketNam
store.Delete(types.GetBucketByIDKey(bucketInfo.Id))

if err := ctx.EventManager().EmitTypedEvents(&types.EventDeleteBucket{
OperatorAddress: operator.String(),
OwnerAddress: bucketInfo.Owner,
Operator: operator.String(),
Owner: bucketInfo.Owner,
BucketName: bucketInfo.BucketName,
BucketId: bucketInfo.Id,
PrimarySpAddress: bucketInfo.PrimarySpAddress,
Expand Down Expand Up @@ -237,7 +237,7 @@ func (k Keeper) UpdateBucketInfo(ctx sdk.Context, operator sdk.AccAddress, bucke
store.Set(types.GetBucketByIDKey(bucketInfo.Id), bz)

if err := ctx.EventManager().EmitTypedEvents(&types.EventUpdateBucketInfo{
OperatorAddress: operator.String(),
Operator: operator.String(),
BucketName: bucketName,
BucketId: bucketInfo.Id,
ChargedReadQuotaBefore: bucketInfo.ChargedReadQuota,
Expand Down Expand Up @@ -373,8 +373,8 @@ func (k Keeper) CreateObject(
store.Set(types.GetObjectByIDKey(objectInfo.Id), obz)

if err := ctx.EventManager().EmitTypedEvents(&types.EventCreateObject{
CreatorAddress: operator.String(),
OwnerAddress: objectInfo.Owner,
Creator: operator.String(),
Owner: objectInfo.Owner,
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
BucketId: bucketInfo.Id,
Expand Down Expand Up @@ -494,7 +494,7 @@ func (k Keeper) SealObject(
store.Set(types.GetObjectByIDKey(objectInfo.Id), obz)

if err := ctx.EventManager().EmitTypedEvents(&types.EventSealObject{
OperatorAddress: spSealAcc.String(),
Operator: spSealAcc.String(),
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
Expand Down Expand Up @@ -551,7 +551,7 @@ func (k Keeper) CancelCreateObject(
store.Delete(types.GetObjectByIDKey(objectInfo.Id))

if err := ctx.EventManager().EmitTypedEvents(&types.EventCancelCreateObject{
OperatorAddress: operator.String(),
Operator: operator.String(),
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
PrimarySpAddress: bucketInfo.PrimarySpAddress,
Expand Down Expand Up @@ -603,7 +603,7 @@ func (k Keeper) DeleteObject(
store.Delete(types.GetObjectByIDKey(objectInfo.Id))

if err := ctx.EventManager().EmitTypedEvents(&types.EventDeleteObject{
OperatorAddress: operator.String(),
Operator: operator.String(),
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
Expand Down Expand Up @@ -687,13 +687,13 @@ func (k Keeper) CopyObject(
store.Set(types.GetObjectByIDKey(objectInfo.Id), obz)

if err := ctx.EventManager().EmitTypedEvents(&types.EventCopyObject{
OperatorAddress: operator.String(),
SrcBucketName: srcObjectInfo.BucketName,
SrcObjectName: srcObjectInfo.ObjectName,
DstBucketName: objectInfo.BucketName,
DstObjectName: objectInfo.ObjectName,
SrcObjectId: srcObjectInfo.Id,
DstObjectId: objectInfo.Id,
Operator: operator.String(),
SrcBucketName: srcObjectInfo.BucketName,
SrcObjectName: srcObjectInfo.ObjectName,
DstBucketName: objectInfo.BucketName,
DstObjectName: objectInfo.ObjectName,
SrcObjectId: srcObjectInfo.Id,
DstObjectId: objectInfo.Id,
}); err != nil {
return sdkmath.ZeroUint(), err
}
Expand Down Expand Up @@ -739,10 +739,10 @@ func (k Keeper) RejectSealObject(ctx sdk.Context, operator sdk.AccAddress, bucke
store.Delete(types.GetObjectByIDKey(objectInfo.Id))

if err := ctx.EventManager().EmitTypedEvents(&types.EventRejectSealObject{
OperatorAddress: operator.String(),
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
Operator: operator.String(),
BucketName: bucketInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
}); err != nil {
return err
}
Expand Down Expand Up @@ -783,11 +783,11 @@ func (k Keeper) CreateGroup(
}
}
if err := ctx.EventManager().EmitTypedEvents(&types.EventCreateGroup{
OwnerAddress: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
SourceType: groupInfo.SourceType,
Members: opts.Members,
Owner: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
SourceType: groupInfo.SourceType,
Members: opts.Members,
}); err != nil {
return sdkmath.ZeroUint(), err
}
Expand Down Expand Up @@ -852,9 +852,9 @@ func (k Keeper) DeleteGroup(ctx sdk.Context, operator sdk.AccAddress, groupName
store.Delete(types.GetGroupByIDKey(groupInfo.Id))

if err := ctx.EventManager().EmitTypedEvents(&types.EventDeleteGroup{
OwnerAddress: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
Owner: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
}); err != nil {
return err
}
Expand All @@ -880,9 +880,9 @@ func (k Keeper) LeaveGroup(
}

if err := ctx.EventManager().EmitTypedEvents(&types.EventDeleteGroup{
OwnerAddress: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
Owner: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
}); err != nil {
return err
}
Expand Down Expand Up @@ -925,8 +925,8 @@ func (k Keeper) UpdateGroupMember(ctx sdk.Context, operator sdk.AccAddress, grou

}
if err := ctx.EventManager().EmitTypedEvents(&types.EventUpdateGroupMember{
OperatorAddress: operator.String(),
OwnerAddress: groupInfo.Owner,
Operator: operator.String(),
Owner: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
MembersToAdd: opts.MembersToAdd,
Expand Down
20 changes: 10 additions & 10 deletions x/storage/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ func (k msgServer) MirrorObject(goCtx context.Context, msg *types.MsgMirrorObjec
k.Keeper.SetObjectInfo(ctx, objectInfo)

if err := ctx.EventManager().EmitTypedEvents(&types.EventMirrorObject{
OperatorAddress: objectInfo.Owner,
BucketName: objectInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
Operator: objectInfo.Owner,
BucketName: objectInfo.BucketName,
ObjectName: objectInfo.ObjectName,
ObjectId: objectInfo.Id,
}); err != nil {
return nil, err
}
Expand Down Expand Up @@ -444,9 +444,9 @@ func (k msgServer) MirrorBucket(goCtx context.Context, msg *types.MsgMirrorBucke
k.Keeper.SetBucketInfo(ctx, bucketInfo)

if err := ctx.EventManager().EmitTypedEvents(&types.EventMirrorBucket{
OperatorAddress: bucketInfo.Owner,
BucketName: bucketInfo.BucketName,
BucketId: bucketInfo.Id,
Operator: bucketInfo.Owner,
BucketName: bucketInfo.BucketName,
BucketId: bucketInfo.Id,
}); err != nil {
return nil, err
}
Expand Down Expand Up @@ -505,9 +505,9 @@ func (k msgServer) MirrorGroup(goCtx context.Context, msg *types.MsgMirrorGroup)
k.Keeper.SetGroupInfo(ctx, groupInfo)

if err := ctx.EventManager().EmitTypedEvents(&types.EventMirrorGroup{
OwnerAddress: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
Owner: groupInfo.Owner,
GroupName: groupInfo.GroupName,
GroupId: groupInfo.Id,
}); err != nil {
return nil, err
}
Expand Down
Loading