-
Notifications
You must be signed in to change notification settings - Fork 43
docs: new Q&A questions and answers section #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| - Reduced world state database load | ||
| - Automatic cache management | ||
|
|
||
| Note: The stub cache is specifically designed for transaction-level caching. For cross-transaction data access patterns, consider implementing appropriate data structures and query patterns in your chaincode. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also it's worth emphasizing that this is the different behavior that is supported by Fabric by default.
also we don't support cache for range reads (yet)
Co-authored-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
Co-authored-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
Co-authored-by: Jakub Dzikowski <jakub.t.dzikowski@gmail.com>
…ain-sdk into docs/new-questions
| - Track burn history | ||
| - Emit burn events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah - bumping this - we don't emit any events, and I'm not sure what does is mean in this context
|
|
||
| Note: The stub cache is specifically designed for transaction-level caching. This is different from Fabric's default behavior and is not supported by default in the Hyperledger Fabric framework. This support covers the most common use case of partial composite keys and queries, but does not yet support range reads (`RangedChainObject` / `getStateByRange`). | ||
|
|
||
| For cross-transaction data access patterns, consider implementing appropriate data structures and query patterns in your chaincode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is some extended description of how it works for cross chaincode calls, feel free to adapt it and improve language
| For cross-transaction data access patterns, consider implementing appropriate data structures and query patterns in your chaincode. | |
| For cross-transaction data access patterns (`stub.invokeChaincode()`), the SDK ensures the state consistency by limiting calls to other chaincodes. You may call multiple `DryRun` calls at the beginning of the transaction (SDK ensures this is the call with no writes), and then only a single other call. If you need to call multiple write transactions on another chaincode, you may use `BatchSubmit` method. |
| - Implement helper methods for relationship navigation | ||
| - Consider query performance when designing relationships | ||
| - Validate references before saving | ||
| - Document relationship patterns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add something to explain that under the hood there is a KV store, and if you want to change the key, you need to remember about deleting the old object
| ### Question | ||
|
|
||
|
|
||
| What's the best way to emit and handle events in chaincode? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we don't need this file at all?
| ### Question | ||
|
|
||
|
|
||
| What are the best practices for error recovery in chaincode? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling both files: docs/questions/error-recovery-best-practices.md and docs/questions/errors-and-exceptions-in-chaincode.md are mostly irrelevant and misleading. What do we need is:
- The explanation of our error classes in general (the hierarchy, what is error key, what is error code, common methods). I'm not sure if Q&A is a good place, maybe it would be better for concepts. https://github.com/GalaChain/sdk/blob/main/chain-api/src/utils/error.ts
- The explanation how errors handling should look like in the transaction - uncaught throw => transaction fails, nothing is saved, and it it guaranteed here: https://github.com/GalaChain/sdk/blob/main/chaincode/src/contracts/GalaTransaction.ts#L232
- Edge cases, when partial success is allowed, like in
BatchSubmit
No description provided.