<p>I want to write a fuzz test to increase the coverage of <code>net_processing.cpp</code> for this piece of code. But I am unable to navigate/trace from where this function is being called .
I have checked in <code>net_tests.cpp</code> and <code>transaction_tests.cpp</code> in whose piece of code RelayTransaction function was used but its not being used in tests .This would mean its being called inside tests internally . This picture is from the <code>total_coverage</code> generated from lcov .</p>
<p><a href="https://i.sstatic.net/tC3rhG2y.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tC3rhG2y.png" alt="enter image description here" /></a></p>
<p>How should i go about writing the test ?</p>

CC BY-SA 4.0
2024-07-04T13:18:49.577Z
It seems you are asking for an explanation of the code? And actually of a good chunk of the relay logic.
Antoine Poinsot
CC BY-SA 4.0
2024-07-04T14:09:11.170Z
@AntoinePoinsot My wording might not have been clear for this question . I want to ask about how should one go about navigating to specific lines when fuzzing . Ideally some fuzzers or compilers would give the trace of the execution when calling functions so it is easy to navigate what was called and so. However I dont know if such thing is possible while writing tests for bitcoin-core. I wanted to ask how developers would write tests when in these scenarios ?
Prabhat Verma
CC BY-SA 4.0
2024-07-04T14:11:48.923Z
This chunk of code comes from one of the PR I am reviewing and I wanted to code test for this to increase coverage . I just cant figure out where this function is being hit .
Prabhat Verma
CC BY-SA 4.0
2024-07-04T15:30:08.663Z
I’m voting to close this question because i don't think it's appropriate for this site to explain the Bitcoin Core codebase (outside of maybe very specific snippets but it's clearly not the case here).
Antoine Poinsot
CC BY-SA 4.0
2024-07-05T13:32:59.810Z
@AntoinePoinsot: It seems to me that asking about Bitcoin Core’s behavior would be on-topic. However, the confusion here might be stemming from the section of code being inactive in that PR and therefore not triggering because it’s part of an unfinished feature.
Murch
CC BY-SA 4.0
2024-07-05T13:41:17.330Z
I agree. What i meant is that we can't explain how the C++ codebase work, unless it's very specific snippets of code.
Antoine Poinsot
<bitcoin-core><bitcoin-core-development><bitcoincore-review><fuzz-test>
How can I effectively trace code paths for fuzz testing in a Bitcoin core?
Prabhat Verma
# How can I effectively trace code paths for fuzz testing in a Bitcoin core?

(Asked by: username_0 on 2024-07-04)

I want to write a fuzz test to increase the coverage of `net_processing.cpp` for this piece of code. But I am unable to navigate/trace from where this function is being called .
I have checked in `net_tests.cpp` and `transaction_tests.cpp` in whose piece of code RelayTransaction function was used but its not being used in tests .This would mean its being called inside tests internally . This picture is from the `total_coverage` generated from lcov .

[![enter image description here](https://i.sstatic.net/tC3rhG2y.png)](https://i.sstatic.net/tC3rhG2y.png)

How should i go about writing the test ?

**Tags:** bitcoin-core, bitcoin-core-development, bitcoincore-review, fuzz-test

> **Comments:**
> **username_1**: It seems you are asking for an explanation of the code? And actually of a good chunk of the relay logic.  
> **username_0**: @AntoinePoinsot My wording might not have been clear for this question . I want to ask about how should one go about navigating to specific lines when fuzzing . Ideally some fuzzers or compilers would give the trace of the execution when calling functions so it is easy to navigate what was called and so. However I dont know if such thing is possible while writing tests for bitcoin-core. I wanted to ask how developers would write tests when in these scenarios ?  
> **username_0**: This chunk of code comes from one of the PR I am reviewing and I wanted to code test for this to increase coverage . I just cant figure out where this function is being hit .  
> **username_1**: I’m voting to close this question because i don't think it's appropriate for this site to explain the Bitcoin Core codebase (outside of maybe very specific snippets but it's clearly not the case here).  
> **username_2**: @AntoinePoinsot: It seems to me that asking about Bitcoin Core’s behavior would be on-topic. However, the confusion here might be stemming from the section of code being inactive in that PR and therefore not triggering because it’s part of an unfinished feature.  
> **username_1**: I agree. What i meant is that we can't explain how the C++ codebase work, unless it's very specific snippets of code.  

---

## 0 answers

