{"record":{"id":"d69e46b8252b6007","repo":"hyperledger/fabric","slug":"lscc-can-only-issue-one-or-two-putstate-upon-deplo","errorCode":null,"errorMessage":"LSCC can only issue one or two putState upon deploy","messagePattern":"LSCC can only issue one or two putState upon deploy","errorType":"validation","errorClass":"VSCCEndorsementPolicyError","httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":375,"sourceCode":"}\n\n// validateRWSetAndCollection performs validation of the rwset\n// of an LSCC deploy operation and then it validates any collection\n// configuration.\nfunc (vscc *Validator) validateRWSetAndCollection(\n\tlsccrwset *kvrwset.KVRWSet,\n\tcdRWSet *ccprovider.ChaincodeData,\n\tlsccArgs [][]byte,\n\tlsccFunc string,\n\tac vc.Capabilities,\n\tchannelName string,\n) commonerrors.TxValidationError {\n\t/********************************************/\n\t/* security check 0.a - validation of rwset */\n\t/********************************************/\n\t// there can only be one or two writes\n\tif len(lsccrwset.Writes) > 2 {\n\t\treturn policyErr(fmt.Errorf(\"LSCC can only issue one or two putState upon deploy\"))\n\t}\n\n\t/**********************************************************/\n\t/* security check 0.b - validation of the collection data */\n\t/**********************************************************/\n\tvar collectionsConfigArg []byte\n\tif len(lsccArgs) > 5 {\n\t\tcollectionsConfigArg = lsccArgs[5]\n\t}\n\n\tvar collectionsConfigLedger []byte\n\tif len(lsccrwset.Writes) == 2 {\n\t\tkey := privdata.BuildCollectionKVSKey(cdRWSet.Name)\n\t\tif lsccrwset.Writes[1].Key != key {\n\t\t\treturn policyErr(fmt.Errorf(\"invalid key for the collection of chaincode %s:%s; expected '%s', received '%s'\",\n\t\t\t\tcdRWSet.Name, cdRWSet.Version, key, lsccrwset.Writes[1].Key))\n\t\t}\n","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L357-L393","documentation":"validateRWSetAndCollection found the LSCC write-set for a deploy/upgrade contains more than two writes. LSCC may only write the chaincode data key and (optionally) the collections key, so extra writes indicate a tampered or malformed transaction.","triggerScenarios":"Thrown at core/handlers/validation/builtin/v12/validation_logic.go:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the deploy/upgrade transaction writes only the CD and collection keys via LSCC","Reject the transaction — extra writes fail validation at commit"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}