You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue aims to improve the type safety of action hashes in our Holochain application. We'll focus on both the host code written in Rust and the guest code written in TypeScript. Our primary goal is to prevent bugs caused by sending incorrect action hashes to zome functions.
Proposed Changes
For the Rust Host Code:
Create a custom ActionHash type
Implement discriminated unions for different action hash entities
Add runtime checks for valid action hash types
Provide utility functions for working with action hashes
For the TypeScript Guest Code:
Create a corresponding ActionHash type
Implement type guards for different action hash entities
Add runtime checks for valid action hash types
Provide utility functions for working with action hashes
Implementation Steps
Rust Host Code
Define a custom ActionHash type
Implement a discriminated union for different action hash entities
Create utility functions for parsing and validating action hashes
Modify existing code to use the new ActionHash type
Add runtime checks for valid action hash types
TypeScript Guest Code
Define a corresponding ActionHash type
Implement type guards for different action hash entities
Create utility functions for working with action hashes
Modify existing code to use the new ActionHash type
Add runtime checks for valid action hash types
Benefits
Improved type safety for action hashes
Reduced likelihood of bugs caused by incorrect action hash types
Better error handling and reporting
Enhanced maintainability of the codebase
Acceptance Criteria
Custom ActionHash type implemented in Rust host code
Discriminated union for different action hash entities in Rust
Runtime checks for valid action hash types in Rust
Corresponding ActionHash type implemented in TypeScript guest code
Type guards for different action hash entities in TypeScript
Runtime checks for valid action hash types in TypeScript
Utility functions for working with action hashes in both languages
Existing code modified to use new ActionHash type
Comprehensive tests covering various action hash scenarios
The text was updated successfully, but these errors were encountered:
Soushi888
changed the title
Better type checking for action hashs
Enhance Action Hash Type Safety
Oct 28, 2024
Description
This issue aims to improve the type safety of action hashes in our Holochain application. We'll focus on both the host code written in Rust and the guest code written in TypeScript. Our primary goal is to prevent bugs caused by sending incorrect action hashes to zome functions.
Proposed Changes
For the Rust Host Code:
ActionHash
typeFor the TypeScript Guest Code:
ActionHash
typeImplementation Steps
Rust Host Code
ActionHash
typeActionHash
typeTypeScript Guest Code
ActionHash
typeActionHash
typeBenefits
Acceptance Criteria
ActionHash
type implemented in Rust host codeActionHash
type implemented in TypeScript guest codeActionHash
typeThe text was updated successfully, but these errors were encountered: