diff --git a/proto/sentinel/session/v3/events.proto b/proto/sentinel/session/v3/events.proto index 16df5745..c4d48820 100644 --- a/proto/sentinel/session/v3/events.proto +++ b/proto/sentinel/session/v3/events.proto @@ -40,4 +40,5 @@ message EventUpdateStatus { string acc_address = 2; string node_address = 3; sentinel.types.v1.Status status = 4; + string status_at = 5; } diff --git a/x/session/keeper/abci.go b/x/session/keeper/abci.go index c0c58b24..84ca5a68 100644 --- a/x/session/keeper/abci.go +++ b/x/session/keeper/abci.go @@ -60,6 +60,7 @@ func (k *Keeper) handleInactiveSessions(ctx sdk.Context) { AccAddress: item.GetAccAddress(), NodeAddress: item.GetNodeAddress(), Status: v1base.StatusInactive, + StatusAt: ctx.BlockTime().String(), }, ) diff --git a/x/session/keeper/msg_handler.go b/x/session/keeper/msg_handler.go index 95d40a4c..93508bef 100644 --- a/x/session/keeper/msg_handler.go +++ b/x/session/keeper/msg_handler.go @@ -48,6 +48,7 @@ func (k *Keeper) HandleMsgCancelSession(ctx sdk.Context, msg *v3.MsgCancelSessio AccAddress: session.GetAccAddress(), NodeAddress: session.GetNodeAddress(), Status: session.GetStatus(), + StatusAt: session.GetStatusAt().String(), }, ) diff --git a/x/session/types/v3/events.pb.go b/x/session/types/v3/events.pb.go index b6e804e5..3d9b69f7 100644 --- a/x/session/types/v3/events.pb.go +++ b/x/session/types/v3/events.pb.go @@ -155,6 +155,7 @@ type EventUpdateStatus struct { AccAddress string `protobuf:"bytes,2,opt,name=acc_address,json=accAddress,proto3" json:"acc_address,omitempty"` NodeAddress string `protobuf:"bytes,3,opt,name=node_address,json=nodeAddress,proto3" json:"node_address,omitempty"` Status v1.Status `protobuf:"varint,4,opt,name=status,proto3,enum=sentinel.types.v1.Status" json:"status,omitempty"` + StatusAt string `protobuf:"bytes,5,opt,name=status_at,json=statusAt,proto3" json:"status_at,omitempty"` } func (m *EventUpdateStatus) Reset() { *m = EventUpdateStatus{} } @@ -200,37 +201,38 @@ func init() { func init() { proto.RegisterFile("sentinel/session/v3/events.proto", fileDescriptor_47270c2f5ae48583) } var fileDescriptor_47270c2f5ae48583 = []byte{ - // 470 bytes of a gzipped FileDescriptorProto + // 485 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0x3f, 0x8f, 0xd3, 0x30, - 0x18, 0xc6, 0xe3, 0x72, 0x94, 0xe2, 0x70, 0x95, 0x08, 0xe8, 0x94, 0xbb, 0x21, 0x2d, 0x95, 0x4e, - 0xea, 0x82, 0xad, 0xb6, 0x03, 0x23, 0xa2, 0x2a, 0x03, 0x1b, 0x0a, 0x62, 0x80, 0x81, 0xca, 0x89, - 0xdd, 0x9c, 0x45, 0x6a, 0x47, 0xb1, 0x93, 0xa3, 0xdf, 0x82, 0x91, 0x99, 0x05, 0x3e, 0x4a, 0xc7, - 0x1b, 0x99, 0x0e, 0x48, 0x3f, 0x06, 0x0b, 0x8a, 0xe3, 0x44, 0x37, 0x9f, 0x74, 0x5b, 0xde, 0xe7, - 0xfd, 0xd9, 0xef, 0x9f, 0x3c, 0x86, 0x63, 0xc5, 0x84, 0xe6, 0x82, 0xa5, 0x58, 0x31, 0xa5, 0xb8, - 0x14, 0xb8, 0x5c, 0x60, 0x56, 0x32, 0xa1, 0x15, 0xca, 0x72, 0xa9, 0xa5, 0xf7, 0xa4, 0x25, 0x90, - 0x25, 0x50, 0xb9, 0x38, 0x7b, 0x9a, 0xc8, 0x44, 0x9a, 0x3c, 0xae, 0xbf, 0x1a, 0xf4, 0x2c, 0x48, - 0xa4, 0x4c, 0x52, 0x86, 0x4d, 0x14, 0x15, 0x1b, 0x4c, 0x8b, 0x9c, 0xe8, 0xfa, 0x88, 0xcd, 0x77, - 0xc5, 0xf4, 0x2e, 0x63, 0x0a, 0x97, 0x33, 0xac, 0x34, 0xd1, 0x85, 0x2d, 0x35, 0xf9, 0x01, 0xe0, - 0xe0, 0x75, 0x5d, 0xfb, 0x2d, 0xd9,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 0x2c, 0x36, 0xb8, 0xad, 0xf5, 0x5c, 0xac, + 0xd7, 0x69, 0x9c, 0x92, 0x0c, 0x5f, 0x96, 0x11, 0xae, 0xa6, 0x33, 0xfc, 0xb9, 0x7b, 0x96, 0xf6, + 0xc5, 0xcc, 0xa3, 0xbe, 0xde, 0xe1, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xa5, 0x4d, + 0x22, 0xba, 0x03, 0x00, 0x00, } func (m *EventPay) Marshal() (dAtA []byte, err error) { @@ -415,6 +417,13 @@ func (m *EventUpdateStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.StatusAt) > 0 { + i -= len(m.StatusAt) + copy(dAtA[i:], m.StatusAt) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StatusAt))) + i-- + dAtA[i] = 0x2a + } if m.Status != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.Status)) i-- @@ -551,6 +560,10 @@ func (m *EventUpdateStatus) Size() (n int) { if m.Status != 0 { n += 1 + sovEvents(uint64(m.Status)) } + l = len(m.StatusAt) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -1251,6 +1264,38 @@ func (m *EventUpdateStatus) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusAt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatusAt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/session/types/v3/session.go b/x/session/types/v3/session.go index bbcd03cb..3474df7c 100644 --- a/x/session/types/v3/session.go +++ b/x/session/types/v3/session.go @@ -19,6 +19,7 @@ type Session interface { GetInactiveAt() time.Time GetNodeAddress() string GetStatus() v1base.Status + GetStatusAt() time.Time GetUploadBytes() sdkmath.Int SetDownloadBytes(sdkmath.Int) diff --git a/x/subscription/keeper/abci.go b/x/subscription/keeper/abci.go index cbfbc68d..3f12e732 100644 --- a/x/subscription/keeper/abci.go +++ b/x/subscription/keeper/abci.go @@ -55,6 +55,7 @@ func (k *Keeper) handleInactiveSubscriptions(ctx sdk.Context) { PlanID: item.PlanID, AccAddress: item.AccAddress, Status: v1base.StatusInactive, + StatusAt: ctx.BlockTime().String(), }, )