aboutsummaryrefslogtreecommitdiff
path: root/src/cuckoocache.h
AgeCommit message (Collapse)Author
2023-01-31clang-tidy: Fix `modernize-use-default-member-init` in headersHennadii Stepanov
See https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-default-member-init.html
2023-01-03refactor: use braced init for integer constants instead of c style castsPasta
2022-08-03validationcaches: Use size_t for sizesCarl Dong
...also move the 0-clamping logic to ApplyArgsManOptions, where it belongs.
2022-08-03cuckoocache: Check for uint32 overflow in setup_bytesCarl Dong
This fixes an potential overflow which existed prior to this patchset. If CuckooCache::cache<Element, Hash>::setup_bytes is called with a `size_t bytes` which, when divided by sizeof(Element), does not fit into an uint32_t, the implicit conversion to uint32_t in the call to setup will result in an overflow. At least on x86_64, this overflow is possible: static_assert(std::numeric_limits<size_t>::max() / 32 <= std::numeric_limits<uint32_t>::max()); static_assert(std::numeric_limits<size_t>::max() / 4 <= std::numeric_limits<uint32_t>::max()); This commit detects such cases and signals to callers that the `size_t bytes` input is too large.
2022-08-03cuckoocache: Return approximate memory sizeCarl Dong
Returning the approximate total size eliminates the need for InitS*Cache() to do nElems*sizeof(uint256). The cuckoocache has a better idea of this information.
2022-01-07Add FastRange32 function and use it throughout the codebasePieter Wuille
2021-11-29refactor: Fix implicit-signed-integer-truncation in cuckoocache.hMarcoFalke
2021-01-04doc: Use https URLs where possibleSawyer Billings
2020-04-08tests: Add fuzzing harness for classes/functions in cuckoocache.hpracticalswift
2019-11-29Use correct C++11 header for std::swap()Hennadii Stepanov
2019-10-10doc: Doxygen-friendly CuckooCache commentsJon Layton
2018-08-27Make objects in range declarations immutable by default. Avoid unnecessary ↵practicalswift
copying of objects in range declarations.
2018-03-27Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer ↵practicalswift
conversion
2018-03-21Fix typosDimitris Apostolou
2017-08-26Fix header guards using reserved identifiersDan Raviv
Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.
2017-08-16Declare single-argument (non-converting) constructors "explicit"practicalswift
In order to avoid unintended implicit conversions.
2017-06-24Merge #10577: Add an explanation of quickly hashing onto a non-power of two ↵Wladimir J. van der Laan
range. dd869c6 Add an explanation of quickly hashing onto a non-power of two range. (Gregory Maxwell) Tree-SHA512: 8b362e396206a4ee2e825908dcff6fe4525c12b9c85a6e6ed809d75f03d42edcfba5e460a002e5d17cc70c103792f84d99693563b638057e4e97946dd1d800b2
2017-06-22Fixed multiple typosDimitris Tsapakidis
A few "a->an" and "an->a". "Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences. "without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command". Removed duplicate words such as "the the".
2017-06-12Add an explanation of quickly hashing onto a non-power of two range.Gregory Maxwell
In Olaoluwa Osuntokun's recent protocol proposal they were using a mod in an inner loop. I wanted to suggest a normative protocol change to use the trick we use here, but to find an explanation of it I had to dig up the PR on github. After I posted about it several other developers commented that it was very interesting and they were unaware of it. I think ideally the code should be self documenting and help educate other contributors about non-obvious techniques that we use. So I've written a description of the technique with citations for future reference.
2017-04-03Merge #9533: Allow non-power-of-2 signature cache sizesWladimir J. van der Laan
7482781 Allow non-power-of-2 signature cache sizes (Pieter Wuille) Tree-SHA512: 5731c22b46c5ae81cf6d52000c28e39b243a47d96d91079942a5b5a10db214449217f71aa2195e18f8a3917cb206b04c75dc13e4522eb700a1dbf1819013ba22
2017-01-27[trivial] Fix typos in commentspracticalswift
2017-01-12Allow non-power-of-2 signature cache sizesPieter Wuille
2016-12-14Add CuckooCache implementation and replace the sigcache map_type with itJeremy Rubin
SQUASHME: Change cuckoocache to only work for powers of two, to avoid mod operator SQUASHME: Update Documentation and simplify logarithm logic SQUASHME: OSX Build Errors SQUASHME: minor Feedback from sipa + bluematt SQUASHME: DOCONLY: Clarify a few comments.