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

Check attach #225

Closed
wants to merge 4 commits into from
Closed

Check attach #225

wants to merge 4 commits into from

Conversation

cymqqqq
Copy link
Contributor

@cymqqqq cymqqqq commented Jun 22, 2024

Description: check attached ids from data containers are present in the consignment.

  1. iter bundle ids from index consignment
  2. index transition bundle by bundle id
  3. for each transition bundle, get all transitions
  4. for each transition, get all assignments, and then get the revealed attach state by as_attachment()
  5. finally, check attached id from the consignment is equal to attached id from the reveal attach state(also, from the operation transition attach state).

I'm not sure if the logic I implemented is correct.

Copy link

codecov bot commented Jun 22, 2024

Codecov Report

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

Project coverage is 16.8%. Comparing base (1c5b910) to head (86ff555).
Report is 2 commits behind head on master.

Current head 86ff555 differs from pull request most recent head 1c8ae7c

Please upload reports for the commit 1c8ae7c to get more accurate results.

Files Patch % Lines
src/containers/consignment.rs 0.0% 25 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #225     +/-   ##
========================================
- Coverage    17.0%   16.8%   -0.2%     
========================================
  Files          37      37             
  Lines        7379    7476     +97     
========================================
  Hits         1257    1257             
- Misses       6122    6219     +97     
Flag Coverage Δ
rust 16.8% <0.0%> (-0.2%) ⬇️

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

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

Few improvements

})
})
});

// TODO: check attach ids from data containers are present in operations
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this line now

src/containers/consignment.rs Outdated Show resolved Hide resolved
let state = item
.as_revealed_state()
.expect("get revealed attached state failed");
if !self.attachments.keys().any(|&id| id == state.id) {
Copy link
Member

@dr-orlovsky dr-orlovsky Jun 22, 2024

Choose a reason for hiding this comment

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

Suggested change
if !self.attachments.keys().any(|&id| id == state.id) {
if !self.attachments.contains_key(&state.id) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a question: it's not clear to me why self.contains, because self is for the consignment, and no contains method here.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry it should be self.attachments.contains_key

Jack Choi and others added 2 commits June 22, 2024 17:31
`assign.as_attachment()` return the vector(`&[AssignAttach<Seal>`), so I think there should not be a `and_then()` method after that.
Then `Attach::as_revealed_state`, there is no `as_reveal_state` in the rgbcore, but `Assign<State, Seal>::as_reveal_state`.

Co-authored-by: Dr. Maxim Orlovsky <[email protected]>
@cymqqqq
Copy link
Contributor Author

cymqqqq commented Jul 11, 2024

I will close this pr, because I have no good idea for check attach now.

@cymqqqq cymqqqq closed this Jul 11, 2024
@dr-orlovsky dr-orlovsky reopened this Sep 2, 2024
@dr-orlovsky dr-orlovsky closed this Sep 2, 2024
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.

2 participants