Skip to content

feat: Add comprehensive Sendable conformance and thread safety [IOS-3436] #383

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dioKaratzas
Copy link
Contributor

@dioKaratzas dioKaratzas commented Aug 1, 2025

https://argent.atlassian.net/browse/IOS-3436

  • Add ThreadSafeBox utility class for thread-safe property wrapper
  • Implement Sendable conformance across all major classes and protocols:
    • Client classes (EthereumHttpClient, EthereumWebSocketClient, etc.)
    • ENS classes (ENSResolver, ENSMultiResolver, EthereumNameService)
    • ERC standard implementations (ERC20, ERC721, ERC1271, ERC165)
    • Account management (EthereumAccount, EthereumKeyLocalStorage)
    • Contract and ABI types
    • Network providers and utilities
  • Convert ENSResolver to use thread-safe property access with ThreadSafeBox
  • Fix ENSMultiResolver thread safety with atomic operations for queries and responses
  • Update EthereumKeyLocalStorage with thread-safe address handling
  • Mark classes as final where appropriate for performance
  • Use @unchecked Sendable for classes with internal synchronization
  • Update test classes to conform to Sendable requirements
  • Ensure all protocols inherit Sendable conformance where needed

This enables safe concurrent usage across the entire web3.swift library
while maintaining backward compatibility and performance.

@dioKaratzas dioKaratzas requested a review from DarthMike August 1, 2025 12:58
@dioKaratzas dioKaratzas changed the title feat: Add comprehensive Sendable conformance and thread safety feat: Add comprehensive Sendable conformance and thread safety [IOS-3436] Aug 1, 2025
@dioKaratzas dioKaratzas force-pushed the tech/sendable branch 6 times, most recently from 5cbf6e5 to e6fa0e6 Compare August 7, 2025 09:27
- https://argent.atlassian.net/browse/IOS-3436

Summary:
- Add ThreadSafeBox utility class for thread-safe property wrapper
- Implement Sendable conformance across all major classes and protocols:
  - Client classes (EthereumHttpClient, EthereumWebSocketClient, etc.)
  - ENS classes (ENSResolver, ENSMultiResolver, EthereumNameService)
  - ERC standard implementations (ERC20, ERC721, ERC1271, ERC165)
  - Account management (EthereumAccount, EthereumKeyLocalStorage)
  - Contract and ABI types
  - Network providers and utilities
- Convert ENSResolver to use thread-safe property access with ThreadSafeBox
- Fix ENSMultiResolver thread safety with atomic operations for queries and responses
- Update EthereumKeyLocalStorage with thread-safe address handling
- Mark classes as final where appropriate for performance
- Use @unchecked Sendable for classes with internal synchronization
- Update test classes to conform to Sendable requirements
- Ensure all protocols inherit Sendable conformance where needed

This enables safe concurrent usage across the entire web3.swift library
while maintaining backward compatibility and performance.
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.

1 participant