runtimeverification / runtimeverification/mir-semantics

Add support for `from_utf8` and string handling

Open
#662 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-token
Dominant language
Python
Stars
52
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The from_utf8 function from Rust's stdlib is currently not included in our SMIR JSON because it is not polymorphic. This function is essential for UTF-8 string conversion and will be needed for proper string support in the system.

Current Situation
  • from_utf8 is a non-polymorphic stdlib function (source)
  • The function internally uses transmute (visible in the _unchecked version)
  • String support is currently not implemented in the system
  • Functions like amount_to_ui_amount and ui_amount_to_amount will require string support
Technical Details

The from_utf8 function performs UTF-8 validation and conversion from byte arrays to strings. Since it ultimately calls transmute for the unsafe conversion, special handling may be required when implementing this in SMIR.

Tasks
  • Analyze the special handling needed for transmute operations in from_utf8
  • Implement string type support in SMIR
  • Add from_utf8 function support
  • Update amount_to_ui_amount and ui_amount_to_amount to handle strings
  • Add appropriate test cases for string conversions
Priority

Low/Medium - Marked as non-urgent task, but will be required for full functionality

Related Components
  • SMIR JSON serialization
  • Standard library function support
  • String type handling
  • Functions: amount_to_ui_amount, ui_amount_to_amount
References
Labels

enhancement, stdlib-support, type-system, non-urgent

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing SMIR JSON serialization and standard library function support, then compare the Rust stdlib from_utf8 source with the handling of transmute. Review the related amount_to_ui_amount and ui_amount_to_amount functions. Done means string types, from_utf8 support, and string-conversion tests are implemented across the listed tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.