Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Feb 2, 2022

A negative chain height is only used to denote an empty chain, not the height of any block.

So stop testing that and remove a suppression.

@laanwj laanwj added the Tests label Feb 2, 2022
Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

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

crACK fad8154

@@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
tx.vout.resize(1);
tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate
tx.vout[0].scriptPubKey.assign(InsecureRand32() & 0x3F, 0); // Random sizes so we can test memory usage accounting
unsigned int height = InsecureRand32();
const int height{int(InsecureRand32() >> 1)};
Copy link
Contributor

Choose a reason for hiding this comment

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

use we just use GetRandInt from random.h?

Copy link
Member Author

Choose a reason for hiding this comment

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

Might be better to do this in a separate pull request unrelated from the changes here?

Copy link
Contributor

Choose a reason for hiding this comment

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

meh, what's the point of a new PR just for that? Probably no-one would review it 😂 imo, it makes much more sense here

Copy link
Member Author

Choose a reason for hiding this comment

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

GetRandInt is either non-deterministic, or returns a constant (deterministic). Can you explain why either change makes sense? I'd say neither does and it should be left-as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, okay, that's a good reason :) Maybe in the future we should adjust InsecureRand32 to make it clearer that it can be deterministic

@maflcko maflcko merged commit fa65f26 into bitcoin:master Feb 7, 2022
@maflcko maflcko deleted the 2202-intHeight branch February 7, 2022 13:07
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 7, 2022
fad8154 test: Avoid testing negative block heights (MarcoFalke)

Pull request description:

  A negative chain height is only used to denote an empty chain, not the height of any block.

  So stop testing that and remove a suppression.

ACKs for top commit:
  brunoerg:
    crACK fad8154

Tree-SHA512: 0f9e91617dfb6ceda99831e6cf4b4bf0d951054957c159b1a05a178ab6090798fae7368edefe12800da24585bcdf7299ec3534f4d3bbf5ce6a6eca74dd3bb766
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 9, 2022
Summary:
This is a backport of [[bitcoin/bitcoin#24237 | core#24237]]

Depends on D12819

Test Plan:
With UBSAN
`ninja && ninja check check-functional bitcoin-fuzzers`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12820
@bitcoin bitcoin locked and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants