diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go index 36039d344..47fb7a9c7 100644 --- a/api/poktroll/proof/params.pulsar.go +++ b/api/poktroll/proof/params.pulsar.go @@ -99,8 +99,8 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ProofRequestProbability != float32(0) || math.Signbit(float64(x.ProofRequestProbability)) { - value := protoreflect.ValueOfFloat32(x.ProofRequestProbability) + if x.ProofRequestProbability != float64(0) || math.Signbit(x.ProofRequestProbability) { + value := protoreflect.ValueOfFloat64(x.ProofRequestProbability) if !f(fd_Params_proof_request_probability, value) { return } @@ -139,7 +139,7 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.proof.Params.proof_request_probability": - return x.ProofRequestProbability != float32(0) || math.Signbit(float64(x.ProofRequestProbability)) + return x.ProofRequestProbability != float64(0) || math.Signbit(x.ProofRequestProbability) case "poktroll.proof.Params.proof_requirement_threshold": return x.ProofRequirementThreshold != nil case "poktroll.proof.Params.proof_missing_penalty": @@ -163,7 +163,7 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.proof.Params.proof_request_probability": - x.ProofRequestProbability = float32(0) + x.ProofRequestProbability = float64(0) case "poktroll.proof.Params.proof_requirement_threshold": x.ProofRequirementThreshold = nil case "poktroll.proof.Params.proof_missing_penalty": @@ -188,7 +188,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro switch descriptor.FullName() { case "poktroll.proof.Params.proof_request_probability": value := x.ProofRequestProbability - return protoreflect.ValueOfFloat32(value) + return protoreflect.ValueOfFloat64(value) case "poktroll.proof.Params.proof_requirement_threshold": value := x.ProofRequirementThreshold return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -219,7 +219,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.proof.Params.proof_request_probability": - x.ProofRequestProbability = float32(value.Float()) + x.ProofRequestProbability = value.Float() case "poktroll.proof.Params.proof_requirement_threshold": x.ProofRequirementThreshold = value.Message().Interface().(*v1beta1.Coin) case "poktroll.proof.Params.proof_missing_penalty": @@ -277,7 +277,7 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.proof.Params.proof_request_probability": - return protoreflect.ValueOfFloat32(float32(0)) + return protoreflect.ValueOfFloat64(float64(0)) case "poktroll.proof.Params.proof_requirement_threshold": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) @@ -356,8 +356,8 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.ProofRequestProbability != 0 || math.Signbit(float64(x.ProofRequestProbability)) { - n += 5 + if x.ProofRequestProbability != 0 || math.Signbit(x.ProofRequestProbability) { + n += 9 } if x.ProofRequirementThreshold != nil { l = options.Size(x.ProofRequirementThreshold) @@ -442,11 +442,11 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x1a } - if x.ProofRequestProbability != 0 || math.Signbit(float64(x.ProofRequestProbability)) { - i -= 4 - binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(x.ProofRequestProbability)))) + if x.ProofRequestProbability != 0 || math.Signbit(x.ProofRequestProbability) { + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(x.ProofRequestProbability)))) i-- - dAtA[i] = 0x15 + dAtA[i] = 0x11 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -498,16 +498,16 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 2: - if wireType != 5 { + if wireType != 1 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequestProbability", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - x.ProofRequestProbability = float32(math.Float32frombits(v)) + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + x.ProofRequestProbability = float64(math.Float64frombits(v)) case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequirementThreshold", wireType) @@ -672,7 +672,7 @@ type Params struct { // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. - ProofRequestProbability float32 `protobuf:"fixed32,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability,omitempty"` + ProofRequestProbability float64 `protobuf:"fixed64,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability,omitempty"` // proof_requirement_threshold is the session cost (i.e. compute unit consumption) // threshold which asserts that a session MUST have a corresponding proof when its cost // is equal to or above the threshold. This is in contrast to the this requirement @@ -713,7 +713,7 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_proof_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetProofRequestProbability() float32 { +func (x *Params) GetProofRequestProbability() float64 { if x != nil { return x.ProofRequestProbability } @@ -754,7 +754,7 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x02, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, + 0x20, 0x01, 0x28, 0x01, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x17, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x7a, 0x0a, 0x1b, diff --git a/api/poktroll/proof/tx.pulsar.go b/api/poktroll/proof/tx.pulsar.go index 3be72003c..cc72dd116 100644 --- a/api/poktroll/proof/tx.pulsar.go +++ b/api/poktroll/proof/tx.pulsar.go @@ -5,13 +5,13 @@ import ( _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" - session "github.com/pokt-network/poktroll/api/poktroll/session" - _ "github.com/pokt-network/poktroll/api/poktroll/shared" binary "encoding/binary" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + session "github.com/pokt-network/poktroll/api/poktroll/session" + _ "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -982,7 +982,7 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } case *MsgUpdateParam_AsFloat: v := o.AsFloat - value := protoreflect.ValueOfFloat32(v) + value := protoreflect.ValueOfFloat64(v) if !f(fd_MsgUpdateParam_as_float, value) { return } @@ -1095,11 +1095,11 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip } case "poktroll.proof.MsgUpdateParam.as_float": if x.AsType == nil { - return protoreflect.ValueOfFloat32(float32(0)) + return protoreflect.ValueOfFloat64(float64(0)) } else if v, ok := x.AsType.(*MsgUpdateParam_AsFloat); ok { - return protoreflect.ValueOfFloat32(v.AsFloat) + return protoreflect.ValueOfFloat64(v.AsFloat) } else { - return protoreflect.ValueOfFloat32(float32(0)) + return protoreflect.ValueOfFloat64(float64(0)) } case "poktroll.proof.MsgUpdateParam.as_coin": if x.AsType == nil { @@ -1137,7 +1137,7 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val cv := value.Bytes() x.AsType = &MsgUpdateParam_AsBytes{AsBytes: cv} case "poktroll.proof.MsgUpdateParam.as_float": - cv := float32(value.Float()) + cv := value.Float() x.AsType = &MsgUpdateParam_AsFloat{AsFloat: cv} case "poktroll.proof.MsgUpdateParam.as_coin": cv := value.Message().Interface().(*v1beta1.Coin) @@ -1206,7 +1206,7 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor case "poktroll.proof.MsgUpdateParam.as_bytes": return protoreflect.ValueOfBytes(nil) case "poktroll.proof.MsgUpdateParam.as_float": - return protoreflect.ValueOfFloat32(float32(0)) + return protoreflect.ValueOfFloat64(float64(0)) case "poktroll.proof.MsgUpdateParam.as_coin": value := &v1beta1.Coin{} return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -1310,7 +1310,7 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if x == nil { break } - n += 5 + n += 9 case *MsgUpdateParam_AsCoin: if x == nil { break @@ -1355,10 +1355,10 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x3a case *MsgUpdateParam_AsFloat: - i -= 4 - binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(x.AsFloat)))) + i -= 8 + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(x.AsFloat)))) i-- - dAtA[i] = 0x45 + dAtA[i] = 0x41 case *MsgUpdateParam_AsCoin: encoded, err := options.Marshal(x.AsCoin) if err != nil { @@ -1534,16 +1534,16 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { x.AsType = &MsgUpdateParam_AsBytes{v} iNdEx = postIndex case 8: - if wireType != 5 { + if wireType != 1 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsFloat", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - v = uint32(binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - x.AsType = &MsgUpdateParam_AsFloat{float32(math.Float32frombits(v))} + v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + x.AsType = &MsgUpdateParam_AsFloat{float64(math.Float64frombits(v))} case 9: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) @@ -4204,7 +4204,7 @@ func (x *MsgUpdateParam) GetAsBytes() []byte { return nil } -func (x *MsgUpdateParam) GetAsFloat() float32 { +func (x *MsgUpdateParam) GetAsFloat() float64 { if x, ok := x.GetAsType().(*MsgUpdateParam_AsFloat); ok { return x.AsFloat } @@ -4227,7 +4227,7 @@ type MsgUpdateParam_AsBytes struct { } type MsgUpdateParam_AsFloat struct { - AsFloat float32 `protobuf:"fixed32,8,opt,name=as_float,json=asFloat,proto3,oneof"` + AsFloat float64 `protobuf:"fixed64,8,opt,name=as_float,json=asFloat,proto3,oneof"` } type MsgUpdateParam_AsCoin struct { @@ -4494,7 +4494,7 @@ var file_poktroll_proof_tx_proto_rawDesc = []byte{ 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, - 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x42, + 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, diff --git a/api/poktroll/tokenomics/tx.pulsar.go b/api/poktroll/tokenomics/tx.pulsar.go index c64b0ff16..9cf66c7d1 100644 --- a/api/poktroll/tokenomics/tx.pulsar.go +++ b/api/poktroll/tokenomics/tx.pulsar.go @@ -877,7 +877,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_double protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_float protoreflect.FieldDescriptor ) func init() { @@ -885,7 +885,7 @@ func init() { md_MsgUpdateParam = File_poktroll_tokenomics_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_double = md_MsgUpdateParam.Fields().ByName("as_double") + fd_MsgUpdateParam_as_float = md_MsgUpdateParam.Fields().ByName("as_float") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -967,10 +967,10 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } if x.AsType != nil { switch o := x.AsType.(type) { - case *MsgUpdateParam_AsDouble: - v := o.AsDouble + case *MsgUpdateParam_AsFloat: + v := o.AsFloat value := protoreflect.ValueOfFloat64(v) - if !f(fd_MsgUpdateParam_as_double, value) { + if !f(fd_MsgUpdateParam_as_float, value) { return } } @@ -994,10 +994,10 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.tokenomics.MsgUpdateParam.name": return x.Name != "" - case "poktroll.tokenomics.MsgUpdateParam.as_double": + case "poktroll.tokenomics.MsgUpdateParam.as_float": if x.AsType == nil { return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsDouble); ok { + } else if _, ok := x.AsType.(*MsgUpdateParam_AsFloat); ok { return true } else { return false @@ -1022,7 +1022,7 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.tokenomics.MsgUpdateParam.name": x.Name = "" - case "poktroll.tokenomics.MsgUpdateParam.as_double": + case "poktroll.tokenomics.MsgUpdateParam.as_float": x.AsType = nil default: if fd.IsExtension() { @@ -1046,11 +1046,11 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.tokenomics.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.MsgUpdateParam.as_double": + case "poktroll.tokenomics.MsgUpdateParam.as_float": if x.AsType == nil { return protoreflect.ValueOfFloat64(float64(0)) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsDouble); ok { - return protoreflect.ValueOfFloat64(v.AsDouble) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsFloat); ok { + return protoreflect.ValueOfFloat64(v.AsFloat) } else { return protoreflect.ValueOfFloat64(float64(0)) } @@ -1078,9 +1078,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.tokenomics.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.tokenomics.MsgUpdateParam.as_double": + case "poktroll.tokenomics.MsgUpdateParam.as_float": cv := value.Float() - x.AsType = &MsgUpdateParam_AsDouble{AsDouble: cv} + x.AsType = &MsgUpdateParam_AsFloat{AsFloat: cv} default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParam")) @@ -1105,8 +1105,8 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field authority of message poktroll.tokenomics.MsgUpdateParam is not mutable")) case "poktroll.tokenomics.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.tokenomics.MsgUpdateParam is not mutable")) - case "poktroll.tokenomics.MsgUpdateParam.as_double": - panic(fmt.Errorf("field as_double of message poktroll.tokenomics.MsgUpdateParam is not mutable")) + case "poktroll.tokenomics.MsgUpdateParam.as_float": + panic(fmt.Errorf("field as_float of message poktroll.tokenomics.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParam")) @@ -1124,7 +1124,7 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.tokenomics.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.tokenomics.MsgUpdateParam.as_double": + case "poktroll.tokenomics.MsgUpdateParam.as_float": return protoreflect.ValueOfFloat64(float64(0)) default: if fd.IsExtension() { @@ -1144,8 +1144,8 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto return nil } switch x.AsType.(type) { - case *MsgUpdateParam_AsDouble: - return x.Descriptor().Fields().ByName("as_double") + case *MsgUpdateParam_AsFloat: + return x.Descriptor().Fields().ByName("as_float") } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.MsgUpdateParam", d.FullName())) @@ -1212,7 +1212,7 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsDouble: + case *MsgUpdateParam_AsFloat: if x == nil { break } @@ -1248,9 +1248,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsDouble: + case *MsgUpdateParam_AsFloat: i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(x.AsDouble)))) + binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(x.AsFloat)))) i-- dAtA[i] = 0x19 } @@ -1383,7 +1383,7 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 1 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsDouble", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsFloat", wireType) } var v uint64 if (iNdEx + 8) > l { @@ -1391,7 +1391,7 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - x.AsType = &MsgUpdateParam_AsDouble{float64(math.Float64frombits(v))} + x.AsType = &MsgUpdateParam_AsFloat{float64(math.Float64frombits(v))} default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1963,7 +1963,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to AsType: // - // *MsgUpdateParam_AsDouble + // *MsgUpdateParam_AsFloat AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } @@ -2008,9 +2008,9 @@ func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { return nil } -func (x *MsgUpdateParam) GetAsDouble() float64 { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsDouble); ok { - return x.AsDouble +func (x *MsgUpdateParam) GetAsFloat() float64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsFloat); ok { + return x.AsFloat } return 0 } @@ -2019,11 +2019,11 @@ type isMsgUpdateParam_AsType interface { isMsgUpdateParam_AsType() } -type MsgUpdateParam_AsDouble struct { - AsDouble float64 `protobuf:"fixed64,3,opt,name=as_double,json=asDouble,proto3,oneof"` +type MsgUpdateParam_AsFloat struct { + AsFloat float64 `protobuf:"fixed64,3,opt,name=as_float,json=asFloat,proto3,oneof"` } -func (*MsgUpdateParam_AsDouble) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsFloat) isMsgUpdateParam_AsType() {} // MsgUpdateParamResponse defines the response structure for executing a // MsgUpdateParam message after a single param update. @@ -2090,48 +2090,47 @@ var file_poktroll_tokenomics_tx_proto_rawDesc = []byte{ 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x6e, 0x73, 0x65, 0x22, 0xa2, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x01, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x64, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x4d, 0x0a, 0x16, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xd1, 0x01, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x01, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, + 0x61, 0x74, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x0e, 0x82, + 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, + 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x4d, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xd1, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb9, - 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x07, - 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, - 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, - 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb9, 0x01, 0xd8, 0xe2, + 0x1e, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, + 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, + 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2225,7 +2224,7 @@ func file_poktroll_tokenomics_tx_proto_init() { } } file_poktroll_tokenomics_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*MsgUpdateParam_AsDouble)(nil), + (*MsgUpdateParam_AsFloat)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index b54ae28bf..500312c1d 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -261,8 +261,8 @@ func (s *suite) newTokenomicsMsgUpdateParam(authority string, param paramAny) (m msg = proto.Message(&tokenomicstypes.MsgUpdateParam{ Authority: authority, Name: param.name, - AsType: &tokenomicstypes.MsgUpdateParam_AsDouble{ - AsDouble: param.value.(float64), + AsType: &tokenomicstypes.MsgUpdateParam_AsFloat{ + AsFloat: param.value.(float64), }, }) default: diff --git a/pkg/client/interface.go b/pkg/client/interface.go index da564c1e2..0f8c8575a 100644 --- a/pkg/client/interface.go +++ b/pkg/client/interface.go @@ -330,7 +330,7 @@ type BlockQueryClient interface { // protobuf message. Since the generated go types don't include interface types, this // is necessary to prevent dependency cycles. type ProofParams interface { - GetProofRequestProbability() float32 + GetProofRequestProbability() float64 GetProofRequirementThreshold() *cosmostypes.Coin GetProofMissingPenalty() *cosmostypes.Coin GetProofSubmissionFee() *cosmostypes.Coin diff --git a/pkg/crypto/rand/float.go b/pkg/crypto/rand/float.go index 23524893f..c75efec5c 100644 --- a/pkg/crypto/rand/float.go +++ b/pkg/crypto/rand/float.go @@ -8,12 +8,12 @@ import ( "github.com/cometbft/cometbft/crypto" ) -// SeededFloat32 generates a deterministic float32 between 0 and 1 given a seed. +// SeededFloat64 generates a deterministic float64 between 0 and 1 given a seed. // // TODO_MAINNET: To support other language implementations of the protocol, the // pseudo-random number generator used here should be language-agnostic (i.e. not // golang specific). -func SeededFloat32(seedParts ...[]byte) (float32, error) { +func SeededFloat64(seedParts ...[]byte) float64 { seedHashInputBz := bytes.Join(append([][]byte{}, seedParts...), nil) seedHash := crypto.Sha256(seedHashInputBz) seed, _ := binary.Varint(seedHash) @@ -21,14 +21,5 @@ func SeededFloat32(seedParts ...[]byte) (float32, error) { // Construct a pseudo-random number generator with the seed. pseudoRand := rand.New(rand.NewSource(seed)) - // Generate a random uint32. - randUint32 := pseudoRand.Uint32() - - // Clamp the random float32 between [0,1]. This is achieved by dividing the random uint32 - // by the most significant digit of a float32, which is 2^32, guaranteeing an output between - // 0 and 1, inclusive. - oneMostSignificantDigitFloat32 := float32(1 << 32) - randClampedFloat32 := float32(randUint32) / oneMostSignificantDigitFloat32 - - return randClampedFloat32, nil + return pseudoRand.Float64() } diff --git a/pkg/crypto/rand/float_test.go b/pkg/crypto/rand/float_test.go index 5a7763c9a..df72c991a 100644 --- a/pkg/crypto/rand/float_test.go +++ b/pkg/crypto/rand/float_test.go @@ -13,7 +13,7 @@ import ( prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) -func TestSeededFloat32(t *testing.T) { +func TestSeededFloat64(t *testing.T) { probability := prooftypes.DefaultProofRequestProbability tolerance := 0.01 confidence := 0.99 @@ -30,8 +30,7 @@ func TestSeededFloat32(t *testing.T) { go func(idx int64) { idxBz := make([]byte, binary.MaxVarintLen64) binary.PutVarint(idxBz, idx) - randFloat, err := poktrand.SeededFloat32(idxBz) - require.NoError(t, err) + randFloat := poktrand.SeededFloat64(idxBz) if randFloat < 0 || randFloat > 1 { errCh <- fmt.Errorf("secureRandFloat64() returned out of bounds value: %f", randFloat) @@ -54,8 +53,8 @@ func TestSeededFloat32(t *testing.T) { err := <-errCh require.NoError(t, err) - expectedNumTrueSamples := float32(sampleSize) * probability - expectedNumFalseSamples := float32(sampleSize) * (1 - probability) + expectedNumTrueSamples := float64(sampleSize) * probability + expectedNumFalseSamples := float64(sampleSize) * (1 - probability) toleranceSamples := tolerance * float64(sampleSize) // Check that the number of samples for each outcome is within the expected range. diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index 0af62cebf..d107e1b99 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -15,7 +15,7 @@ message Params { // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. - float proof_request_probability = 2 [(gogoproto.jsontag) = "proof_request_probability"]; + double proof_request_probability = 2 [(gogoproto.jsontag) = "proof_request_probability"]; // proof_requirement_threshold is the session cost (i.e. compute unit consumption) // threshold which asserts that a session MUST have a corresponding proof when its cost diff --git a/proto/poktroll/proof/tx.proto b/proto/poktroll/proof/tx.proto index 139e87042..988e2183a 100644 --- a/proto/poktroll/proof/tx.proto +++ b/proto/poktroll/proof/tx.proto @@ -60,7 +60,7 @@ message MsgUpdateParam { string name = 2; oneof as_type { bytes as_bytes = 7 [(gogoproto.jsontag) = "as_bytes"]; - float as_float = 8 [(gogoproto.jsontag) = "as_float"]; + double as_float = 8 [(gogoproto.jsontag) = "as_float"]; cosmos.base.v1beta1.Coin as_coin = 9 [(gogoproto.jsontag) = "as_coin"]; } } diff --git a/proto/poktroll/tokenomics/tx.proto b/proto/poktroll/tokenomics/tx.proto index 05ea18920..a9ebd766a 100644 --- a/proto/poktroll/tokenomics/tx.proto +++ b/proto/poktroll/tokenomics/tx.proto @@ -53,7 +53,7 @@ message MsgUpdateParam { // specified in the `Params` message in `proof/params.proto.` string name = 2; oneof as_type { - double as_double = 3 [(gogoproto.jsontag) = "as_double"]; + double as_float = 3 [(gogoproto.jsontag) = "as_float"]; } } diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 9fc4fb9c0..1889d9a3d 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -23,8 +23,7 @@ type ParamType = string const ( ParamTypeInt64 ParamType = "int64" ParamTypeUint64 ParamType = "uint64" - ParamTypeFloat32 ParamType = "float32" - ParamTypeDouble ParamType = "float64" + ParamTypeFloat64 ParamType = "float64" ParamTypeString ParamType = "string" ParamTypeBytes ParamType = "uint8" ParamTypeCoin ParamType = "Coin" @@ -215,7 +214,7 @@ var ( }, ParamTypes: map[ParamType]any{ ParamTypeBytes: prooftypes.MsgUpdateParam_AsBytes{}, - ParamTypeFloat32: prooftypes.MsgUpdateParam_AsFloat{}, + ParamTypeFloat64: prooftypes.MsgUpdateParam_AsFloat{}, ParamTypeCoin: prooftypes.MsgUpdateParam_AsCoin{}, }, DefaultParams: prooftypes.DefaultParams(), @@ -237,7 +236,7 @@ var ( MintAllocationSupplier: tokenomicstypes.DefaultMintAllocationSupplier, }, ParamTypes: map[ParamType]any{ - ParamTypeDouble: tokenomicstypes.MsgUpdateParam_AsDouble{}, + ParamTypeFloat64: tokenomicstypes.MsgUpdateParam_AsFloat{}, }, DefaultParams: tokenomicstypes.DefaultParams(), NewParamClientFn: tokenomicstypes.NewQueryClient, diff --git a/testutil/integration/suites/update_params.go b/testutil/integration/suites/update_params.go index ce7a0f080..af4bc1852 100644 --- a/testutil/integration/suites/update_params.go +++ b/testutil/integration/suites/update_params.go @@ -248,10 +248,8 @@ func (s *ParamsSuite) RunUpdateParamAsSigner( msgAsTypeValue.Elem().FieldByName("AsUint64").Set(paramReflectValue) case ParamTypeInt64: msgAsTypeValue.Elem().FieldByName("AsInt64").Set(paramReflectValue) - case ParamTypeFloat32: + case ParamTypeFloat64: msgAsTypeValue.Elem().FieldByName("AsFloat").Set(paramReflectValue) - case ParamTypeDouble: - msgAsTypeValue.Elem().FieldByName("AsDouble").Set(paramReflectValue) case ParamTypeString: msgAsTypeValue.Elem().FieldByName("AsString").Set(paramReflectValue) case ParamTypeBytes: diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index a53d688ec..11e12cdd8 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -16,7 +16,7 @@ import ( ) func TestMsgUpdateParam_UpdateProofRequestProbabilityOnly(t *testing.T) { - var expectedProofRequestProbability float32 = 0.1 + var expectedProofRequestProbability float64 = 0.1 // Set the parameters to their default values k, msgSrv, ctx := setupMsgServer(t) diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 43e197d02..69fce0333 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -33,17 +33,17 @@ func TestParams_ValidateProofRequestProbability(t *testing.T) { }, { desc: "ProofRequestProbability less than zero", - proofRequestProbability: float32(-0.25), - expectedErr: prooftypes.ErrProofParamInvalid.Wrapf("invalid ProofRequestProbability: (%v)", float32(-0.25)), + proofRequestProbability: float64(-0.25), + expectedErr: prooftypes.ErrProofParamInvalid.Wrapf("invalid ProofRequestProbability: (%v)", float64(-0.25)), }, { desc: "ProofRequestProbability greater than one", - proofRequestProbability: float32(1.1), - expectedErr: prooftypes.ErrProofParamInvalid.Wrapf("invalid ProofRequestProbability: (%v)", float32(1.1)), + proofRequestProbability: float64(1.1), + expectedErr: prooftypes.ErrProofParamInvalid.Wrapf("invalid ProofRequestProbability: (%v)", float64(1.1)), }, { desc: "valid ProofRequestProbability", - proofRequestProbability: float32(0.25), + proofRequestProbability: float64(0.25), }, } diff --git a/x/proof/keeper/proof_requirement_test.go b/x/proof/keeper/proof_requirement_test.go index 054080c0e..9d58840c1 100644 --- a/x/proof/keeper/proof_requirement_test.go +++ b/x/proof/keeper/proof_requirement_test.go @@ -50,8 +50,8 @@ func TestKeeper_IsProofRequired(t *testing.T) { } } - expectedNumTrueSamples := float32(sampleSize) * probability - expectedNumFalseSamples := float32(sampleSize) * (1 - probability) + expectedNumTrueSamples := float64(sampleSize) * probability + expectedNumFalseSamples := float64(sampleSize) * (1 - probability) toleranceSamples := tolerance * float64(sampleSize) // Check that the number of samples for each outcome is within the expected range. numFalseSamples := sampleSize - numTrueSamples.Load() diff --git a/x/proof/types/claim.go b/x/proof/types/claim.go index 08b3dc406..4cc03af29 100644 --- a/x/proof/types/claim.go +++ b/x/proof/types/claim.go @@ -115,10 +115,9 @@ func (claim *Claim) GetHash() ([]byte, error) { // IMPORTANT: It is assumed that the caller has ensured the hash of the block seed func (claim *Claim) GetProofRequirementSampleValue( proofRequirementSeedBlockHash []byte, -) (proofRequirementSampleValue float32, err error) { +) (float64, error) { // Get the hash of the claim to seed the random number generator. - var claimHash []byte - claimHash, err = claim.GetHash() + claimHash, err := claim.GetHash() if err != nil { return 0, err } @@ -128,12 +127,7 @@ func (claim *Claim) GetProofRequirementSampleValue( // is unknown until the proofRequirementSeedBlockHash is observed. proofRequirementSeed := append(claimHash, proofRequirementSeedBlockHash...) - // Sample a pseudo-random value between 0 and 1 to determine if a proof is + // Sample a pseudo-random value between [0,1) to determine if a proof is // required probabilistically. - proofRequirementSampleValue, err = poktrand.SeededFloat32(proofRequirementSeed) - if err != nil { - return 0, err - } - - return proofRequirementSampleValue, nil + return poktrand.SeededFloat64(proofRequirementSeed), nil } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 16d77287f..9647651d1 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -18,7 +18,7 @@ var ( KeyProofRequestProbability = []byte("ProofRequestProbability") ParamProofRequestProbability = "proof_request_probability" - DefaultProofRequestProbability float32 = 0.25 // See: https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md + DefaultProofRequestProbability float64 = 0.25 // See: https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md // The probabilistic proofs paper specifies a threshold of 20 POKT. // TODO_MAINNET(@Olshansk, @RawthiL): Figure out what this value should be. @@ -46,7 +46,7 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams( - proofRequestProbability float32, + proofRequestProbability float64, proofRequirementThreshold *cosmostypes.Coin, proofMissingPenalty *cosmostypes.Coin, proofSubmissionFee *cosmostypes.Coin, @@ -119,7 +119,7 @@ func (params *Params) ValidateBasic() error { // ValidateProofRequestProbability validates the ProofRequestProbability param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. func ValidateProofRequestProbability(proofRequestProbabilityAny any) error { - proofRequestProbability, ok := proofRequestProbabilityAny.(float32) + proofRequestProbability, ok := proofRequestProbabilityAny.(float64) if !ok { return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofRequestProbabilityAny) } diff --git a/x/proof/types/params.pb.go b/x/proof/types/params.pb.go index b84b9ab41..8427231fa 100644 --- a/x/proof/types/params.pb.go +++ b/x/proof/types/params.pb.go @@ -30,7 +30,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. - ProofRequestProbability float32 `protobuf:"fixed32,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability"` + ProofRequestProbability float64 `protobuf:"fixed64,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability"` // proof_requirement_threshold is the session cost (i.e. compute unit consumption) // threshold which asserts that a session MUST have a corresponding proof when its cost // is equal to or above the threshold. This is in contrast to the this requirement @@ -80,7 +80,7 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetProofRequestProbability() float32 { +func (m *Params) GetProofRequestProbability() float64 { if m != nil { return m.ProofRequestProbability } @@ -115,32 +115,32 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/params.proto", fileDescriptor_2ad689ad5bf3a2d7) } var fileDescriptor_2ad689ad5bf3a2d7 = []byte{ - // 390 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0xce, 0xd2, 0x40, - 0x14, 0x85, 0x29, 0x28, 0x8b, 0x9a, 0x98, 0x58, 0x31, 0xb4, 0x10, 0xa7, 0xc4, 0x15, 0x31, 0x71, - 0x26, 0xe8, 0xce, 0x25, 0x26, 0xae, 0x34, 0x21, 0xd5, 0x8d, 0x6e, 0x9a, 0x16, 0x87, 0x76, 0x42, - 0x3b, 0xb7, 0xce, 0x0c, 0x2a, 0x3e, 0x82, 0x2b, 0x1f, 0xc1, 0x47, 0xf0, 0x31, 0x5c, 0x12, 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, 0x39, 0x93, 0x92, 0xf1, 0x24, 0x2c, 0x28, 0x8f, 0x32, - 0xb5, 0x76, 0x6f, 0x5d, 0x6a, 0xf5, 0xea, 0xd2, 0x3f, 0xef, 0x0d, 0xee, 0x6b, 0xf9, 0xb5, 0x51, - 0x67, 0x46, 0x74, 0xa8, 0xdd, 0x33, 0xd3, 0x72, 0x15, 0x6b, 0x03, 0xf0, 0x70, 0x41, 0xa9, 0x7b, - 0xfb, 0x52, 0x91, 0x5b, 0x97, 0xfe, 0x59, 0x6b, 0xe0, 0x68, 0xf5, 0xcd, 0x51, 0x7c, 0x49, 0xe9, - 0xf3, 0xd1, 0xbf, 0x1f, 0xbe, 0xf5, 0xed, 0xef, 0xcf, 0xc7, 0xfd, 0xe3, 0xc5, 0x7c, 0x69, 0x6e, - 0xc6, 0xfc, 0xc9, 0xe9, 0xab, 0x5f, 0x15, 0xb2, 0x36, 0x15, 0xb2, 0xb6, 0x15, 0xb2, 0xfe, 0x54, - 0xc8, 0xfa, 0xbe, 0x43, 0xad, 0xcd, 0x0e, 0xb5, 0xb6, 0x3b, 0xd4, 0x7a, 0x8f, 0x13, 0xa6, 0xd2, - 0x55, 0x8c, 0xe7, 0x90, 0x93, 0x7d, 0xc2, 0x13, 0x4e, 0xd5, 0x67, 0x10, 0x4b, 0x72, 0x25, 0x4e, - 0xad, 0x0b, 0x2a, 0xe3, 0xae, 0xbe, 0x94, 0x67, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x68, 0xf0, - 0x63, 0xa9, 0xa1, 0x02, 0x00, 0x00, + // 389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0xca, 0xd3, 0x40, + 0x14, 0x85, 0x3b, 0xfe, 0xda, 0x45, 0x04, 0xc1, 0x58, 0x69, 0xd2, 0xe2, 0xa4, 0xb8, 0x2a, 0x82, + 0x33, 0x54, 0x77, 0x2e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xbb, 0x2b, 0xd9, 0xef, 0x4a, 0xda, 0x5d, + 0xc9, 0x53, 0xe0, 0x62, 0x1a, 0x34, 0x55, 0xf0, 0xbf, 0x84, 0xd0, 0x3f, 0x36, 0xb7, 0xec, 0xd5, + 0x01, 0xb9, 0x99, 0x73, 0xd7, 0x3a, 0x0b, 0xae, 0x14, 0x17, 0x69, 0x54, 0x32, 0x11, 0xe7, 0x7a, + 0xed, 0x5d, 0xbf, 0xd4, 0xea, 0x37, 0x55, 0x70, 0xde, 0x1b, 0xde, 0x31, 0xf2, 0x0b, 0xab, 0xce, + 0xac, 0xe8, 0x32, 0xa7, 0x67, 0xa7, 0xd5, 0x2a, 0x31, 0x06, 0x10, 0xd1, 0x82, 0x31, 0xef, 0xc6, + 0xa5, 0x22, 0xaf, 0xa9, 0x82, 0xb3, 0xd6, 0xd0, 0x35, 0xea, 0xcb, 0xa3, 0xf8, 0x8c, 0xb1, 0x27, + 0xa3, 0xdf, 0x5f, 0x03, 0xf4, 0xf9, 0xd7, 0xb7, 0x07, 0xfd, 0xe3, 0xc5, 0x7c, 0x6c, 0x6f, 0xc6, + 0xfe, 0xc9, 0xe9, 0xf3, 0xef, 0x35, 0x46, 0x9b, 0x1a, 0xa3, 0x6d, 0x8d, 0xd1, 0xcf, 0x1a, 0xa3, + 0x2f, 0x3b, 0xdc, 0xd9, 0xec, 0x70, 0x67, 0xbb, 0xc3, 0x9d, 0x37, 0x24, 0xe5, 0x3a, 0x5b, 0x25, + 0x64, 0x0e, 0x05, 0xdd, 0x27, 0x3c, 0x14, 0x4c, 0x7f, 0x00, 0xb9, 0xa4, 0x7f, 0xc5, 0xe9, 0x75, + 0xc9, 0x54, 0xd2, 0x35, 0x97, 0xf2, 0xf8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0xa6, 0xe4, + 0x39, 0xa1, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -233,10 +233,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } if m.ProofRequestProbability != 0 { - i -= 4 - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.ProofRequestProbability)))) + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ProofRequestProbability)))) i-- - dAtA[i] = 0x15 + dAtA[i] = 0x11 } return len(dAtA) - i, nil } @@ -259,7 +259,7 @@ func (m *Params) Size() (n int) { var l int _ = l if m.ProofRequestProbability != 0 { - n += 5 + n += 9 } if m.ProofRequirementThreshold != nil { l = m.ProofRequirementThreshold.Size() @@ -312,16 +312,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 2: - if wireType != 5 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field ProofRequestProbability", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - m.ProofRequestProbability = float32(math.Float32frombits(v)) + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.ProofRequestProbability = float64(math.Float64frombits(v)) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProofRequirementThreshold", wireType) diff --git a/x/proof/types/tx.pb.go b/x/proof/types/tx.pb.go index 61d576174..c533c5dd9 100644 --- a/x/proof/types/tx.pb.go +++ b/x/proof/types/tx.pb.go @@ -174,7 +174,7 @@ type MsgUpdateParam_AsBytes struct { AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof" json:"as_bytes"` } type MsgUpdateParam_AsFloat struct { - AsFloat float32 `protobuf:"fixed32,8,opt,name=as_float,json=asFloat,proto3,oneof" json:"as_float"` + AsFloat float64 `protobuf:"fixed64,8,opt,name=as_float,json=asFloat,proto3,oneof" json:"as_float"` } type MsgUpdateParam_AsCoin struct { AsCoin *types.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` @@ -212,7 +212,7 @@ func (m *MsgUpdateParam) GetAsBytes() []byte { return nil } -func (m *MsgUpdateParam) GetAsFloat() float32 { +func (m *MsgUpdateParam) GetAsFloat() float64 { if x, ok := m.GetAsType().(*MsgUpdateParam_AsFloat); ok { return x.AsFloat } @@ -485,54 +485,54 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/tx.proto", fileDescriptor_345e95e87511f6a6) } var fileDescriptor_345e95e87511f6a6 = []byte{ - // 747 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x4f, 0xdb, 0x4c, - 0x10, 0x8e, 0xc3, 0xcb, 0x47, 0x36, 0xbc, 0x79, 0xf5, 0x5a, 0x94, 0x7c, 0xd0, 0x3a, 0x51, 0x0e, - 0x6d, 0x4a, 0x85, 0x2d, 0x40, 0xaa, 0x54, 0x6e, 0x04, 0x15, 0xe5, 0x50, 0x54, 0x64, 0x8a, 0x54, - 0xf5, 0x12, 0x6d, 0x92, 0x25, 0xb6, 0x88, 0xbd, 0xd6, 0xee, 0x86, 0xc2, 0xad, 0xea, 0xb1, 0x27, - 0x7e, 0x46, 0x8f, 0x1c, 0x7a, 0xe9, 0x3f, 0xe0, 0x88, 0x7a, 0xe2, 0x84, 0xaa, 0x50, 0x09, 0x09, - 0xfe, 0x44, 0xb5, 0x1f, 0x76, 0x1c, 0x37, 0x40, 0xd5, 0x53, 0x2f, 0xf1, 0xee, 0x3c, 0xcf, 0x4c, - 0x66, 0x9e, 0x19, 0x8f, 0x41, 0x3e, 0xc0, 0xfb, 0x8c, 0xe0, 0x5e, 0xcf, 0x0a, 0x08, 0xc6, 0x7b, - 0x16, 0x3b, 0x34, 0x03, 0x82, 0x19, 0xd6, 0x73, 0x21, 0x60, 0x0a, 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f9, 0x81, 0x6f, 0xe1, 0xfa, 0xab, 0xd3, 0x81, 0xa1, 0x9d, 0x0d, 0x0c, 0xed, 0x7c, 0x60, - 0x68, 0xdf, 0x07, 0x86, 0x76, 0x7c, 0x69, 0xa4, 0xce, 0x2e, 0x8d, 0xd4, 0xf9, 0xa5, 0x91, 0x7a, - 0x67, 0x76, 0x5d, 0xe6, 0xf4, 0x5b, 0x66, 0x1b, 0x7b, 0x16, 0x0f, 0xbb, 0xe4, 0x23, 0xf6, 0x1e, - 0x93, 0x7d, 0xeb, 0x97, 0x05, 0x2d, 0xbe, 0x3b, 0xad, 0x29, 0xf1, 0x65, 0x59, 0xfd, 0x19, 0x00, - 0x00, 0xff, 0xff, 0x70, 0xd3, 0xcd, 0x4c, 0x77, 0x07, 0x00, 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4f, 0x4f, 0x13, 0x41, + 0x14, 0xef, 0x80, 0xfc, 0xe9, 0x14, 0x6b, 0xdc, 0x20, 0xfd, 0x83, 0x6e, 0x9b, 0x1e, 0xb4, 0x62, + 0xd8, 0x0d, 0x90, 0x98, 0xc8, 0x8d, 0x12, 0x49, 0x0f, 0x12, 0xc9, 0x22, 0x89, 0xf1, 0xd2, 0x4c, + 0xdb, 0xa1, 0xdd, 0xd0, 0xdd, 0xd9, 0xcc, 0x4c, 0x11, 0x6e, 0xc6, 0xa3, 0x27, 0x3e, 0x86, 0x47, + 0x0e, 0x5e, 0xfc, 0x06, 0x1c, 0x89, 0x27, 0x4e, 0xc4, 0x14, 0x13, 0x12, 0xf8, 0x12, 0x66, 0xfe, + 0x74, 0xbb, 0x5d, 0x0b, 0x18, 0x4f, 0x5e, 0xba, 0x33, 0xef, 0xf7, 0x7b, 0xaf, 0xef, 0xfd, 0xde, + 0xdb, 0xb7, 0x30, 0x13, 0x90, 0x3d, 0x4e, 0x49, 0xa7, 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xd8, 0x51, 0xe2, + 0xed, 0xc0, 0x54, 0x74, 0x97, 0x99, 0xb7, 0x57, 0x39, 0x32, 0xec, 0x88, 0x37, 0x3f, 0x3f, 0xf1, + 0x49, 0x6c, 0xe1, 0xca, 0x9b, 0x93, 0x9e, 0x09, 0x4e, 0x7b, 0x26, 0x38, 0xeb, 0x99, 0xe0, 0x67, + 0xcf, 0x04, 0x47, 0x17, 0x66, 0xe2, 0xf4, 0xc2, 0x4c, 0x9c, 0x5d, 0x98, 0x89, 0x0f, 0x56, 0xcb, + 0xe5, 0xed, 0x6e, 0xdd, 0x6a, 0x10, 0xcf, 0x16, 0x61, 0x17, 0x7d, 0xcc, 0x3f, 0x12, 0xba, 0x67, + 0xff, 0xb1, 0xa0, 0xe5, 0x77, 0xa7, 0x3e, 0x29, 0xbf, 0x2c, 0x2b, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x35, 0xfa, 0xd8, 0x87, 0x77, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -859,10 +859,10 @@ func (m *MsgUpdateParam_AsFloat) MarshalTo(dAtA []byte) (int, error) { func (m *MsgUpdateParam_AsFloat) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - i -= 4 - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.AsFloat)))) + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.AsFloat)))) i-- - dAtA[i] = 0x45 + dAtA[i] = 0x41 return len(dAtA) - i, nil } func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { @@ -1162,7 +1162,7 @@ func (m *MsgUpdateParam_AsFloat) Size() (n int) { } var l int _ = l - n += 5 + n += 9 return n } func (m *MsgUpdateParam_AsCoin) Size() (n int) { @@ -1556,16 +1556,16 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { m.AsType = &MsgUpdateParam_AsBytes{v} iNdEx = postIndex case 8: - if wireType != 5 { + if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field AsFloat", wireType) } - var v uint32 - if (iNdEx + 4) > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - m.AsType = &MsgUpdateParam_AsFloat{float32(math.Float32frombits(v))} + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.AsType = &MsgUpdateParam_AsFloat{float64(math.Float64frombits(v))} case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) diff --git a/x/session/keeper/params_test.go b/x/session/keeper/params_test.go index 0114e731e..fadc53e6b 100644 --- a/x/session/keeper/params_test.go +++ b/x/session/keeper/params_test.go @@ -22,7 +22,7 @@ func TestGetParams(t *testing.T) { { desc: "invalid NumSuppliersPerSession (<1)", numSuppliersPerSession: uint64(0), - expectedErr: sessiontypes.ErrSessionParamInvalid.Wrapf("number of suppliers per session (%d) MUST be greater than 1", 0), + expectedErr: sessiontypes.ErrSessionParamInvalid.Wrapf("number of suppliers per session (%d) MUST be greater than or equal to 1", 0), }, { desc: "valid NumSuppliersPerSession", diff --git a/x/session/types/message_update_param.go b/x/session/types/message_update_param.go index c7ed5834e..ace4d5b71 100644 --- a/x/session/types/message_update_param.go +++ b/x/session/types/message_update_param.go @@ -6,7 +6,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgUpdateParam{} +var _ sdk.Msg = (*MsgUpdateParam)(nil) func NewMsgUpdateParam(authority string, name string, asType any) (*MsgUpdateParam, error) { var asTypeIface isMsgUpdateParam_AsType diff --git a/x/session/types/params.go b/x/session/types/params.go index ba87c7eda..0cbb4d211 100644 --- a/x/session/types/params.go +++ b/x/session/types/params.go @@ -55,7 +55,7 @@ func ValidateNumSuppliersPerSession(numSuppliersPerSessionAny any) error { } if numSuppliersPerSession < 1 { - return ErrSessionParamInvalid.Wrapf("number of suppliers per session (%d) MUST be greater than 1", numSuppliersPerSession) + return ErrSessionParamInvalid.Wrapf("number of suppliers per session (%d) MUST be greater than or equal to 1", numSuppliersPerSession) } return nil diff --git a/x/tokenomics/keeper/msg_server_update_param.go b/x/tokenomics/keeper/msg_server_update_param.go index 83b9abd25..a2a14fde8 100644 --- a/x/tokenomics/keeper/msg_server_update_param.go +++ b/x/tokenomics/keeper/msg_server_update_param.go @@ -33,14 +33,14 @@ func (k msgServer) UpdateParam( switch msg.Name { case tokenomicstypes.ParamMintAllocationDao: - logger = logger.With("param_value", msg.GetAsDouble()) - params.MintAllocationDao = msg.GetAsDouble() + logger = logger.With("param_value", msg.GetAsFloat()) + params.MintAllocationDao = msg.GetAsFloat() case tokenomicstypes.ParamMintAllocationProposer: - logger = logger.With("param_value", msg.GetAsDouble()) - params.MintAllocationProposer = msg.GetAsDouble() + logger = logger.With("param_value", msg.GetAsFloat()) + params.MintAllocationProposer = msg.GetAsFloat() case tokenomicstypes.ParamMintAllocationSupplier: - logger = logger.With("param_value", msg.GetAsDouble()) - params.MintAllocationSupplier = msg.GetAsDouble() + logger = logger.With("param_value", msg.GetAsFloat()) + params.MintAllocationSupplier = msg.GetAsFloat() default: return nil, status.Error( codes.InvalidArgument, diff --git a/x/tokenomics/keeper/msg_server_update_param_test.go b/x/tokenomics/keeper/msg_server_update_param_test.go index e72de5638..3abd7b268 100644 --- a/x/tokenomics/keeper/msg_server_update_param_test.go +++ b/x/tokenomics/keeper/msg_server_update_param_test.go @@ -26,7 +26,7 @@ func TestMsgUpdateParam_UpdateMintAllocationDaoOnly(t *testing.T) { updateParamMsg := &tokenomicstypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: tokenomicstypes.ParamMintAllocationDao, - AsType: &tokenomicstypes.MsgUpdateParam_AsDouble{AsDouble: expectedMintAllocationDao}, + AsType: &tokenomicstypes.MsgUpdateParam_AsFloat{AsFloat: expectedMintAllocationDao}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) @@ -51,7 +51,7 @@ func TestMsgUpdateParam_UpdateMintAllocationProposerOnly(t *testing.T) { updateParamMsg := &tokenomicstypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: tokenomicstypes.ParamMintAllocationProposer, - AsType: &tokenomicstypes.MsgUpdateParam_AsDouble{AsDouble: expectedMintAllocationProposer}, + AsType: &tokenomicstypes.MsgUpdateParam_AsFloat{AsFloat: expectedMintAllocationProposer}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) @@ -76,7 +76,7 @@ func TestMsgUpdateParam_UpdateMintAllocationSupplierOnly(t *testing.T) { updateParamMsg := &tokenomicstypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: tokenomicstypes.ParamMintAllocationSupplier, - AsType: &tokenomicstypes.MsgUpdateParam_AsDouble{AsDouble: expectedMintAllocationSupplier}, + AsType: &tokenomicstypes.MsgUpdateParam_AsFloat{AsFloat: expectedMintAllocationSupplier}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) diff --git a/x/tokenomics/types/message_update_param.go b/x/tokenomics/types/message_update_param.go index a6cf0050b..0cdd30828 100644 --- a/x/tokenomics/types/message_update_param.go +++ b/x/tokenomics/types/message_update_param.go @@ -13,7 +13,7 @@ func NewMsgUpdateParam(authority string, name string, asTypeAny any) (*MsgUpdate switch asType := asTypeAny.(type) { case float64: - asTypeIface = &MsgUpdateParam_AsDouble{AsDouble: asType} + asTypeIface = &MsgUpdateParam_AsFloat{AsFloat: asType} default: return nil, fmt.Errorf("unexpected param value type: %T", asTypeAny) } @@ -42,30 +42,30 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { case ParamMintAllocationDao: - if err := msg.paramTypeIsDouble(); err != nil { + if err := msg.paramTypeIsFloat(); err != nil { return err } - return ValidateMintAllocationDao(msg.GetAsDouble()) + return ValidateMintAllocationDao(msg.GetAsFloat()) case ParamMintAllocationProposer: - if err := msg.paramTypeIsDouble(); err != nil { + if err := msg.paramTypeIsFloat(); err != nil { return err } - return ValidateMintAllocationProposer(msg.GetAsDouble()) + return ValidateMintAllocationProposer(msg.GetAsFloat()) case ParamMintAllocationSupplier: - if err := msg.paramTypeIsDouble(); err != nil { + if err := msg.paramTypeIsFloat(); err != nil { return err } - return ValidateMintAllocationSupplier(msg.GetAsDouble()) + return ValidateMintAllocationSupplier(msg.GetAsFloat()) default: return ErrTokenomicsParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } } -func (msg *MsgUpdateParam) paramTypeIsDouble() error { - if _, ok := msg.AsType.(*MsgUpdateParam_AsDouble); !ok { +func (msg *MsgUpdateParam) paramTypeIsFloat() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsFloat); !ok { return ErrTokenomicsParamInvalid.Wrapf( "invalid type for param %q; expected %T, got %T", - msg.Name, &MsgUpdateParam_AsDouble{}, msg.AsType, + msg.Name, &MsgUpdateParam_AsFloat{}, msg.AsType, ) } diff --git a/x/tokenomics/types/message_update_param_test.go b/x/tokenomics/types/message_update_param_test.go index 52adf3382..12a91c09f 100644 --- a/x/tokenomics/types/message_update_param_test.go +++ b/x/tokenomics/types/message_update_param_test.go @@ -20,7 +20,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: "invalid_address", Name: "", // Doesn't matter for this test - AsType: &MsgUpdateParam_AsDouble{AsDouble: 1}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: 1}, }, expectedErr: ErrTokenomicsAddressInvalid, @@ -29,7 +29,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: "invalid", - AsType: &MsgUpdateParam_AsDouble{AsDouble: 1}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: 1}, }, expectedErr: ErrTokenomicsParamNameInvalid, }, @@ -38,7 +38,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamMintAllocationDao, - AsType: &MsgUpdateParam_AsDouble{AsDouble: DefaultMintAllocationDao}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: DefaultMintAllocationDao}, }, }, } diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index 8393369df..d824fd4af 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -126,7 +126,7 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // *MsgUpdateParam_AsDouble + // *MsgUpdateParam_AsFloat AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } @@ -165,11 +165,11 @@ type isMsgUpdateParam_AsType interface { Size() int } -type MsgUpdateParam_AsDouble struct { - AsDouble float64 `protobuf:"fixed64,3,opt,name=as_double,json=asDouble,proto3,oneof" json:"as_double"` +type MsgUpdateParam_AsFloat struct { + AsFloat float64 `protobuf:"fixed64,3,opt,name=as_float,json=asFloat,proto3,oneof" json:"as_float"` } -func (*MsgUpdateParam_AsDouble) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsFloat) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if m != nil { @@ -192,9 +192,9 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsDouble() float64 { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsDouble); ok { - return x.AsDouble +func (m *MsgUpdateParam) GetAsFloat() float64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsFloat); ok { + return x.AsFloat } return 0 } @@ -202,7 +202,7 @@ func (m *MsgUpdateParam) GetAsDouble() float64 { // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*MsgUpdateParam_AsDouble)(nil), + (*MsgUpdateParam_AsFloat)(nil), } } @@ -258,7 +258,7 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/tx.proto", fileDescriptor_aa0f2fdbd9b6d7eb) } var fileDescriptor_aa0f2fdbd9b6d7eb = []byte{ - // 461 bytes of a gzipped FileDescriptorProto + // 460 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0xcb, 0xcf, 0xcd, 0x4c, 0x2e, 0xd6, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc9, 0xea, 0x21, 0x64, 0xa5, @@ -274,20 +274,20 @@ var fileDescriptor_aa0f2fdbd9b6d7eb = []byte{ 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, 0x06, 0x41, 0x75, 0x59, 0x59, 0x34, 0x3d, 0xdf, 0xa0, 0x85, 0x30, 0xaf, 0xeb, 0xf9, 0x06, 0x2d, 0x55, 0xb8, 0x07, 0x2a, 0x90, 0xbd, 0x80, 0xe6, 0x62, 0x25, 0x49, 0x2e, 0x71, 0x34, 0xa1, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, - 0xa5, 0xa5, 0x8c, 0x5c, 0x7c, 0xa8, 0x72, 0x64, 0xfb, 0x4f, 0x88, 0x8b, 0x25, 0x2f, 0x31, 0x37, - 0x15, 0xec, 0x3b, 0xce, 0x20, 0x30, 0x5b, 0x48, 0x87, 0x8b, 0x33, 0xb1, 0x38, 0x3e, 0x25, 0xbf, - 0x34, 0x29, 0x27, 0x55, 0x82, 0x59, 0x81, 0x51, 0x83, 0xd1, 0x89, 0xf7, 0xd5, 0x3d, 0x79, 0x84, - 0xa0, 0x07, 0x43, 0x10, 0x47, 0x62, 0xb1, 0x0b, 0x98, 0x6d, 0xc5, 0x87, 0xea, 0x43, 0x27, 0x4e, - 0x2e, 0xf6, 0xc4, 0xe2, 0xf8, 0x92, 0xca, 0x82, 0x54, 0x25, 0x5f, 0x2e, 0x31, 0x54, 0x67, 0xc2, - 0x7c, 0x20, 0x64, 0x0c, 0x0f, 0x56, 0x46, 0x82, 0xc1, 0x0a, 0x0b, 0x4b, 0xa3, 0x8b, 0x8c, 0x5c, - 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x49, 0x5c, 0x3c, 0x28, 0x71, 0xab, 0x82, 0x55, 0x33, 0x5a, 0xe0, - 0x49, 0xe9, 0x10, 0xa3, 0x0a, 0xee, 0xc0, 0x78, 0x2e, 0x6e, 0xe4, 0xe0, 0x55, 0x26, 0x42, 0xb3, - 0x94, 0x36, 0x11, 0x8a, 0x60, 0x16, 0x48, 0xb1, 0x36, 0x80, 0xd2, 0x89, 0x53, 0xe0, 0x89, 0x47, - 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, - 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, - 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x32, 0x5b, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, - 0xbf, 0x28, 0x5b, 0x1f, 0x7b, 0x12, 0x02, 0x05, 0x7a, 0x71, 0x12, 0x1b, 0x38, 0x17, 0x18, 0x03, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x25, 0x85, 0x43, 0x68, 0xb9, 0x03, 0x00, 0x00, + 0xa5, 0x45, 0x8c, 0x5c, 0x7c, 0xa8, 0x72, 0x64, 0xfb, 0x4f, 0x88, 0x8b, 0x25, 0x2f, 0x31, 0x37, + 0x15, 0xec, 0x3b, 0xce, 0x20, 0x30, 0x5b, 0x48, 0x93, 0x8b, 0x23, 0xb1, 0x38, 0x3e, 0x2d, 0x27, + 0x3f, 0xb1, 0x44, 0x82, 0x59, 0x81, 0x51, 0x83, 0xd1, 0x89, 0xe7, 0xd5, 0x3d, 0x79, 0xb8, 0x98, + 0x07, 0x43, 0x10, 0x7b, 0x62, 0xb1, 0x1b, 0x88, 0x69, 0xc5, 0x87, 0xea, 0x3d, 0x27, 0x4e, 0x2e, + 0xf6, 0xc4, 0xe2, 0xf8, 0x92, 0xca, 0x82, 0x54, 0x25, 0x5f, 0x2e, 0x31, 0x54, 0x37, 0xc2, 0x9c, + 0x2f, 0x64, 0x0c, 0x0f, 0x53, 0x46, 0x82, 0x61, 0x0a, 0x0b, 0x48, 0xa3, 0x8b, 0x8c, 0x5c, 0xcc, + 0xbe, 0xc5, 0xe9, 0x42, 0x49, 0x5c, 0x3c, 0x28, 0x11, 0xab, 0x82, 0x55, 0x33, 0x5a, 0xc8, 0x49, + 0xe9, 0x10, 0xa3, 0x0a, 0xee, 0xc0, 0x78, 0x2e, 0x6e, 0xe4, 0xb0, 0x55, 0x26, 0x42, 0xb3, 0x94, + 0x36, 0x11, 0x8a, 0x60, 0x16, 0x48, 0xb1, 0x36, 0x80, 0x12, 0x89, 0x53, 0xe0, 0x89, 0x47, 0x72, + 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, + 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, 0x92, + 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x32, 0x5b, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, + 0x28, 0x5b, 0x1f, 0x7b, 0xfa, 0x01, 0x05, 0x7a, 0x71, 0x12, 0x1b, 0x38, 0x0b, 0x18, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x2d, 0xb1, 0x59, 0xbc, 0xb6, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -519,15 +519,15 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsDouble) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsFloat) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParam_AsDouble) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsFloat) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.AsDouble)))) + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.AsFloat)))) i-- dAtA[i] = 0x19 return len(dAtA) - i, nil @@ -622,7 +622,7 @@ func (m *MsgUpdateParam) Size() (n int) { return n } -func (m *MsgUpdateParam_AsDouble) Size() (n int) { +func (m *MsgUpdateParam_AsFloat) Size() (n int) { if m == nil { return 0 } @@ -910,7 +910,7 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field AsDouble", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsFloat", wireType) } var v uint64 if (iNdEx + 8) > l { @@ -918,7 +918,7 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - m.AsType = &MsgUpdateParam_AsDouble{float64(math.Float64frombits(v))} + m.AsType = &MsgUpdateParam_AsFloat{float64(math.Float64frombits(v))} default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])