Skip to content

Document Fabric v3 QueryApproved query modes and add unit test (#208) - #251

Open
Ishaan-Gpt wants to merge 2 commits into
hyperledger:mainfrom
Ishaan-Gpt:query-all-approved-docs-208
Open

Ishaan-Gpt wants to merge 2 commits into
hyperledger:mainfrom
Ishaan-Gpt:query-all-approved-docs-208

Conversation

@Ishaan-Gpt

Copy link
Copy Markdown

Addresses #208.

This documents the Fabric v3 query capabilities on chaincode.Gateway.QueryApproved and adds a unit test where it adds value.

What changed:

  • Godoc on QueryApproved now describes the Fabric v3 behavior: passing a zero sequence queries the latest approved chaincode definition (the peer resolves the latest sequence when the sequence field is omitted), and it notes that channel-wide queries go through the separate QueryApprovedChaincodeDefinitions lifecycle function.
  • New unit test pins the zero-sequence pass-through: a 0 sequence reaches the peer unset in the marshaled QueryApprovedChaincodeDefinitionArgs, and the QueryApprovedChaincodeDefinition transaction function is invoked.

Verification notes:

  • I confirmed the v3 semantics against the Fabric v3.0 lifecycle source: QueryApprovedChaincodeDefinition treats sequence 0 as latest, and the plural QueryApprovedChaincodeDefinitions function returns every approved definition on the channel.
  • End-to-end coverage against a live Fabric v3 network still needs a running network, so that part is left as follow-up.

Tests run locally:

  • go build ./... (clean)
  • go test -race -count=1 ./pkg/... (all packages pass)
  • go vet ./pkg/... (clean)
  • gofmt -l -s (clean)

Describe the Fabric v3 lifecycle behavior on chaincode.Gateway.QueryApproved:
passing a zero sequence queries the latest approved chaincode definition, and
note the separate QueryApprovedChaincodeDefinitions function for channel-wide
queries.

Addresses hyperledger#208

Signed-off-by: Ishaan-Gpt <ishaangupta011205@gmail.com>
Verify that a zero sequence is passed through unset in the lifecycle query
args so Fabric v3 resolves the latest approved chaincode definition, and that
the QueryApprovedChaincodeDefinition transaction function is invoked.

Addresses hyperledger#208

Signed-off-by: Ishaan-Gpt <ishaangupta011205@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant