Skip to content

Conversation

@allanbrondum
Copy link
Contributor

@allanbrondum allanbrondum commented Dec 22, 2025

Purpose

General cleanup of traits and types to prepare for more functionality (queries, transfers, mint, ...)

Changes

  • make TokenRawAmount a newtype for better type check
  • generally renamed "host" to "kernel", since that is more descriptive of what we actually build (where the host interface will be, if ever introduced, is not decided)
  • HostOperations split up in TokenKernelQueries and TokenKernelOperations. The former to be used when running queries, which are read-only and don't have a transaction context (like tick energy and log token event)
  • Make TokenInitializationError error variants more strongly types (MintAmountDecimalsMismatch and MintAmountNotRepresentable variants) for better type checking of error handling

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.68%. Comparing base (660fe2b) to head (a418c8f).
⚠️ Report is 2 commits behind head on feature/plt-scheduler-port.

Additional details and impacted files
@@                      Coverage Diff                       @@
##           feature/plt-scheduler-port    #1483      +/-   ##
==============================================================
- Coverage                       26.03%   25.68%   -0.35%     
==============================================================
  Files                              34       34              
  Lines                            9830     9830              
==============================================================
- Hits                             2559     2525      -34     
- Misses                           7271     7305      +34     

see 3 files with indirect coverage changes

/// let account_address1 = [1u8; 32];
/// let host = HostStub::with_accounts([(0, account_address0, None), (1, account_address1, Some(42))]);
/// let mut stub = KernelStub::new(0);
/// let account = stub.create_account();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified the interface to stub accounts a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewrote tests to use updated stub (small changes) and added an additional test: test_initialize_token_non_existing_governance_account

@allanbrondum allanbrondum force-pushed the ar/psr-22-implement-token-module-queries branch from 0a70f2f to a418c8f Compare December 23, 2025 12:28
Copy link
Contributor

@soerenbf soerenbf left a comment

Choose a reason for hiding this comment

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

looks good

@allanbrondum allanbrondum merged commit e04a66a into feature/plt-scheduler-port Dec 23, 2025
5 checks passed
@allanbrondum allanbrondum deleted the ar/psr-22-implement-token-module-queries branch December 23, 2025 13:51
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.

3 participants