-
Notifications
You must be signed in to change notification settings - Fork 43
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
Use packable BTreeSet impls #1240
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflicts
Co-authored-by: Thoralf-M <[email protected]>
Conflicts |
Solve conflicts and I'll review/merge today |
@@ -337,83 +363,86 @@ impl UnlockConditions { | |||
|
|||
/// Creates a new [`UnlockConditions`] from a vec. | |||
pub fn from_vec(unlock_conditions: Vec<UnlockCondition>) -> Result<Self, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this wouldn't error anymore on duplicates ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah currently it won't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow bring it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
Self::TooManyUnlockConditions => write!(f, "too many unlock conditions"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we want max/current added?
@@ -359,7 +359,7 @@ impl DelegationOutput { | |||
|
|||
// Transition, just without full ValidationContext. | |||
pub(crate) fn transition_inner(current_state: &Self, next_state: &Self) -> Result<(), StateTransitionError> { | |||
if !(current_state.delegation_id.is_null() && !next_state.delegation_id().is_null()) { | |||
if !current_state.delegation_id.is_null() | next_state.delegation_id().is_null() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice bit stuff :D lets add a |
@@ -67,6 +71,17 @@ impl Ord for Feature { | |||
self.kind().cmp(&other.kind()) | |||
} | |||
} | |||
impl core::hash::Hash for Feature { | |||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { | |||
self.kind().hash(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we want the feature hash to just be the kind? that would make 2 different SenderFeatures have the same hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed that the Eq is also just kind. for our code it works, but what if someone gets outputs and compares it with their feature, youd just expect == to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We started speaking about it on Slack, we should definitely continue the discussion. I really dislike this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well im not sure about all these hash/eq only taking the kind into consideration for external people. may be confusing. idk if we actually care about that tho.
I'm going to close this, as the concerns are valid and additionally I believe there is a better way to do this. |
Description of change
This PR uses BTreeSets rather than boxed slices where possible when unique, ordered data is required.
Related Issues
Blocked by iotaledger/common-rs#70