mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge #18512: Improve asmap checks and add sanity check
748977690eAdd asmap_direct fuzzer that tests Interpreter directly (Pieter Wuille)7cf97fda15Make asmap Interpreter errors fatal and fuzz test it (Pieter Wuille)c81aefc537Add additional effiency checks to sanity checker (Pieter Wuille)fffd8dca2dAdd asmap sanity checker (Pieter Wuille)5feefbe6e7Improve asmap Interpret checks and document failures (Pieter Wuille)2b3dbfa5a6Deal with decoding failures explicitly in asmap Interpret (Pieter Wuille)1479007a33Introduce Instruction enum in asmap (Pieter Wuille) Pull request description: This improves/documents the failure cases inside the asmap interpreter. None of the changes are bug fixes (they only change behavior for corrupted asmap files), but they may make things easier to follow. In a second step, a sanity checker is added that effectively executes every potential code path through the asmap file, checking the same failure cases as the interpreter, and more. It takes around 30 ms to run for me for a 1.2 MB asmap file. I've verified that this accepts asmap files constructed by https://github.com/sipa/asmap/blob/master/buildmap.py with a large dataset, and no longer accepts it with 1 bit changed in it. ACKs for top commit: practicalswift: ACK748977690emodulo feedback below. jonatack: ACK748977690ecode review, regular build/tests/ran bitcoin with -asmap, fuzz build/ran both fuzzers overnight. fjahr: ACK748977690eTree-SHA512: d876df3859735795c857c83e7155ba6851ce839bdfa10c18ce2698022cc493ce024b5578c1828e2a94bcdf2552c2f46c392a251ed086691b41959e62a6970821
This commit is contained in:
@@ -894,3 +894,8 @@ bool operator<(const CSubNet& a, const CSubNet& b)
|
||||
{
|
||||
return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16) < 0));
|
||||
}
|
||||
|
||||
bool SanityCheckASMap(const std::vector<bool>& asmap)
|
||||
{
|
||||
return SanityCheckASMap(asmap, 128); // For IP address lookups, the input is 128 bits
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user