diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index b5fc4f31..d9bc5408 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -6,6 +6,7 @@
- [osmosis/meshsecurity/v1beta1/meshsecurity.proto](#osmosis/meshsecurity/v1beta1/meshsecurity.proto)
- [Params](#osmosis.meshsecurity.v1beta1.Params)
+ - [SlashInfo](#osmosis.meshsecurity.v1beta1.SlashInfo)
- [VirtualStakingMaxCapInfo](#osmosis.meshsecurity.v1beta1.VirtualStakingMaxCapInfo)
- [osmosis/meshsecurity/v1beta1/genesis.proto](#osmosis/meshsecurity/v1beta1/genesis.proto)
@@ -22,6 +23,7 @@
- [Query](#osmosis.meshsecurity.v1beta1.Query)
- [osmosis/meshsecurity/v1beta1/scheduler.proto](#osmosis/meshsecurity/v1beta1/scheduler.proto)
+ - [ScheduledWork](#osmosis.meshsecurity.v1beta1.ScheduledWork)
- [ValidatorAddress](#osmosis.meshsecurity.v1beta1.ValidatorAddress)
- [osmosis/meshsecurity/v1beta1/tx.proto](#osmosis/meshsecurity/v1beta1/tx.proto)
@@ -58,6 +60,25 @@ Params defines the parameters for the x/meshsecurity module.
+
+
+### SlashInfo
+SlashInfo defines info event from slashing
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `infraction_height` | [int64](#int64) | | |
+| `power` | [int64](#int64) | | |
+| `total_slash_amount` | [string](#string) | | |
+| `slash_fraction` | [string](#string) | | |
+| `time_infraction` | [int64](#int64) | | |
+
+
+
+
+
+
### VirtualStakingMaxCapInfo
@@ -238,6 +259,21 @@ Query provides defines the gRPC querier service
+
+
+### ScheduledWork
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `repeat` | [bool](#bool) | | |
+
+
+
+
+
+
### ValidatorAddress
diff --git a/proto/osmosis/meshsecurity/v1beta1/meshsecurity.proto b/proto/osmosis/meshsecurity/v1beta1/meshsecurity.proto
index 02cfc51e..86b5ac3c 100644
--- a/proto/osmosis/meshsecurity/v1beta1/meshsecurity.proto
+++ b/proto/osmosis/meshsecurity/v1beta1/meshsecurity.proto
@@ -36,4 +36,13 @@ message Params {
// MaxGasEndBlocker defines the maximum gas that can be spent in a contract
// sudo callback
uint32 max_gas_end_blocker = 3;
+}
+
+// SlashInfo defines info event from slashing
+message SlashInfo {
+ int64 infraction_height = 1;
+ int64 power = 2;
+ string total_slash_amount = 3;
+ string slash_fraction = 4;
+ int64 time_infraction = 5;
}
\ No newline at end of file
diff --git a/x/meshsecurity/keeper/adapter.go b/x/meshsecurity/keeper/adapter.go
index c7914979..54196a28 100644
--- a/x/meshsecurity/keeper/adapter.go
+++ b/x/meshsecurity/keeper/adapter.go
@@ -120,7 +120,8 @@ func (s StakingDecorator) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, power
if val == nil {
ModuleLogger(ctx).
Error("can not propagate slash: validator not found", "validator", consAddr.String())
- } else if err := s.k.ScheduleSlashed(ctx, val.GetOperator(), power, height, totalSlashAmount, slashRatio); err != nil {
+ // TODO: add TimeInfraction (Needs to be gathered from the caller)
+ } else if err := s.k.ScheduleSlashed(ctx, val.GetOperator(), power, height, totalSlashAmount, slashRatio, 0); err != nil {
ModuleLogger(ctx).
Error("can not propagate slash: schedule event",
"cause", err,
diff --git a/x/meshsecurity/keeper/valset_updates.go b/x/meshsecurity/keeper/valset_updates.go
index 50101d1a..d1a09530 100644
--- a/x/meshsecurity/keeper/valset_updates.go
+++ b/x/meshsecurity/keeper/valset_updates.go
@@ -25,12 +25,13 @@ func (k Keeper) ScheduleUnbonded(ctx sdk.Context, addr sdk.ValAddress) error {
}
// ScheduleSlashed store a validator slash event / data for the valset update report
-func (k Keeper) ScheduleSlashed(ctx sdk.Context, addr sdk.ValAddress, power int64, height int64, totalSlashAmount math.Int, slashRatio sdk.Dec) error {
+func (k Keeper) ScheduleSlashed(ctx sdk.Context, addr sdk.ValAddress, power int64, height int64, totalSlashAmount math.Int, slashRatio sdk.Dec, timeInfraction int64) error {
var slashInfo = &types.SlashInfo{
Power: power,
InfractionHeight: height,
TotalSlashAmount: totalSlashAmount.String(),
SlashFraction: slashRatio.String(),
+ TimeInfraction: timeInfraction,
}
return k.sendAsync(ctx, types.ValidatorSlashed, addr, slashInfo)
}
@@ -59,7 +60,16 @@ func (k Keeper) ScheduleModified(ctx sdk.Context, addr sdk.ValAddress) error {
// and async send to all registered contracts in the end blocker
func (k Keeper) sendAsync(ctx sdk.Context, op types.PipedValsetOperation, valAddr sdk.ValAddress, slashInfo *types.SlashInfo) error {
ModuleLogger(ctx).Debug("storing for async update", "operation", int(op), "val", valAddr.String())
- ctx.KVStore(k.memKey).Set(types.BuildPipedValsetOpKey(op, valAddr, slashInfo), []byte{})
+ if op == types.ValidatorSlashed {
+ value, err := slashInfo.Marshal()
+ if err != nil {
+ return err
+ }
+ ctx.KVStore(k.memKey).Set(types.BuildPipedValsetOpKey(op, valAddr), value)
+ } else {
+ ctx.KVStore(k.memKey).Set(types.BuildPipedValsetOpKey(op, valAddr), []byte{})
+ }
+
// and schedule an update callback for all registered contracts
var innerErr error
k.IterateMaxCapLimit(ctx, func(contractAddr sdk.AccAddress, m math.Int) bool {
@@ -127,8 +137,7 @@ func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (contract.ValsetUpdate, erro
case types.ValidatorModified:
return appendValidator(&r.Updated, valAddr)
case types.ValidatorSlashed:
- // TODO: Add / send the infraction time
- return slashValidator(&r.Slashed, valAddr, slashInfo.Power, slashInfo.InfractionHeight, 0,
+ return slashValidator(&r.Slashed, valAddr, slashInfo.Power, slashInfo.InfractionHeight, slashInfo.TimeInfraction,
slashInfo.TotalSlashAmount, slashInfo.SlashFraction)
default:
innerErr = types.ErrInvalid.Wrapf("undefined operation type %X", op)
@@ -162,22 +171,15 @@ func (k Keeper) iteratePipedValsetOperations(ctx sdk.Context, cb func(valAddress
iter := pStore.Iterator(nil, nil)
for ; iter.Valid(); iter.Next() {
key := iter.Key()
- addrLen := key[0]
- addr, op := key[1:addrLen+1], key[addrLen+1]
- var slashInfo *types.SlashInfo = nil
+ addr, op := key[:len(key)-1], key[len(key)-1]
+
+ var slashInfo types.SlashInfo
if types.PipedValsetOperation(op) == types.ValidatorSlashed {
- if len(key) <= 1+int(addrLen)+1+8+8+1 {
- return types.ErrInvalid.Wrapf("invalid slash key length %d", len(key))
- }
- totalSlashAmountLen := key[addrLen+2+8+8]
- slashInfo = &types.SlashInfo{
- Power: int64(sdk.BigEndianToUint64(key[addrLen+2 : addrLen+2+8])),
- InfractionHeight: int64(sdk.BigEndianToUint64(key[addrLen+2+8 : addrLen+2+8+8])),
- TotalSlashAmount: string(key[addrLen+2+8+8+1 : addrLen+2+8+8+1+totalSlashAmountLen]),
- SlashFraction: string(key[addrLen+2+8+8+1+totalSlashAmountLen:]),
+ if err := slashInfo.Unmarshal(iter.Value()); err != nil {
+ panic(err)
}
}
- if cb(addr, types.PipedValsetOperation(op), slashInfo) {
+ if cb(addr, types.PipedValsetOperation(op), &slashInfo) {
break
}
}
diff --git a/x/meshsecurity/keeper/valset_updates_test.go b/x/meshsecurity/keeper/valset_updates_test.go
index 5d794593..67d6b754 100644
--- a/x/meshsecurity/keeper/valset_updates_test.go
+++ b/x/meshsecurity/keeper/valset_updates_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
stdrand "math/rand"
"testing"
+ "time"
"github.com/cometbft/cometbft/libs/rand"
"github.com/stretchr/testify/assert"
@@ -232,3 +233,40 @@ func TestClearPipedValsetOperations(t *testing.T) {
// then
assert.Empty(t, FetchAllStoredOperations(t, ctx, k))
}
+
+func TestSetAndGetScheduleSlashed(t *testing.T) {
+ ctx, keepers := CreateDefaultTestInput(t)
+ k := keepers.MeshKeeper
+
+ var valAdrees sdk.ValAddress
+ valAdrees = rand.Bytes(address.Len)
+ slashInfo := &types.SlashInfo{
+ Power: 12,
+ InfractionHeight: 123,
+ TotalSlashAmount: sdk.NewInt(1000).String(),
+ SlashFraction: sdk.NewDec(1).String(),
+ TimeInfraction: time.Now().Unix(),
+ }
+ // set
+ err := k.sendAsync(ctx, types.ValidatorSlashed, valAdrees, slashInfo)
+ require.NoError(t, err)
+ // get
+ var getSlash types.SlashInfo
+ var val sdk.ValAddress
+ err = k.iteratePipedValsetOperations(ctx, func(valAddress sdk.ValAddress, op types.PipedValsetOperation, slashInfo *types.SlashInfo) bool {
+
+ if op == types.ValidatorSlashed {
+ getSlash = *slashInfo
+ val = valAddress
+ return true
+ }
+ return false
+ })
+ require.NoError(t, err)
+ // check
+ require.Equal(t, slashInfo.TimeInfraction, getSlash.TimeInfraction)
+ require.Equal(t, slashInfo.Power, getSlash.Power)
+ require.Equal(t, slashInfo.InfractionHeight, getSlash.InfractionHeight)
+ require.Equal(t, slashInfo.TotalSlashAmount, getSlash.TotalSlashAmount)
+ require.Equal(t, valAdrees, val)
+}
diff --git a/x/meshsecurity/types/keys.go b/x/meshsecurity/types/keys.go
index fa21f06c..3e8a4709 100644
--- a/x/meshsecurity/types/keys.go
+++ b/x/meshsecurity/types/keys.go
@@ -1,9 +1,7 @@
package types
import (
- "encoding/binary"
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/address"
)
const (
@@ -46,13 +44,6 @@ const (
ValidatorSlashed
)
-type SlashInfo struct {
- InfractionHeight int64
- Power int64
- TotalSlashAmount string
- SlashFraction string
-}
-
// BuildMaxCapLimitKey build max cap limit store key
func BuildMaxCapLimitKey(contractAddr sdk.AccAddress) []byte {
return append(MaxCapLimitKeyPrefix, contractAddr.Bytes()...)
@@ -90,32 +81,11 @@ func BuildSchedulerContractKey(tp SchedulerTaskType, blockHeight uint64, contrac
}
// BuildPipedValsetOpKey build store key for the temporary valset operation store
-func BuildPipedValsetOpKey(op PipedValsetOperation, val sdk.ValAddress, slashInfo *SlashInfo) []byte {
+func BuildPipedValsetOpKey(op PipedValsetOperation, val sdk.ValAddress) []byte {
if op == ValsetOperationUndefined {
panic("empty operation")
}
- pn, an := len(PipedValsetPrefix), len(val)
- sn := 0
- if op == ValidatorSlashed {
- if slashInfo == nil {
- panic("slash info is nil")
- }
- sn = 8 + 8 + 1 + len(slashInfo.TotalSlashAmount) + len(slashInfo.SlashFraction) // 8 for height, 8 for power, +1 for total amount length
- }
- r := make([]byte, pn+an+sn+1+1) // +1 for address prefix, +1 for op
- copy(r, PipedValsetPrefix)
- copy(r[pn:], address.MustLengthPrefix(val))
- r[pn+an+1] = byte(op)
- if op == ValidatorSlashed {
- b := make([]byte, 8)
- binary.BigEndian.PutUint64(b, uint64(slashInfo.InfractionHeight))
- copy(r[pn+an+1+1:], b)
- binary.BigEndian.PutUint64(b, uint64(slashInfo.Power))
- copy(r[pn+an+1+1+8:], b)
- tn := len(slashInfo.TotalSlashAmount)
- r[pn+an+1+1+8+8] = byte(tn)
- copy(r[pn+an+1+1+8+8+1:], slashInfo.TotalSlashAmount)
- copy(r[pn+an+1+1+8+8+1+tn:], slashInfo.SlashFraction)
- }
- return r
+ k := append(append(PipedValsetPrefix, val...), byte(op))
+ // return
+ return k
}
diff --git a/x/meshsecurity/types/meshsecurity.pb.go b/x/meshsecurity/types/meshsecurity.pb.go
index 91e1950b..5120a67b 100644
--- a/x/meshsecurity/types/meshsecurity.pb.go
+++ b/x/meshsecurity/types/meshsecurity.pb.go
@@ -5,22 +5,19 @@ package types
import (
fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
-var (
- _ = proto.Marshal
- _ = fmt.Errorf
- _ = math.Inf
-)
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@@ -45,11 +42,9 @@ func (*VirtualStakingMaxCapInfo) ProtoMessage() {}
func (*VirtualStakingMaxCapInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_53771980e3e4256c, []int{0}
}
-
func (m *VirtualStakingMaxCapInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-
func (m *VirtualStakingMaxCapInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VirtualStakingMaxCapInfo.Marshal(b, m, deterministic)
@@ -62,15 +57,12 @@ func (m *VirtualStakingMaxCapInfo) XXX_Marshal(b []byte, deterministic bool) ([]
return b[:n], nil
}
}
-
func (m *VirtualStakingMaxCapInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_VirtualStakingMaxCapInfo.Merge(m, src)
}
-
func (m *VirtualStakingMaxCapInfo) XXX_Size() int {
return m.Size()
}
-
func (m *VirtualStakingMaxCapInfo) XXX_DiscardUnknown() {
xxx_messageInfo_VirtualStakingMaxCapInfo.DiscardUnknown(m)
}
@@ -95,11 +87,9 @@ func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_53771980e3e4256c, []int{1}
}
-
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
@@ -112,24 +102,64 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
-
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
-
func (m *Params) XXX_Size() int {
return m.Size()
}
-
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
+// SlashInfo defines info event from slashing
+type SlashInfo struct {
+ InfractionHeight int64 `protobuf:"varint,1,opt,name=infraction_height,json=infractionHeight,proto3" json:"infraction_height,omitempty"`
+ Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
+ TotalSlashAmount string `protobuf:"bytes,3,opt,name=total_slash_amount,json=totalSlashAmount,proto3" json:"total_slash_amount,omitempty"`
+ SlashFraction string `protobuf:"bytes,4,opt,name=slash_fraction,json=slashFraction,proto3" json:"slash_fraction,omitempty"`
+ TimeInfraction int64 `protobuf:"varint,5,opt,name=time_infraction,json=timeInfraction,proto3" json:"time_infraction,omitempty"`
+}
+
+func (m *SlashInfo) Reset() { *m = SlashInfo{} }
+func (m *SlashInfo) String() string { return proto.CompactTextString(m) }
+func (*SlashInfo) ProtoMessage() {}
+func (*SlashInfo) Descriptor() ([]byte, []int) {
+ return fileDescriptor_53771980e3e4256c, []int{2}
+}
+func (m *SlashInfo) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *SlashInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_SlashInfo.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 *SlashInfo) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SlashInfo.Merge(m, src)
+}
+func (m *SlashInfo) XXX_Size() int {
+ return m.Size()
+}
+func (m *SlashInfo) XXX_DiscardUnknown() {
+ xxx_messageInfo_SlashInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SlashInfo proto.InternalMessageInfo
+
func init() {
proto.RegisterType((*VirtualStakingMaxCapInfo)(nil), "osmosis.meshsecurity.v1beta1.VirtualStakingMaxCapInfo")
proto.RegisterType((*Params)(nil), "osmosis.meshsecurity.v1beta1.Params")
+ proto.RegisterType((*SlashInfo)(nil), "osmosis.meshsecurity.v1beta1.SlashInfo")
}
func init() {
@@ -137,33 +167,40 @@ func init() {
}
var fileDescriptor_53771980e3e4256c = []byte{
- // 416 bytes of a gzipped FileDescri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2d, 0xb1, 0x7e, 0x6c, 0x89, 0xf5,
- 0xee, 0x59, 0xc2, 0x75, 0xba, 0x8c, 0x3c, 0x2a, 0xf3, 0x6e, 0x91, 0xdc, 0x0c, 0xa2, 0x76, 0x9b,
- 0xdc, 0x4e, 0xcf, 0x55, 0xf1, 0xc2, 0xaf, 0xfa, 0x1b, 0xa6, 0x57, 0x05, 0x53, 0xd1, 0x89, 0x19,
- 0xf6, 0x93, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x98, 0xcb, 0x62, 0xae, 0x86, 0x02, 0x00, 0x00,
+ // 523 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0x6e, 0xd3, 0x40,
+ 0x10, 0xc6, 0xbd, 0xa4, 0xad, 0xc8, 0x96, 0x96, 0x74, 0x1b, 0x09, 0x13, 0x55, 0x6e, 0x89, 0x84,
+ 0xa8, 0x80, 0xd8, 0x0a, 0xdc, 0x2a, 0x81, 0x44, 0x22, 0xfe, 0x54, 0x02, 0x09, 0xb9, 0x52, 0x0f,
+ 0x5c, 0xcc, 0xd8, 0xd9, 0xda, 0xab, 0xd8, 0xbb, 0x96, 0x77, 0x03, 0xe9, 0x2b, 0x70, 0xe2, 0x11,
+ 0x38, 0x72, 0x42, 0x3c, 0x46, 0x0e, 0x1c, 0x72, 0xe4, 0x84, 0x20, 0x39, 0xc0, 0x63, 0x20, 0xef,
+ 0xc6, 0x89, 0x72, 0xeb, 0x25, 0xda, 0xfd, 0xcd, 0x7e, 0x33, 0xdf, 0x4c, 0x3c, 0xd8, 0x13, 0x32,
+ 0x13, 0x92, 0x49, 0x2f, 0xa3, 0x32, 0x91, 0x34, 0x1a, 0x15, 0x4c, 0x5d, 0x7a, 0x1f, 0xba, 0x21,
+ 0x55, 0xd0, 0x5d, 0x83, 0x6e, 0x5e, 0x08, 0x25, 0xc8, 0xc1, 0x42, 0x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 0x74,
+ 0x23, 0x91, 0x55, 0x7b, 0xd1, 0x49, 0x21, 0x34, 0xcb, 0xd1, 0xa9, 0xc6, 0xd3, 0x91, 0x83, 0xa1,
+ 0x37, 0x5e, 0x5f, 0x18, 0x75, 0x99, 0x53, 0x19, 0x6e, 0xe9, 0x6f, 0xf7, 0xf1, 0xff, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x1d, 0x59, 0xc6, 0xcb, 0x55, 0x03, 0x00, 0x00,
}
func (this *VirtualStakingMaxCapInfo) Equal(that interface{}) bool {
@@ -196,7 +233,6 @@ func (this *VirtualStakingMaxCapInfo) Equal(that interface{}) bool {
}
return true
}
-
func (this *Params) Equal(that interface{}) bool {
if that == nil {
return this == nil
@@ -227,7 +263,6 @@ func (this *Params) Equal(that interface{}) bool {
}
return true
}
-
func (m *VirtualStakingMaxCapInfo) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -321,6 +356,58 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *SlashInfo) 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 *SlashInfo) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *SlashInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.TimeInfraction != 0 {
+ i = encodeVarintMeshsecurity(dAtA, i, uint64(m.TimeInfraction))
+ i--
+ dAtA[i] = 0x28
+ }
+ if len(m.SlashFraction) > 0 {
+ i -= len(m.SlashFraction)
+ copy(dAtA[i:], m.SlashFraction)
+ i = encodeVarintMeshsecurity(dAtA, i, uint64(len(m.SlashFraction)))
+ i--
+ dAtA[i] = 0x22
+ }
+ if len(m.TotalSlashAmount) > 0 {
+ i -= len(m.TotalSlashAmount)
+ copy(dAtA[i:], m.TotalSlashAmount)
+ i = encodeVarintMeshsecurity(dAtA, i, uint64(len(m.TotalSlashAmount)))
+ i--
+ dAtA[i] = 0x1a
+ }
+ if m.Power != 0 {
+ i = encodeVarintMeshsecurity(dAtA, i, uint64(m.Power))
+ i--
+ dAtA[i] = 0x10
+ }
+ if m.InfractionHeight != 0 {
+ i = encodeVarintMeshsecurity(dAtA, i, uint64(m.InfractionHeight))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintMeshsecurity(dAtA []byte, offset int, v uint64) int {
offset -= sovMeshsecurity(v)
base := offset
@@ -332,7 +419,6 @@ func encodeVarintMeshsecurity(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
-
func (m *VirtualStakingMaxCapInfo) Size() (n int) {
if m == nil {
return 0
@@ -367,14 +453,38 @@ func (m *Params) Size() (n int) {
return n
}
+func (m *SlashInfo) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.InfractionHeight != 0 {
+ n += 1 + sovMeshsecurity(uint64(m.InfractionHeight))
+ }
+ if m.Power != 0 {
+ n += 1 + sovMeshsecurity(uint64(m.Power))
+ }
+ l = len(m.TotalSlashAmount)
+ if l > 0 {
+ n += 1 + l + sovMeshsecurity(uint64(l))
+ }
+ l = len(m.SlashFraction)
+ if l > 0 {
+ n += 1 + l + sovMeshsecurity(uint64(l))
+ }
+ if m.TimeInfraction != 0 {
+ n += 1 + sovMeshsecurity(uint64(m.TimeInfraction))
+ }
+ return n
+}
+
func sovMeshsecurity(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
-
func sozMeshsecurity(x uint64) (n int) {
return sovMeshsecurity(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
-
func (m *VirtualStakingMaxCapInfo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -523,7 +633,6 @@ func (m *VirtualStakingMaxCapInfo) Unmarshal(dAtA []byte) error {
}
return nil
}
-
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -645,7 +754,177 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *SlashInfo) 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 ErrIntOverflowMeshsecurity
+ }
+ 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: SlashInfo: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: SlashInfo: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field InfractionHeight", wireType)
+ }
+ m.InfractionHeight = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowMeshsecurity
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.InfractionHeight |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType)
+ }
+ m.Power = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowMeshsecurity
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Power |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field TotalSlashAmount", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowMeshsecurity
+ }
+ 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 ErrInvalidLengthMeshsecurity
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthMeshsecurity
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.TotalSlashAmount = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowMeshsecurity
+ }
+ 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 ErrInvalidLengthMeshsecurity
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthMeshsecurity
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.SlashFraction = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 5:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field TimeInfraction", wireType)
+ }
+ m.TimeInfraction = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowMeshsecurity
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.TimeInfraction |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipMeshsecurity(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthMeshsecurity
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipMeshsecurity(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0