Repository navigation
Add Equatable and Hashable to Transaction types - #968
Conversation
DRadmir
commented
Feb 23, 2026
- TransactionUtxoInput: add Hashable
- Transaction: add Hashable
- TransactionExtended: add Equatable, Hashable
- TransactionUtxoInput: add Hashable - Transaction: add Hashable - TransactionExtended: add Equatable, Hashable
Changed Files
|
Summary of ChangesHello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully implements the addition of Hashable to Transaction and TransactionUtxoInput, and Equatable, Hashable to TransactionExtended as described. However, for TransactionExtended and TransactionUtxoInput, there are potential maintainability issues due to a mismatch between the derived Rust traits and the typeshare Swift traits. It is recommended to align the Rust derive attributes with the typeshare declarations for consistency and predictable behavior.
|
|
||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| #[typeshare(swift = "Sendable")] | ||
| #[typeshare(swift = "Sendable, Equatable, Hashable")] |
There was a problem hiding this comment.
The TransactionExtended struct is marked with typeshare(swift = "Sendable, Equatable, Hashable"), implying that the Swift type will conform to Equatable and Hashable. However, the Rust struct does not derive PartialEq or Hash. For consistency and to ensure correct behavior in Swift, it's best practice to derive PartialEq, Eq, and Hash for the Rust struct when its Swift counterpart is Equatable and Hashable.
Consider adding PartialEq, Eq, and Hash to the derive attribute for TransactionExtended.
| #[typeshare(swift = "Sendable, Equatable, Hashable")] | |
| #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] |
|
|
||
| #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
| #[typeshare(swift = "Sendable, Equatable")] | ||
| #[typeshare(swift = "Sendable, Equatable, Hashable")] |
There was a problem hiding this comment.
The TransactionUtxoInput struct is marked with typeshare(swift = "Sendable, Equatable, Hashable"), implying that the Swift type will conform to Hashable. While PartialEq is already derived, Hash and Eq are missing from the Rust derive attributes. For consistency and to ensure correct hashing behavior in Swift, it's best practice to derive Eq and Hash for the Rust struct when its Swift counterpart is Hashable.
Consider adding Eq and Hash to the derive attribute for TransactionUtxoInput.
| #[typeshare(swift = "Sendable, Equatable, Hashable")] | |
| #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] |