Add a method to update bond module params
All checks were successful
Protobuf / lint (pull_request) Successful in 24s
Build / build (pull_request) Successful in 3m4s
Integration Tests / test-integration (pull_request) Successful in 2m56s
E2E Tests / test-e2e (pull_request) Successful in 4m12s
Unit Tests / test-unit (pull_request) Successful in 2m14s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 9m4s
SDK Tests / sdk_tests (pull_request) Successful in 8m42s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 14m28s

This commit is contained in:
Prathamesh Musale 2024-08-22 19:22:23 +05:30
parent debfb82205
commit c7f9ef6576
11 changed files with 1745 additions and 165 deletions

View File

@ -15,11 +15,13 @@ import (
var (
md_Module protoreflect.MessageDescriptor
fd_Module_authority protoreflect.FieldDescriptor
)
func init() {
file_cerc_bond_module_v1_module_proto_init()
md_Module = File_cerc_bond_module_v1_module_proto.Messages().ByName("Module")
fd_Module_authority = md_Module.Fields().ByName("authority")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
@ -87,6 +89,12 @@ func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Authority != "" {
value := protoreflect.ValueOfString(x.Authority)
if !f(fd_Module_authority, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -102,6 +110,8 @@ func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, proto
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return x.Authority != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -118,6 +128,8 @@ func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -134,6 +146,9 @@ func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "cerc.bond.module.v1.Module.authority":
value := x.Authority
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -154,6 +169,8 @@ func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) pro
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
x.Authority = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -174,6 +191,8 @@ func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value proto
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
panic(fmt.Errorf("field authority of message cerc.bond.module.v1.Module is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -187,6 +206,8 @@ func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protore
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "cerc.bond.module.v1.Module.authority":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.module.v1.Module"))
@ -256,6 +277,10 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
var n int
var l int
_ = l
l = len(x.Authority)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -285,6 +310,13 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.Authority) > 0 {
i -= len(x.Authority)
copy(dAtA[i:], x.Authority)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))
i--
dAtA[i] = 0x12
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
@ -334,6 +366,38 @@ func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -388,6 +452,10 @@ type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (x *Module) Reset() {
@ -410,6 +478,13 @@ func (*Module) Descriptor() ([]byte, []int) {
return file_cerc_bond_module_v1_module_proto_rawDescGZIP(), []int{0}
}
func (x *Module) GetAuthority() string {
if x != nil {
return x.Authority
}
return ""
}
var File_cerc_bond_module_v1_module_proto protoreflect.FileDescriptor
var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
@ -418,24 +493,26 @@ var file_cerc_bond_module_v1_module_proto_rawDesc = []byte{
0x74, 0x6f, 0x12, 0x13, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74,
0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f,
0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42,
0xd3, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e,
0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e,
0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c,
0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63,
0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02,
0x13, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64,
0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72,
0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43,
0x65, 0x72, 0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x06, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74,
0x79, 0x3a, 0x2a, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x24, 0x0a, 0x22, 0x67, 0x69, 0x74, 0x2e, 0x76,
0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61,
0x63, 0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x78, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x42, 0xd3, 0x01,
0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64,
0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63,
0x6f, 0x6e, 0x69, 0x63, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62,
0x6f, 0x6e, 0x64, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x4d, 0xaa, 0x02, 0x13, 0x43,
0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x65, 0x72, 0x63, 0x5c,
0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x65, 0x72,
0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ const (
Msg_RefillBond_FullMethodName = "/cerc.bond.v1.Msg/RefillBond"
Msg_WithdrawBond_FullMethodName = "/cerc.bond.v1.Msg/WithdrawBond"
Msg_CancelBond_FullMethodName = "/cerc.bond.v1.Msg/CancelBond"
Msg_UpdateParams_FullMethodName = "/cerc.bond.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
@ -37,6 +38,9 @@ type MsgClient interface {
WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -83,6 +87,15 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -95,6 +108,9 @@ type MsgServer interface {
WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -114,6 +130,9 @@ func (UnimplementedMsgServer) WithdrawBond(context.Context, *MsgWithdrawBond) (*
func (UnimplementedMsgServer) CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -199,6 +218,24 @@ func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -222,6 +259,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CancelBond",
Handler: _Msg_CancelBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/bond/v1/tx.proto",

View File

@ -10,4 +10,8 @@ message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "git.vdb.to/cerc-io/laconicd/x/bond"
};
// authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}

View File

@ -6,6 +6,8 @@ import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cerc/bond/v1/bond.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/bond";
@ -32,6 +34,10 @@ service Msg {
rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse) {
option (google.api.http).post = "/cerc/bond/v1/cancel_bond";
};
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgCreateBond defines a SDK message for creating a new bond.
@ -91,3 +97,21 @@ message MsgCancelBond {
// MsgCancelBondResponse defines the Msg/CancelBond response type.
message MsgCancelBondResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the x/bond parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};

View File

@ -101,7 +101,7 @@ func (tf *TestFixture) Setup() error {
auctionKeeper := auctionkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[auctionTypes.StoreKey]), accountKeeper, bankKeeper)
bondKeeper := bondkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[bondTypes.StoreKey]), accountKeeper, bankKeeper)
bondKeeper := bondkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[bondTypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
registryKeeper := registrykeeper.NewKeeper(
cdc,

View File

@ -45,6 +45,8 @@ type Keeper struct {
// Codecs
cdc codec.BinaryCodec
authority string
// External keepers
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
@ -64,10 +66,17 @@ func NewKeeper(
storeService store.KVStoreService,
accountKeeper auth.AccountKeeper,
bankKeeper bank.Keeper,
authority string,
) *Keeper {
// ensure that authority is a valid AccAddress
if _, err := accountKeeper.AddressCodec().StringToBytes(authority); err != nil {
panic("authority is not a valid acc address")
}
sb := collections.NewSchemaBuilder(storeService)
k := Keeper{
cdc: cdc,
authority: authority,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
Params: collections.NewItem(sb, bondtypes.ParamsPrefix, "params", codec.CollValue[bondtypes.Params](cdc)),
@ -355,6 +364,11 @@ func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre
return &bond, nil
}
// GetAuthority returns the x/bond module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// GetParams gets the bond module's parameters.
func (k Keeper) GetParams(ctx sdk.Context) (*bondtypes.Params, error) {
params, err := k.Params.Get(ctx)
@ -365,6 +379,11 @@ func (k Keeper) GetParams(ctx sdk.Context) (*bondtypes.Params, error) {
return &params, nil
}
// SetParams sets the x/bond module parameters.
func (k Keeper) SetParams(ctx sdk.Context, params bondtypes.Params) error {
return k.Params.Set(ctx, params)
}
func (k Keeper) getMaxBondAmount(ctx sdk.Context) (sdk.Coins, error) {
params, err := k.GetParams(ctx)
if err != nil {

View File

@ -3,7 +3,9 @@ package keeper
import (
"context"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"git.vdb.to/cerc-io/laconicd/utils"
"git.vdb.to/cerc-io/laconicd/x/bond"
@ -168,3 +170,22 @@ func (ms msgServer) CancelBond(c context.Context, msg *bond.MsgCancelBond) (*bon
return &bond.MsgCancelBondResponse{}, nil
}
// UpdateParams defines a method to perform updation of module params.
func (ms msgServer) UpdateParams(c context.Context, msg *bond.MsgUpdateParams) (*bond.MsgUpdateParamsResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
if err := ms.k.SetParams(ctx, msg.Params); err != nil {
return nil, err
}
return &bond.MsgUpdateParamsResponse{}, nil
}

View File

@ -88,6 +88,10 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
{ProtoField: "id"},
},
},
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
},
},
}

View File

@ -7,7 +7,9 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/bond/module/v1"
"git.vdb.to/cerc-io/laconicd/x/bond"
@ -33,6 +35,7 @@ func init() {
type ModuleInputs struct {
depinject.In
Config *modulev1.Module
Cdc codec.Codec
StoreService store.KVStoreService
@ -48,7 +51,13 @@ type ModuleOutputs struct {
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper)
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper, authority.String())
m := NewAppModule(in.Cdc, k)
return ModuleOutputs{Module: m, Keeper: k}

View File

@ -6,6 +6,7 @@ package bond
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
@ -416,6 +417,102 @@ func (m *MsgCancelBondResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgCancelBondResponse proto.InternalMessageInfo
// MsgUpdateParams is the Msg/UpdateParams request type.
type MsgUpdateParams struct {
// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// params defines the x/bond parameters to update.
//
// NOTE: All parameters must be supplied.
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_efb1a132c2c5bd62, []int{8}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
func (m *MsgUpdateParams) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateParams) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_efb1a132c2c5bd62, []int{9}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgCreateBond)(nil), "cerc.bond.v1.MsgCreateBond")
proto.RegisterType((*MsgCreateBondResponse)(nil), "cerc.bond.v1.MsgCreateBondResponse")
@ -425,47 +522,56 @@ func init() {
proto.RegisterType((*MsgWithdrawBondResponse)(nil), "cerc.bond.v1.MsgWithdrawBondResponse")
proto.RegisterType((*MsgCancelBond)(nil), "cerc.bond.v1.MsgCancelBond")
proto.RegisterType((*MsgCancelBondResponse)(nil), "cerc.bond.v1.MsgCancelBondResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "cerc.bond.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cerc.bond.v1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("cerc/bond/v1/tx.proto", fileDescriptor_efb1a132c2c5bd62) }
var fileDescriptor_efb1a132c2c5bd62 = []byte{
// 548 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x41, 0x6f, 0xd3, 0x30,
0x18, 0x6d, 0x5a, 0x6d, 0x12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ca, 0x8d,
0xe0, 0xb0, 0xdb, 0x2c, 0x5c, 0xe0, 0xb6, 0x68, 0x62, 0x6a, 0x63, 0x6f, 0xcf, 0xf6, 0x57, 0xad,
0xe6, 0xfd, 0xc3, 0x13, 0xc7, 0x3a, 0x3a, 0x71, 0xac, 0x9f, 0x27, 0x8e, 0xf5, 0xfe, 0xd4, 0x29,
0x1d, 0x9d, 0x3a, 0xa5, 0xef, 0xa7, 0x4e, 0xe9, 0xb9, 0x4b, 0xa8, 0xf4, 0x7a, 0x41, 0xc7, 0x4b,
0xae, 0x0c, 0x1c, 0xfb, 0x6b, 0x94, 0xc3, 0x2e, 0xf2, 0x39, 0xa3, 0x7e, 0x00, 0x77, 0x95, 0xd2,
0xce, 0xb8, 0xba, 0x2b, 0xee, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xef, 0x34, 0xfa, 0x7f, 0xf3,
0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -488,6 +594,9 @@ type MsgClient interface {
WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -534,6 +643,15 @@ func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...g
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/cerc.bond.v1.Msg/UpdateParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// CreateBond defines a method for creating a new bond.
@ -544,6 +662,9 @@ type MsgServer interface {
WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error)
// CancelBond defines a method for cancelling a bond.
CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error)
// UpdateParams defines an operation for updating the x/staking module
// parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -562,6 +683,9 @@ func (*UnimplementedMsgServer) WithdrawBond(ctx context.Context, req *MsgWithdra
func (*UnimplementedMsgServer) CancelBond(ctx context.Context, req *MsgCancelBond) (*MsgCancelBondResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -639,6 +763,24 @@ func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cerc.bond.v1.Msg/UpdateParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.bond.v1.Msg",
HandlerType: (*MsgServer)(nil),
@ -659,6 +801,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "CancelBond",
Handler: _Msg_CancelBond_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cerc/bond/v1/tx.proto",
@ -946,6 +1092,69 @@ func (m *MsgCancelBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -1079,6 +1288,30 @@ func (m *MsgCancelBondResponse) Size() (n int) {
return n
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Params.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1843,6 +2076,171 @@ func (m *MsgCancelBondResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgUpdateParams) 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 ErrIntOverflowTx
}
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: MsgUpdateParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParamsResponse) 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 ErrIntOverflowTx
}
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: MsgUpdateParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0