paritytech / paritytech/parity-common

[uint] Better constant support

Open
#585 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

F5-task Q2-easy
Dominant language
Rust
Stars
311
Forks
245
PR merge metrics
No merged PRs in 30d

Description

Most ways to construct values seem not to be usable in constants except for zero() and MAX. I wonder if it would be possible/desirable to have some way to construct these things in a const context, e.g. with from_big_endian()? Or by directly providing [u64; N_WORDS]?

Maybe then this could be made more convenient with macros, e.g. a macro that converts an integer literal to [u64; N_WORDS], usable in a const context.

Contributor guide

Open the contributing guide

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

The issue names no files or tests; start by locating the uint value constructors and the existing const-capable zero() and MAX implementations. Compare const-context options such as from_big_endian(), direct [u64; N_WORDS] construction, and an integer-literal macro. Done means a clearly agreed construction approach with const-context behavior and validation examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
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.