iotaledger / iotaledger/notarization

[SN]: Move function `notarization:is_destroy_allowed()` uses `timelock::is_timelocked_unlock`

Open
#301 0 comments 0 reactions 0 assignees View on GitHub
breaking
Dominant language
Rust
Stars
5
Forks
7
Avg merge
10h 34m
Merged PRs (30d)
11

Description

### Feature description

In the current Single Notarization Move package the function `notarization::is_destroy_allowed()` - being used by `notarization::destroy()` - only uses the function `timelock::is_timelocked_unlock_at()` for Dynamic Notarizations to check if the notarization object is locked.

**As the current version of Single Notarization uses an outdated `timelock` enum with a minimal set of enum variants this is OK for the current implementation.**

**When the `timelock` enum is extended during future development - i.e. using the `tf_components::timelock` enum - this is NOK.**

Before extended timelock enums like `tf_components::timelock` (i.e. providing the `TimeLock::Infinite` variant) can be used, the currently used function `timelock::is_timelocked_unlock_at()` in `notarization::is_destroy_allowed()` needs to be replaced by a function or functionality that checks for the existing timelock:
* if it is `TimeLock::UntilDestroyed` --> destroy is allowed
* if `timelock::is_timelocked()` returns false --> destroy is allowed

The intend of the function `notarization::is_destroy_allowed()` is primarily to check if a timelock is locked and that it's not locked by the UntilDestroyed variant.

### Motivation

Prepare function `notarization::is_destroy_allowed()` for future development and usage of the `tf_components::timelock` enum which i.e. provides the `TimeLock::Infinite` variant.

### Requirements

---

### Open questions

_No response_

### Are you planning to do it yourself in a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start at notarization::is_destroy_allowed(), which is used by notarization::destroy(), and inspect the current timelock::is_timelocked_unlock_at() check alongside timelock::is_timelocked(). Confirm how the existing timelock value represents TimeLock::UntilDestroyed. Done means destruction is allowed for UntilDestroyed or an unlocked timelock, while other locked values remain disallowed and future variants such as Infinite are handled safely.

Written by the indexing model from the issue text.

Assessment

Domain
blockchain
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.