Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unreachable to ord for amount #228

Merged
merged 5 commits into from
Jun 27, 2024

Conversation

cymqqqq
Copy link
Contributor

@cymqqqq cymqqqq commented Jun 26, 2024

Background:

Based on #227, there is also an unreachable in the rgb20 amount, so I think maybe we can change to the Ord in order to get rid of unreachable.

Description:

remove the unreachable in the rgb20 amount state change, then use the Ord. Similar to the rgb21 owed fraction state change.

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 17.6%. Comparing base (7f637c6) to head (708b207).
Report is 1 commits behind head on master.

Files Patch % Lines
src/interface/contract.rs 0.0% 8 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master    #228   +/-   ##
======================================
  Coverage    17.6%   17.6%           
======================================
  Files          37      37           
  Lines        7535    7535           
======================================
  Hits         1323    1323           
  Misses       6212    6212           
Flag Coverage Δ
rust 17.6% <0.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@cryptoquick cryptoquick left a comment

Choose a reason for hiding this comment

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

Very nice

AmountChange::Dec(neg) if *neg < add => AmountChange::Inc(add - *neg),
AmountChange::Dec(_) => unreachable!(),
AmountChange::Dec(neg) => match add.cmp(neg) {
Ordering::Greater => AmountChange::Dec(*neg - add),
Copy link
Member

Choose a reason for hiding this comment

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

This must be less, not greater, since we reverse the order neg and add are compared

Suggested change
Ordering::Greater => AmountChange::Dec(*neg - add),
Ordering::Less => AmountChange::Dec(*neg - add),

@dr-orlovsky dr-orlovsky added the enhancement New feature or request label Jun 27, 2024
@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone Jun 27, 2024
@dr-orlovsky dr-orlovsky merged commit fe27923 into RGB-WG:master Jun 27, 2024
19 of 20 checks passed
@dr-orlovsky
Copy link
Member

I already asked few times to use rebases instead of useless multiple merges of master branch all over the place. Unless there will be a normal commitment history - no master merges, one commit per logical change - I will be just sqash-merging your commits.

@cymqqqq cymqqqq deleted the unreachable-to-ord-rgb20-amount branch June 28, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants