Skip to content

doc: add caveat for setEvent in nested invocations#502

Open
JhaSourav07 wants to merge 1 commit intohyperledger:mainfrom
JhaSourav07:doc/issue-294-setevent-caveat
Open

doc: add caveat for setEvent in nested invocations#502
JhaSourav07 wants to merge 1 commit intohyperledger:mainfrom
JhaSourav07:doc/issue-294-setevent-caveat

Conversation

@JhaSourav07
Copy link
Contributor

Description

This PR updates the JSDoc for the setEvent method in ChaincodeStub to clarify its behavior during chaincode-to-chaincode (CC2CC) invocations. As discussed in Issue #294, the current documentation does not explicitly warn developers that events can only be set from the outermost chaincode invocation.

This update ensures that the Node.js shim documentation is consistent with the Hyperledger Fabric official documentation and the Go/Java shim implementations.

Changes

  • Updated libraries/fabric-shim/lib/stub.js to include a specific note regarding chaincode-to-chaincode scenarios.
  • Clarified that only a single chaincode event can be included in a transaction and that if multiple calls to setEvent occur, only the last event is included.
  • Added an explicit warning that events set in nested chaincode calls (e.g., if Chaincode A calls Chaincode B, and B calls setEvent) will be ignored by the peer.

Related Issue

Fixes: #294

Checklist

  • Documentation updated
  • Follows the project's coding standards
  • Commit is signed-off (DCO)

Signed-off-by: Sourav <souravkjha2007@gmail.com>
@JhaSourav07 JhaSourav07 requested a review from a team as a code owner March 12, 2026 05:56
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.

setEvent documentation should include information about it being only usable in the outer most chaincode

1 participant