Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Dec 22, 2019

In CTxMemPoolEntry class the type of four data members has been changed from uint64_t to int64_t. The type of getters, uint64_t, remains unchanged.

In CTxMemPool::UpdateAncestorsOf() the only expression was needed to be reworked (the result looks a bit ugly, I'm still open for suggestions).

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK.

@practicalswift
Copy link
Contributor

Concept ACK

@hebasto hebasto force-pushed the 20191222-mempool-ub branch from ed1a916 to 7aee08c Compare December 22, 2019 22:29
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 22, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@practicalswift
Copy link
Contributor

practicalswift commented Dec 22, 2019

Nit regarding the commit message "Fix UB in CTxMemPool*":

Unsigned integer wraparound and implicit integer sign change are not UB, but they are often unintentional - that is why UBSan is flagging them :)

Perhaps the PR title ("Remove UBSan suppressions for CTxMemPool*") could be used as commit message instead?

-fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the the original value was negative and the new value is positive (or zero), or the original value was positive, and the new value is negative. Issues caught by this sanitizer are not undefined behavior, but are often unintentional.

-fsanitize=unsigned-integer-overflow: Unsigned integer overflow, where the result of an unsigned integer computation cannot be represented in its type. Unlike signed integer overflow, this is not undefined behavior, but it is often unintentional.

@hebasto hebasto force-pushed the 20191222-mempool-ub branch from 7aee08c to 52a45c3 Compare December 22, 2019 23:24
@hebasto
Copy link
Member Author

hebasto commented Dec 22, 2019

@practicalswift

Nit regarding the commit message "Fix UB in CTxMemPool*"...

Agree with every word ;)
Fixed.

@practicalswift
Copy link
Contributor

ACK 52a45c3 -- diff looks correct

@@ -217,10 +217,11 @@ void CTxMemPool::UpdateAncestorsOf(bool add, txiter it, setEntries &setAncestors
UpdateChild(piter, it, add);
}
const int64_t updateCount = (add ? 1 : -1);
const int64_t updateSize = updateCount * it->GetTxSize();
const int64_t updateSize = it->GetTxSize();
assert(updateSize >= 0);
Copy link
Contributor

@Empact Empact Feb 20, 2020

Choose a reason for hiding this comment

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

nit: this is now the size of the tx, not the update

Maybe assert against the it->GetTxSize directly? Would mean just adding one line here. If you're concerned about the repeated calls, something like this: Empact@0018dd1 would make them trivial.

@Empact
Copy link
Contributor

Empact commented Feb 20, 2020

Concept ACK

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@hebasto hebasto closed this Aug 24, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants