Skip to content

feat: Add initial implementation of audit trails module#161

Draft
itsyaasir wants to merge 98 commits intomainfrom
feat/audit-trails-dev
Draft

feat: Add initial implementation of audit trails module#161
itsyaasir wants to merge 98 commits intomainfrom
feat/audit-trails-dev

Conversation

@itsyaasir
Copy link
Contributor

Description of change

Links to any relevant issues

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes
  • I have updated the CHANGELOG.md, if my changes are significant enough

itsyaasir and others added 26 commits December 11, 2025 18:44
* rename `audit_trails` folder to `audit-trails-move`
* Add folders for audit-trails-rs and audit_trails_wasm
* First implementation of the permission module based on a `Permission` enum
* Unit tests for the `Permission` enum
* Renamed `AuditTrail::permissions` to `AuditTrail::roles`
* Renamed all modules and type-names from plural to singular name
  * audit_trails -> audit_trail
  * permissions -> permission
  * capabilities -> capability
Unit tests are still buggy and will be fixed with the next commit.
Rename MetaDataUpdate to MetadataUpdate

Co-authored-by: Yasir <yasir@shariff.dev>
…otaledger/notarization into feat/audit-trails-api-roles-management
…-management

# Conflicts:
#	audit-trail-move/sources/locking.move
#	audit-trails-move/sources/audit_trails.move
…anagement

Feat/audit trails api roles management
Comment on lines +31 to +38
// TODO: Is this needed? What is a setup capability?
//
// /// Create a setup capability for trail initialization
// public fun new_setup_cap(ctx: &mut TxContext): Capability {
// Capability {
// id: object::new(ctx),
// }
// }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

itsyaasir and others added 3 commits January 5, 2026 09:59
Also split of the role and capability management from the AT main module to allow reuse with other products.
…extended

# Conflicts:
#	audit-trail-move/sources/audit_trail.move
#	audit-trail-move/sources/capability.move
#	audit-trail-move/tests/capability_tests.move
#	audit-trail-move/tests/create_audit_trail_tests.move
#	audit-trail-move/tests/role_tests.move
#	audit-trail-move/tests/test_utils.move
itsyaasir and others added 27 commits February 9, 2026 12:58
…error handling

- Introduced `from_iota_client` method for creating an `AuditTrailClient` without signing capabilities.
- Added `NoSigner` marker type and `FromIotaClientError` for improved error handling during client creation.
- Updated `AuditTrailClient` to manage public keys and signers more effectively.
- Enhanced `AuditTrailClientReadOnly` with a new method for custom package ID handling.
… initialization

- Replaced the custom `new` method in `AuditTrailBuilder` with the `Default` trait for simpler instantiation.
- Added `Default` implementation to `LockingWindow` and `LockingConfig` structs for consistent default behavior.
- Refactored tests to remove unused environment variable handling and directly use `Data::text` for record creation.
- Moved `AuditTrailHandle`, `AuditTrailFull`, and `AuditTrailReadOnly` traits to a new `trail` module for better organization.
- Introduced new modules for capabilities, creation, locking, metadata, records, and roles to enhance modularity.
- Updated import paths across the codebase to reflect the new module structure.
- Removed deprecated `handler` and `transactions` modules to streamline the codebase.
- Enhanced `TrailRecords` and `TrailCapabilities` with new functionalities for managing audit trail records and capabilities.
- Updated import for `CreateTrail` to reflect its new location in the `create` module.
- Added a new `trail.rs` module containing traits and structures for managing audit trails, including `AuditTrailReadOnly`, `AuditTrailFull`, and `AuditTrailHandle`.
- Enhanced organization of audit trail components for improved modularity and maintainability.
…it trail module

- Added `RolesOps` struct with methods for creating, updating, deleting roles, and issuing capabilities.
- Removed the `capability` module and integrated its functionality into the `role_map` module.
- Introduced new event types: `RoleCreated`, `RoleUpdated`, and `RoleDeleted` to track role changes.
- Updated the `AuditTrailHandle` to remove capability-related methods and focus on role management.
- Created comprehensive end-to-end tests for role creation, permission updates, capability issuance, revocation, and destruction.
- Refactored client tests to remove unnecessary dependencies and streamline functionality.
…ties

- Implemented `destroy_initial_admin_capability` and `revoke_initial_admin_capability` methods in `RolesOps`.
- Created new transaction types for managing roles and capabilities, including `CreateRole`, `UpdateRole`, `DeleteRole`, `IssueCapability`, `RevokeCapability`, `DestroyCapability`, `DestroyInitialAdminCapability`, and `RevokeInitialAdminCapability`.
- Updated `AuditTrailHandle` to remove unnecessary `records_as` method.
- Refactored `RoleMap` structure to improve clarity and maintainability.
- Enhanced end-to-end tests to cover new functionality for destroying and revoking initial admin capabilities, ensuring proper event emissions and error handling.
…ons and transactions modules for better structure
- Simplified transaction builder calls in `TrailRecords`, `TrailRoles`, and `RolesOps` by removing unnecessary line breaks.
- Updated `RecordsOps` to use a unified transaction building method with permission checks.
- Enhanced `RolesOps` to streamline role management operations, including creating, updating, and deleting roles.
- Improved error handling in `AuditTrailHandle` for fetching on-chain trail data.
- Refactored permission handling in `Permission` enum to include a method for retrieving Move function names.
- Cleaned up imports and organized code structure for better readability across multiple modules.
- Added tests for role and record functionalities to ensure proper integration and functionality.
- Updated `RoleUpdated` struct to remove unused fields.
- Enhanced `Permission` enum with new methods for type tagging and programmable transaction building.
- Changed `PermissionSet` to use `HashSet` instead of `Vec` for permissions.
- Modified `PaginatedRecord` to use `BTreeMap` for ordered records.
- Added new test functions for role creation, capability issuance, and record management.
- Improved error handling and assertions in tests for better clarity and reliability.
- Updated dependencies in `Cargo.toml` for `iota_interaction` and `product_common` to use the latest branch with event emission features.
- Introduced `DeleteAllRecords` permission to manage batch deletions.
- Implemented `delete_records_batch` functionality in the records module to allow deletion of multiple records at once.
- Enhanced permission checks to ensure that only authorized roles can perform batch deletions.
- Added tests to validate the new batch deletion feature and its integration with existing audit trail functionalities.
- Updated the audit trail deletion process to ensure it fails when records exist, enforcing data integrity.
- Refactored locking mechanisms to accommodate new deletion workflows.
…notarization into feat/audit-trail-rs-scaffold
- Updated role_tests to include TimeLock parameters in locking configurations.
- Modified CreateOps to accept tf_components_package_id for trail creation.
- Introduced new transactions for updating delete trail locks and write locks.
- Enhanced LockingOps with methods to update delete trail locks and write locks.
- Expanded LockingConfig to include TimeLock fields for delete trail and write locks.
- Added TimeLock enum with various locking strategies and serialization methods.
- Updated permission types to include new locking permissions.
- Refactored tests to validate new locking configurations and permissions.
- Updated `Cargo.toml` to pin `iota_interaction`, `iota_interaction_rust`, `iota_interaction_ts`, and `product_common` to the `feat/tf-compoenents-dev` branch.
- Updated `Move.lock` to use the new chain ID and published IDs.
- Removed role-related event structs (`RoleCreated`, `RoleUpdated`, `RoleDeleted`) from `audit_trail.move` and replaced them with a single `RoleRemoved` struct.
- Refactored transaction handling in `transactions.rs` to accommodate the new `RoleRemoved` event.
- Updated event handling in `event.rs` to reflect the changes in role event structures.
- Adjusted tests across multiple files to ensure compatibility with the new role event structure and locking configurations.
- Updated package ID for `TF_COMPONENTS_PACKAGE_ID` in `package.rs`.
# Conflicts:
#	Cargo.toml
#	bindings/wasm/notarization_wasm/Cargo.toml
#	notarization-move/Move.history.json
#	notarization-move/Move.lock
@chrisgitiota chrisgitiota marked this pull request as ready for review March 9, 2026 09:02
@chrisgitiota chrisgitiota marked this pull request as draft March 9, 2026 09:03
…le-data (#207)

* Update audit-trail-move to be compilable and testable with generic role-data
* Temporarily deactivate Rust tests for Audit Trails
* Ignore AT Rust examples on CI checks
* Switch product-core TfComponents dependency to feat/tf-compoenents-dev branch
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