diff --git a/Makefile b/Makefile index a105b6aac..0190af511 100644 --- a/Makefile +++ b/Makefile @@ -942,6 +942,10 @@ params_update_proof_proof_requirement_threshold: ## Update the proof module proo params_update_proof_proof_missing_penalty: ## Update the proof module proof_missing_penalty param poktrolld tx authz exec ./tools/scripts/params/proof_proof_missing_penalty.json $(PARAM_FLAGS) +.PHONY: params_update_proof_proof_submission_fee +params_update_proof_proof_submission_fee: ## Update the proof module proof_submission_fee param + poktrolld tx authz exec ./tools/scripts/params/proof_proof_submission_fee.json $(PARAM_FLAGS) + ### Shared Module Params ### .PHONY: params_update_shared_all params_update_shared_all: ## Update the session module params diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go index 5733fc2f3..27f3273c8 100644 --- a/api/poktroll/proof/params.pulsar.go +++ b/api/poktroll/proof/params.pulsar.go @@ -23,6 +23,7 @@ var ( fd_Params_proof_request_probability protoreflect.FieldDescriptor fd_Params_proof_requirement_threshold protoreflect.FieldDescriptor fd_Params_proof_missing_penalty protoreflect.FieldDescriptor + fd_Params_proof_submission_fee protoreflect.FieldDescriptor ) func init() { @@ -32,6 +33,7 @@ func init() { fd_Params_proof_request_probability = md_Params.Fields().ByName("proof_request_probability") fd_Params_proof_requirement_threshold = md_Params.Fields().ByName("proof_requirement_threshold") fd_Params_proof_missing_penalty = md_Params.Fields().ByName("proof_missing_penalty") + fd_Params_proof_submission_fee = md_Params.Fields().ByName("proof_submission_fee") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -123,6 +125,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.ProofSubmissionFee != nil { + value := protoreflect.ValueOfMessage(x.ProofSubmissionFee.ProtoReflect()) + if !f(fd_Params_proof_submission_fee, value) { + return + } + } } // Has reports whether a field is populated. @@ -146,6 +154,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.ProofRequirementThreshold != uint64(0) case "poktroll.proof.Params.proof_missing_penalty": return x.ProofMissingPenalty != nil + case "poktroll.proof.Params.proof_submission_fee": + return x.ProofSubmissionFee != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -170,6 +180,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.ProofRequirementThreshold = uint64(0) case "poktroll.proof.Params.proof_missing_penalty": x.ProofMissingPenalty = nil + case "poktroll.proof.Params.proof_submission_fee": + x.ProofSubmissionFee = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -198,6 +210,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "poktroll.proof.Params.proof_missing_penalty": value := x.ProofMissingPenalty return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + value := x.ProofSubmissionFee + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -226,6 +241,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.ProofRequirementThreshold = value.Uint() case "poktroll.proof.Params.proof_missing_penalty": x.ProofMissingPenalty = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.Params.proof_submission_fee": + x.ProofSubmissionFee = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -251,6 +268,11 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore x.ProofMissingPenalty = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.ProofMissingPenalty.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + if x.ProofSubmissionFee == nil { + x.ProofSubmissionFee = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ProofSubmissionFee.ProtoReflect()) case "poktroll.proof.Params.relay_difficulty_target_hash": panic(fmt.Errorf("field relay_difficulty_target_hash of message poktroll.proof.Params is not mutable")) case "poktroll.proof.Params.proof_request_probability": @@ -279,6 +301,9 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor case "poktroll.proof.Params.proof_missing_penalty": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -362,6 +387,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { l = options.Size(x.ProofMissingPenalty) n += 1 + l + runtime.Sov(uint64(l)) } + if x.ProofSubmissionFee != nil { + l = options.Size(x.ProofSubmissionFee) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -391,6 +420,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ProofSubmissionFee != nil { + encoded, err := options.Marshal(x.ProofSubmissionFee) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } if x.ProofMissingPenalty != nil { encoded, err := options.Marshal(x.ProofMissingPenalty) if err != nil { @@ -572,6 +615,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofSubmissionFee", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.ProofSubmissionFee == nil { + x.ProofSubmissionFee = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ProofSubmissionFee); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -643,6 +722,11 @@ type Params struct { // when a proof is required (either via proof_requirement_threshold or proof_missing_penalty) // but is not provided. ProofMissingPenalty *v1beta1.Coin `protobuf:"bytes,4,opt,name=proof_missing_penalty,json=proofMissingPenalty,proto3" json:"proof_missing_penalty,omitempty"` + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. + ProofSubmissionFee *v1beta1.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee,omitempty"` } func (x *Params) Reset() { @@ -693,6 +777,13 @@ func (x *Params) GetProofMissingPenalty() *v1beta1.Coin { return nil } +func (x *Params) GetProofSubmissionFee() *v1beta1.Coin { + if x != nil { + return x.ProofSubmissionFee + } + return nil +} + var File_poktroll_proof_params_proto protoreflect.FileDescriptor var file_poktroll_proof_params_proto_rawDesc = []byte{ @@ -703,7 +794,7 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x61, 0x0a, 0x1c, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x20, 0xea, 0xde, 0x1f, 0x1c, 0x72, 0x65, 0x6c, @@ -728,20 +819,26 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4d, 0x69, 0x73, 0x73, - 0x69, 0x6e, 0x67, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, - 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9f, 0x01, 0xd8, - 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 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, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, - 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, - 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6e, 0x67, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x14, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, + 0x65, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, + 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x52, 0x12, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x65, + 0x65, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0x9f, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 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, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, + 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -763,11 +860,12 @@ var file_poktroll_proof_params_proto_goTypes = []interface{}{ } var file_poktroll_proof_params_proto_depIdxs = []int32{ 1, // 0: poktroll.proof.Params.proof_missing_penalty:type_name -> cosmos.base.v1beta1.Coin - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 1, // 1: poktroll.proof.Params.proof_submission_fee:type_name -> cosmos.base.v1beta1.Coin + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_poktroll_proof_params_proto_init() } diff --git a/config.yml b/config.yml index 5f5acb398..8a9eabb3f 100644 --- a/config.yml +++ b/config.yml @@ -239,6 +239,9 @@ genesis: proof_missing_penalty: amount: "320" denom: upokt + proof_submission_fee: + amount: "1000000" + denom: upokt shared: params: num_blocks_per_session: 10 diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index c51d0395a..e33e1e423 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -141,6 +141,8 @@ func (s *suite) newProofMsgUpdateParams(params paramsMap) cosmostypes.Msg { msgUpdateParams.Params.ProofRequirementThreshold = uint64(paramValue.value.(int64)) case prooftypes.ParamProofMissingPenalty: msgUpdateParams.Params.ProofMissingPenalty = paramValue.value.(*cosmostypes.Coin) + case prooftypes.ParamProofSubmissionFee: + msgUpdateParams.Params.ProofSubmissionFee = paramValue.value.(*cosmostypes.Coin) default: s.Fatalf("ERROR: unexpected %q type param name %q", paramValue.typeStr, paramName) } diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index 4ae05c22e..f0df8beaa 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -42,6 +42,7 @@ Feature: Params Namespace | proof_request_probability | 0.1 | float | | proof_requirement_threshold | 100 | int64 | | proof_missing_penalty | 500 | coin | + | proof_submission_fee | 5000000 | coin | Then all "proof" module params should be updated # NB: If you are reading this and the proof module has parameters @@ -92,6 +93,7 @@ Feature: Params Namespace | proof | /poktroll.proof.MsgUpdateParam | proof_request_probability | 0.1 | float | | proof | /poktroll.proof.MsgUpdateParam | proof_requirement_threshold | 100 | int64 | | proof | /poktroll.proof.MsgUpdateParam | proof_missing_penalty | 500 | coin | + | proof | /poktroll.proof.MsgUpdateParam | proof_submission_fee | 5000000 | coin | | shared | /poktroll.shared.MsgUpdateParam | num_blocks_per_session | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | grace_period_end_offset_blocks | 2 | int64 | | shared | /poktroll.shared.MsgUpdateParam | claim_window_open_offset_blocks | 2 | int64 | diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index dd317d027..c13b1dfc6 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -393,6 +393,11 @@ func (s *suite) assertExpectedModuleParamsUpdated(moduleName string) { params.ProofMissingPenalty = proofMissingPenalty.value.(*cosmostypes.Coin) } + proofSubmissionFee, ok := paramsMap[prooftypes.ParamProofSubmissionFee] + if ok { + params.ProofSubmissionFee = proofSubmissionFee.value.(*cosmostypes.Coin) + } + assertUpdatedParams(s, []byte(res.Stdout), &prooftypes.QueryParamsResponse{ diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index cd02b63b5..a92205188 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -34,6 +34,12 @@ message Params { // but is not provided. cosmos.base.v1beta1.Coin proof_missing_penalty = 4 [(gogoproto.jsontag) = "proof_missing_penalty"]; + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. + cosmos.base.v1beta1.Coin proof_submission_fee = 5 [(gogoproto.jsontag) = "proof_submission_fee"]; + // IMPORTANT: Make sure to update all related files if you're modifying or adding a new parameter. // Try the following grep to find all related places: `grep -r compute_units_to_tokens_multiplier` // TODO_IMPROVE: Look into an opportunity to use an enum to avoid using strings throughout the codebase. diff --git a/tools/scripts/params/proof_all.json b/tools/scripts/params/proof_all.json index 66e3a5396..97fc0e2dd 100644 --- a/tools/scripts/params/proof_all.json +++ b/tools/scripts/params/proof_all.json @@ -11,6 +11,10 @@ "proof_missing_penalty": { "amount": "320", "denom": "upokt" + }, + "proof_submission_fee": { + "amount": "1000000", + "denom": "upokt" } } } diff --git a/tools/scripts/params/proof_proof_submission_fee.json b/tools/scripts/params/proof_proof_submission_fee.json new file mode 100644 index 000000000..95d98fb62 --- /dev/null +++ b/tools/scripts/params/proof_proof_submission_fee.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.proof.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "proof_submission_fee", + "as_coin": { + "denom": "upokt", + "amount": "1000000" + } + } + ] + } +} diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index 6b941068d..1f1c2d112 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -71,6 +71,18 @@ func (k msgServer) UpdateParam( } params.ProofMissingPenalty = proofMissingPenalty + case types.ParamProofSubmissionFee: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) + if !ok { + return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + proofSubmissionFee := value.AsCoin + + if err := types.ValidateProofSubmissionFee(proofSubmissionFee); err != nil { + return nil, err + } + + params.ProofSubmissionFee = proofSubmissionFee default: return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index 243de80ea..d32eead82 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -122,3 +122,30 @@ func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofMissingPenalty") } + +func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { + expectedProofSubmissionFee := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000001)) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := prooftypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, expectedProofSubmissionFee, defaultParams.ProofSubmissionFee) + + // Update the proof request probability + updateParamMsg := &prooftypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: prooftypes.ParamProofSubmissionFee, + AsType: &prooftypes.MsgUpdateParam_AsCoin{AsCoin: &expectedProofSubmissionFee}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.ProofSubmissionFee, res.Params.ProofSubmissionFee) + require.Equal(t, &expectedProofSubmissionFee, res.Params.ProofSubmissionFee) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofSubmissionFee") +} diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index f5ce27e29..f50570c46 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -43,6 +43,7 @@ func TestMsgUpdateParams(t *testing.T) { Authority: k.GetAuthority(), Params: types.Params{ ProofMissingPenalty: &types.DefaultProofMissingPenalty, + ProofSubmissionFee: &types.MinProofSubmissionFee, RelayDifficultyTargetHash: types.DefaultRelayDifficultyTargetHash, }, }, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 6c281b639..a22a99a41 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -7,6 +7,7 @@ import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) @@ -164,3 +165,61 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { }) } } + +func TestParams_ValidateProofSubmissionFee(t *testing.T) { + invalidDenomCoin := cosmostypes.NewCoin("invalid_denom", math.NewInt(1)) + belowMinProofSubmissionFee := prooftypes.MinProofSubmissionFee. + Sub(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1))) + + tests := []struct { + desc string + proofSubmissionFee any + expectedErr error + }{ + { + desc: "invalid type", + proofSubmissionFee: int64(-1), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid parameter type: int64"), + }, + { + desc: "invalid denomination", + proofSubmissionFee: &invalidDenomCoin, + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + }, + { + desc: "missing", + proofSubmissionFee: nil, + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid parameter type: "), + }, + { + desc: "missing (typed)", + proofSubmissionFee: (*cosmostypes.Coin)(nil), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("missing proof_submission_fee"), + }, + { + desc: "below minimum", + proofSubmissionFee: &belowMinProofSubmissionFee, + expectedErr: prooftypes.ErrProofParamInvalid.Wrapf( + "ProofSubmissionFee param is below minimum value %s: got %s", + prooftypes.MinProofSubmissionFee, + belowMinProofSubmissionFee, + ), + }, + { + desc: "valid", + proofSubmissionFee: &prooftypes.MinProofSubmissionFee, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := prooftypes.ValidateProofSubmissionFee(tt.proofSubmissionFee) + if tt.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), tt.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index b9a0b4621..cc261973b 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -20,6 +20,8 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v} case []byte: valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v} + case *sdk.Coin: + valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} default: return nil, fmt.Errorf("unexpected param value type: %T", value) } @@ -55,6 +57,8 @@ func (msg *MsgUpdateParam) ValidateBasic() error { return msg.paramTypeIsInt64() case ParamProofMissingPenalty: return msg.paramTypeIsCoin() + case ParamProofSubmissionFee: + return msg.paramTypeIsCoin() default: return ErrProofParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 218831ba2..b6da6324c 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -33,6 +33,12 @@ var ( KeyProofMissingPenalty = []byte("ProofMissingPenalty") ParamProofMissingPenalty = "proof_missing_penalty" DefaultProofMissingPenalty = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(320)) // See: https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md + + KeyProofSubmissionFee = []byte("ProofSubmissionFee") + ParamProofSubmissionFee = "proof_submission_fee" + // TODO_MAINNET: Determine a sensible default value for the proof submission fee. + // MinProofSubmissionFee is the default and minimum fee for submitting a proof. + MinProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000)) ) // ParamKeyTable the param key table for launch module @@ -46,12 +52,14 @@ func NewParams( proofRequestProbability float32, proofRequirementThreshold uint64, proofMissingPenalty *cosmostypes.Coin, + proofSubmissionFee *cosmostypes.Coin, ) Params { return Params{ RelayDifficultyTargetHash: relayDifficultyTargetHash, ProofRequestProbability: proofRequestProbability, ProofRequirementThreshold: proofRequirementThreshold, ProofMissingPenalty: proofMissingPenalty, + ProofSubmissionFee: proofSubmissionFee, } } @@ -62,6 +70,7 @@ func DefaultParams() Params { DefaultProofRequestProbability, DefaultProofRequirementThreshold, &DefaultProofMissingPenalty, + &MinProofSubmissionFee, ) } @@ -88,6 +97,11 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { &p.ProofMissingPenalty, ValidateProofMissingPenalty, ), + paramtypes.NewParamSetPair( + KeyProofSubmissionFee, + &p.ProofSubmissionFee, + ValidateProofSubmissionFee, + ), } } @@ -110,6 +124,10 @@ func (params *Params) ValidateBasic() error { return err } + if err := ValidateProofSubmissionFee(params.ProofSubmissionFee); err != nil { + return err + } + return nil } @@ -177,3 +195,30 @@ func ValidateProofMissingPenalty(v interface{}) error { return nil } + +// ValidateProofSubmission validates the ProofSubmissionFee param. +// NB: The argument is an interface type to satisfy the ParamSetPair function signature. +func ValidateProofSubmissionFee(v interface{}) error { + submissionFeeCoin, ok := v.(*cosmostypes.Coin) + if !ok { + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + } + + if submissionFeeCoin == nil { + return ErrProofParamInvalid.Wrap("missing proof_submission_fee") + } + + if submissionFeeCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", submissionFeeCoin.Denom) + } + + if submissionFeeCoin.Amount.LT(MinProofSubmissionFee.Amount) { + return ErrProofParamInvalid.Wrapf( + "ProofSubmissionFee param is below minimum value %s: got %s", + MinProofSubmissionFee, + submissionFeeCoin, + ) + } + + return nil +} diff --git a/x/proof/types/params.pb.go b/x/proof/types/params.pb.go index f56644e2a..12994f2f5 100644 --- a/x/proof/types/params.pb.go +++ b/x/proof/types/params.pb.go @@ -46,6 +46,11 @@ type Params struct { // when a proof is required (either via proof_requirement_threshold or proof_missing_penalty) // but is not provided. ProofMissingPenalty *types.Coin `protobuf:"bytes,4,opt,name=proof_missing_penalty,json=proofMissingPenalty,proto3" json:"proof_missing_penalty"` + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. + ProofSubmissionFee *types.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -105,6 +110,13 @@ func (m *Params) GetProofMissingPenalty() *types.Coin { return nil } +func (m *Params) GetProofSubmissionFee() *types.Coin { + if m != nil { + return m.ProofSubmissionFee + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.proof.Params") } @@ -112,33 +124,35 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/params.proto", fileDescriptor_2ad689ad5bf3a2d7) } var fileDescriptor_2ad689ad5bf3a2d7 = []byte{ - // 408 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xb1, 0x6e, 0xd5, 0x30, - 0x14, 0x86, 0xaf, 0xdb, 0xaa, 0x43, 0x40, 0x48, 0x04, 0x50, 0x6f, 0x5a, 0x70, 0x22, 0xa6, 0x08, - 0x09, 0x5b, 0x85, 0x8d, 0x31, 0x30, 0x30, 0x80, 0x74, 0x15, 0x75, 0x81, 0xc5, 0x72, 0x52, 0xdf, - 0xc4, 0x6a, 0x92, 0x13, 0x6c, 0x5f, 0x20, 0xaf, 0xc0, 0xc4, 0x23, 0xf0, 0x08, 0x48, 0xbc, 0x04, - 0x63, 0xc7, 0x4e, 0x11, 0xca, 0x1d, 0x40, 0x79, 0x0a, 0x74,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 0xf9, 0x6e, 0x84, 0xe2, 0xbd, 0x24, 0x1c, 0xfb, 0xf0, 0x26, 0x5b, 0x1a, 0x6c, 0xc7, 0x4f, 0xec, - 0xe4, 0x12, 0xf9, 0xa5, 0xf7, 0xc0, 0x75, 0xd6, 0x52, 0x6b, 0xd9, 0x14, 0xac, 0x15, 0x0d, 0xaf, - 0x4c, 0x37, 0xdf, 0x8b, 0x50, 0x7c, 0xeb, 0x59, 0x40, 0xdc, 0xa6, 0xc9, 0x66, 0xd3, 0x64, 0xda, - 0x34, 0x79, 0x09, 0xb2, 0x49, 0x82, 0xb1, 0x0f, 0xff, 0xdf, 0x9b, 0xde, 0xb3, 0xf2, 0x5b, 0xa7, - 0x2e, 0x9c, 0xf8, 0x22, 0xfa, 0xf3, 0x2d, 0x44, 0x5f, 0x7e, 0x7f, 0x7f, 0x72, 0xb0, 0x8d, 0xc4, - 0xe7, 0x29, 0x14, 0xee, 0xab, 0x92, 0x37, 0x3f, 0x07, 0x8c, 0xce, 0x07, 0x8c, 0x2e, 0x06, 0x8c, - 0x7e, 0x0d, 0x18, 0x7d, 0x5d, 0xe3, 0xd9, 0xf9, 0x1a, 0xcf, 0x2e, 0xd6, 0x78, 0xf6, 0x9e, 0x14, - 0xd2, 0x94, 0xab, 0x8c, 0xe4, 0x50, 0xd3, 0xcd, 0x84, 0xa7, 0x8d, 0x30, 0x9f, 0x40, 0x9d, 0xd1, - 0x7f, 0xc6, 0x99, 0xae, 0x15, 0x3a, 0xdb, 0xb7, 0x51, 0x78, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, - 0x5e, 0x92, 0x9f, 0x7b, 0x82, 0x02, 0x00, 0x00, + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x6e, 0xd4, 0x40, + 0x10, 0x86, 0x6f, 0xc3, 0x91, 0xc2, 0x20, 0x24, 0x4c, 0x50,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60, 0x74, 0xb6, 0x0a, 0x46, 0xe7, 0xab, 0x60, 0xf4, 0x2e, 0xce, 0x85, 0x2e, + 0x16, 0x59, 0x3c, 0xc3, 0x8a, 0xae, 0x27, 0x3c, 0xaa, 0x41, 0x7f, 0x44, 0x79, 0x4a, 0xff, 0x1a, + 0xa7, 0xdb, 0x06, 0x54, 0xb6, 0x6b, 0x1a, 0xf7, 0xe4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, + 0x34, 0x22, 0xd7, 0xe9, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -172,6 +186,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.ProofMissingPenalty.Equal(that1.ProofMissingPenalty) { return false } + if !this.ProofSubmissionFee.Equal(that1.ProofSubmissionFee) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -194,6 +211,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProofSubmissionFee != nil { + { + size, err := m.ProofSubmissionFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if m.ProofMissingPenalty != nil { { size, err := m.ProofMissingPenalty.MarshalToSizedBuffer(dAtA[:i]) @@ -258,6 +287,10 @@ func (m *Params) Size() (n int) { l = m.ProofMissingPenalty.Size() n += 1 + l + sovParams(uint64(l)) } + if m.ProofSubmissionFee != nil { + l = m.ProofSubmissionFee.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -396,6 +429,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofSubmissionFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProofSubmissionFee == nil { + m.ProofSubmissionFee = &types.Coin{} + } + if err := m.ProofSubmissionFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index 9f18a148c..e4fec264c 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -125,6 +125,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_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes