Skip to content

Conversation

notJoon
Copy link
Member

@notJoon notJoon commented Aug 28, 2025

Description

This PR introduces a dedicated Tier type and refactors related code to improve type safety and reduce unnecessary casting.

Background

Previously, tier values were represented as raw uint64. This causes several issues:

  • Frequent casting between uint64 and int64 when performing reward calculations (emssions and ratios are int64).
  • Higher risk of accidental misuse, as any uint64 value could be passed in as a tier without validation.
  • Reduced clarity when reading code that mixed tier as a nunber with tier as a sementic concept.

Changes

  • Added a new Tier type (uint8)
  • Changed CurrentCount to return int64 instead of int to align with reward calculation paths.
  • Refactored method signatures (CurrentReward, CurrentCount, etc.) and internal logic to accept/use Tier instead of raw integers where appropriate

@notJoon notJoon changed the title fix(staker): Reduce tier type size fix(staker): Introduce Tier type and simplify casting in reward logic Aug 28, 2025
@notJoon notJoon marked this pull request as ready for review August 28, 2025 03:53
Copy link

sonarqubecloud bot commented Sep 1, 2025

Copy link
Member

@dongwon8247 dongwon8247 left a comment

Choose a reason for hiding this comment

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

Approving. Please wait for @jinoosss's review before merging

@jinoosss
Copy link
Member

Please verify the shape transformation function.

Signed-off-by: Lee ByeongJun <lbj199874@gmail.com>
Signed-off-by: Lee ByeongJun <lbj199874@gmail.com>
Copy link

sonarqubecloud bot commented Oct 2, 2025

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