5#ifndef BITCOIN_TEST_FUZZ_UTIL_DESCRIPTOR_H
6#define BITCOIN_TEST_FUZZ_UTIL_DESCRIPTOR_H
30 std::array<std::string, TOTAL_KEYS_GENERATED>
keys_str;
45 std::optional<uint8_t>
IdxFromHex(std::string_view hex_characters)
const;
48 std::optional<std::string>
GetDescriptor(std::string_view mocked_desc)
const;
Converts a mocked descriptor string to a valid one.
static constexpr uint8_t KEY_TYPES_COUNT
Types are raw (un)compressed pubkeys, raw xonly pubkeys, raw privkeys (WIF), xpubs,...
bool IdIsUnCompPubKey(uint8_t idx) const
bool IdIsXOnlyPubKey(uint8_t idx) const
void Init()
When initializing the target, populate the list of keys.
static constexpr size_t TOTAL_KEYS_GENERATED
How many keys we'll generate in total.
bool IdIsXpub(uint8_t idx) const
std::optional< std::string > GetDescriptor(std::string_view mocked_desc) const
Get an actual descriptor string from a descriptor string whose keys were mocked.
bool IdIsXprv(uint8_t idx) const
bool IdIsCompPubKey(uint8_t idx) const
std::array< std::string, TOTAL_KEYS_GENERATED > keys_str
256 keys of various types.
bool IdIsConstPrivKey(uint8_t idx) const
std::optional< uint8_t > IdxFromHex(std::string_view hex_characters) const
Parse an id in the keys vectors from a 2-characters hex string.
constexpr int MAX_SUBS
Default maximum number of sub-fragments.
bool HasTooManyWrappers(std::span< const uint8_t > buff, int max_wrappers=MAX_WRAPPERS)
Whether the buffer, if it represents a valid descriptor, contains a fragment with more wrappers than ...
constexpr int MAX_WRAPPERS
Default maximum number of wrappers per fragment.
constexpr size_t MAX_NESTED_SUBS
Maximum number of nested sub-fragments we'll allow in a descriptor.
constexpr int MAX_DEPTH
Default maximum number of derivation indexes in a single derivation path when limiting its depth.
bool HasTooLargeLeafSize(std::span< const uint8_t > buff, uint32_t max_leaf_size=MAX_LEAF_SIZE)
Whether the expanded buffer (after calling GetDescriptor() in MockedDescriptorConverter) has a leaf s...
bool HasDeepDerivPath(std::span< const uint8_t > buff, int max_depth=MAX_DEPTH)
Whether the buffer, if it represents a valid descriptor, contains a derivation path deeper than a giv...
bool HasTooManySubFrag(std::span< const uint8_t > buff, int max_subs=MAX_SUBS, size_t max_nested_subs=MAX_NESTED_SUBS)
Whether the buffer, if it represents a valid descriptor, contains a fragment with more sub-fragments ...
constexpr uint32_t MAX_LEAF_SIZE
Default maximum leaf size. This should be large enough to cover an extended key, including paths "/",...