Skip to content

Feat: New TfComponents package to export RoleMap, Capability and TimeLock from product_core#89

Merged
chrisgitiota merged 29 commits intomainfrom
feat/role-map
Feb 4, 2026
Merged

Feat: New TfComponents package to export RoleMap, Capability and TimeLock from product_core#89
chrisgitiota merged 29 commits intomainfrom
feat/role-map

Conversation

@chrisgitiota
Copy link
Copy Markdown
Contributor

@chrisgitiota chrisgitiota commented Jan 26, 2026

Description of change

This PR introduces the new Move package TfComponents in product-core. The package is contained in folder "components_move". There will probably also be Rust and TS bindings for these Move modules (see below).

As a first step to move the following modules from the Notarization repo to product-core, the modules have been copied into TfComponents and module paths and docs have been migrated accordingly:

  • audit_trail::role_map
  • audit_trail::capability
  • notarization::timelock

The Move type TimeLock offers new additionally variants UnlockAtMs and Infinite.

Rust and WASM bindings for TimeLock and new TimeLock variants

The Rust and WASM bindings for TimeLock are still located in the notarization repository. The plan is to move these bindings into new product-core packages:

  • A Rust package tf_components contained in folder components_rust
  • A Rust and TS package components_wasm contained in folder bindings/components_wasm

This will be implemented in a future PR.

How the change has been tested

  • Move tests in components_move can be run as usual: iota move test
  • The Audit Trail RoleMap & Capabilityintegration and the Notarization integration for TimeLock has been migrated to use TfComponents in the feat/audit-trails-dev-product-core-role-map branch. All former existing tests can be run successfully.

Comment thread components_move/sources/role_map.move
Comment thread components_move/README.md Outdated
Comment thread components_move/sources/capability.move Outdated
Comment thread components_move/sources/capability.move Outdated
Comment thread components_move/sources/capability.move Outdated
Co-authored-by: Eike Haß <eike-hass@web.de>
Comment thread components_move/sources/timelock.move
Comment thread components_move/sources/timelock.move
Comment thread components_move/sources/role_map.move Outdated
Comment thread components_move/README.md Outdated
Co-authored-by: Eike Haß <eike-hass@web.de>
Comment thread components_move/sources/capability.move Outdated
Comment thread components_move/sources/role_map.move
Comment thread components_move/sources/role_map.move Outdated
@itsyaasir
Copy link
Copy Markdown
Contributor

itsyaasir commented Jan 28, 2026

One Small thought: some doc comments repeat what the code already tells us:

/// `* ctx`: The transaction context
/// - `role_map`: Reference to the `RoleMap` mapping.

Similarly, in these comments

  /// - role_map: Reference to the `RoleMap` mapping.
  /// - cap: Reference to the capability to be validated.

The function signatures make this clear, and thanks to the field naming you chose, I feel it is self documenting and doesn't require the comments.

Comments are a maintenance liability — when code changes, comments must too, or they become misleading. Verbose comments that duplicate the code tend to drift out of sync over time.

What's valuable to keep:

  • Error conditions / abort scenarios
  • Non-obvious behavior (e.g., valid_from is inclusive, valid_until is
    exclusive)

Consider trimming:

  • Parameter descriptions that mirror the type signature
/// Creates a capability with no address or time restrictions.
///
/// Aborts with `ERoleDoesNotExist` if role is not in the RoleMap.
public fun new_capability(...)

Just a suggestion, I am happy to discuss!

Comment thread components_move/sources/role_map.move Outdated
Comment thread components_move/README.md Outdated
Comment thread components_move/README.md Outdated
Comment thread components_move/README.md Outdated
Comment thread components_move/README.md Outdated
Comment thread components_move/README.md
chrisgitiota and others added 19 commits January 30, 2026 14:13
Co-authored-by: Yasir <yasirshariffa@gmail.com>
Co-authored-by: Yasir <yasirshariffa@gmail.com>
…to feat/role-map

# Conflicts:
#	components_move/sources/capability.move
@chrisgitiota
Copy link
Copy Markdown
Contributor Author

chrisgitiota commented Feb 3, 2026

IMO we should discuss the "doc comments" outside of this PR. Already sent some thoughts on this @itsyaasir.

I couldn't resolve the comment BTW.

@chrisgitiota chrisgitiota merged commit 2cb1262 into main Feb 4, 2026
8 checks passed
chrisgitiota added a commit to iotaledger/notarization that referenced this pull request Feb 5, 2026
Audit Trail `RoleMap` & `Capability` integration and the Notarization integration for `TimeLock` has been migrated to use `TfComponents` as the following move modules have been moved from the Notarization repository to the new `TfComponents` package in `product_core` :

* audit_trail::role_map
* audit_trail::capability
* notarization::timelock

More details can be found in the product-core PR: iotaledger/product-core#89

The Rust and WASM bindings for `TimeLock` are still located in the `notarization` repository. These will be moved to `product-core` during future AT development.

Additionally, the Move type `TimeLock` which is now used from `product-core` package `TsComponents` offers new additionally variants `UnlockAtMs` and `Infinite`. The Rust and WASM bindings have been extended accordingly.
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.

4 participants