Skip to content

Conversation

@sentientforest
Copy link
Contributor

No description provided.

- 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
Copy link
Collaborator

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)

Comment on lines +82 to +83
- Track burn history
- Emit burn events
Copy link
Collaborator

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.
Copy link
Collaborator

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

Suggested change
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
Copy link
Collaborator

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?
Copy link
Collaborator

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?
Copy link
Collaborator

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:

  1. 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
  2. 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
  3. Edge cases, when partial success is allowed, like in BatchSubmit

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.

2 participants