Skip to content

Conversation

@outerlook
Copy link
Collaborator

What's inside

  • Go & Python helpers for GrantRole, RevokeRole, AreMembersOf, ListRoleMembers.
  • TNClient exposes matching methods + new typed dicts.
  • Bump sdk-go to v0.3.2; add eth_account for tests.
  • Integration suite: role grant/revoke happy-path + permission gate; fixtures auto-whitelist writer role.
  • Docs: short call-outs that stream deployment needs system:network_writer; no self-grant guidance.

Issue

Validation

pytest green;

outerlook added 12 commits June 10, 2025 11:14
- Introduced `GrantRole`, `RevokeRole`, and `AreMembersOf` functions in Go bindings for managing roles across multiple wallets. - Enhanced the Python SDK with corresponding methods for granting and revoking roles, as well as checking wallet membership status. - Added `RoleMembershipStatus` TypedDict to represent membership status in Python. This update improves role management capabilities within the SDK.
- Introduced a new test suite in `test_role_management.py` to validate role management features. - Implemented tests for granting, revoking, and checking membership of roles. - Added edge case tests for permission gating and unauthorized role grants. - Ensured comprehensive coverage of role management scenarios to enhance SDK reliability.
- Updated `github.com/trufnetwork/sdk-go` dependency to version v0.3.2 in `go.mod` and `go.sum`. - Added detailed documentation for new batch operations and role management functions in `api-reference.md`, including examples and parameter descriptions. - Improved clarity on stream deployment permissions and added new sections for batch operations and role management in the API reference.
- Improved docstrings for the TNClient class, including detailed descriptions of parameters and return values for methods such as `insert_record`, `batch_insert_records`, and `set_taxonomy`. - Added notes regarding best practices for batch operations to prevent nonce errors. - Clarified the expected input types and structures for various methods, ensuring better understanding for users of the SDK.
- Updated the `github.com/trufnetwork/sdk-go` dependency version in `go.mod` and `go.sum` to v0.3.2, ensuring compatibility with the latest features and fixes.
- Enhanced the `convertToString` function to support `util.EthereumAddress` types. - Introduced a new helper function `strSliceToEthAddrs` to convert a slice of hex wallet strings to `[]util.EthereumAddress`. - Updated `GrantRole`, `RevokeRole`, and `AreMembersOf` functions to use Ethereum addresses instead of string wallets. - Added `list_role_members` method in the Python SDK to retrieve members of a role with optional pagination, returning a list of `RoleMember` dictionaries. This update improves Ethereum address handling and role management capabilities within the SDK.
- Introduced a new fixture `grant_network_writer` in `conftest.py` to facilitate granting the `network_writer` role to clients. - Added `manager_private_key` and `manager_client` fixtures in `test_trufnetwork.py` for managing elevated privileges in tests. - Created a new helper function `ensure_network_writer` in `permissions.py` to check and grant the `network_writer` role as needed. - Established a new `helpers` package to organize helper functions. This update enhances role management capabilities for testing within the SDK.
- Replaced instances of root_client with manager_client in role management tests to align with new fixture setup. - Added a new test for verifying list_role_members functionality with pagination. - Enhanced existing tests for granting, revoking, and checking role membership to utilize the manager_client for elevated permissions. This update improves the consistency and maintainability of role management tests within the SDK.
- Modified the `client` fixture in multiple test files to include the `grant_network_writer` function, ensuring that clients have the necessary permissions for testing. - This change enhances the setup for tests involving network operations, improving consistency across the test suite. This update streamlines the client initialization process and ensures proper role management in tests.
- Added `eth_account` dependency with a minimum version of 0.8.0 to the development requirements. - This update ensures that the project has the necessary tools for Ethereum account management during development.
- Added sections on role-based permissions in `README.md`, emphasizing the requirement of the `system:network_writer` role for deploying streams. - Updated `api-reference.md` to include details on role management and permissions, including who can grant roles and a table summarizing system vs. user roles. - Enhanced `examples/README.md` and `complex_example/main.py` with permission notes regarding the `system:network_writer` role for executing scripts. These changes improve documentation clarity regarding permissions and role management within the TRUF.NETWORK ecosystem.
- Removed comments in the AreMembersOf function that referenced the need for updates to the go-sdk's IRoleManagement interface. - This change cleans up the code by eliminating unnecessary notes that may cause confusion regarding the current implementation. This update enhances code clarity and maintainability within the bindings.go file.
@outerlook outerlook requested a review from MicBun June 11, 2025 18:46
@outerlook outerlook self-assigned this Jun 11, 2025
@outerlook outerlook changed the title # feat: role-management bindings & permission docs feat: role-management bindings & permission docs Jun 11, 2025
@pr-time-tracker
Copy link

pr-time-tracker bot commented Jun 11, 2025

Time Submission Status

Member Status Time Action Last Update
outerlook ✅ Submitted 3h Update time Jun 11, 2025, 6:55 PM
MicBun ✅ Submitted 15min Update time Jun 12, 2025, 12:09 AM
@MicBun MicBun merged commit 9d4f46e into main Jun 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants