Skip to content

Conversation

@entropycoset
Copy link

When trying to be a witness, and loading custom genesis where initial_timestamp is far behind, there seems to be an C++ UB
in dgp.recent_slots_filled = ... << missed_blocks
in https://github.com/bitshares/bitshares-core/blob/develop/libraries/chain/db_update.cpp#L68
because we left-shift by more than 126 (or 127, 128) bits there
https://timsong-cpp.github.io/cppwp/n4140/expr.shift#1 for C++14.

In this version, we set dgp.recent_slots_filled manually to the expected value 0 instead trying to use operator<< for this corner case.

We also print error log (and once print the longer explanation of problem).

@abitmore
Copy link
Member

abitmore commented Aug 4, 2025

The change is maybe worthwhile, but the code seems over complicated. Personally I don't want to add such logging messages in the current code base.

BTW recent_slots_filled is a 128-bit unsigned integer, See https://github.com/bitshares/bitshares-core/blob/develop/libraries/chain/include/graphene/chain/global_property_object.hpp#L96

@entropycoset
Copy link
Author

entropycoset commented Aug 4, 2025

Just silently convert it to 0, or should program show the short elog with 1 sentence?

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