Skip to content

Commit

Permalink
crashed.png
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-valerio committed Oct 16, 2024
1 parent 97cb74e commit b28e2cd
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 94 deletions.
Binary file added assets/crashed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 11 additions & 23 deletions book/documentation/CAMPAIGN.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,36 +224,24 @@ <h3 id="1-instrument-the-contract"><a class="header" href="#1-instrument-the-con
<p>This step modifies the contract to include necessary hooks for Phink’s fuzzing process. It creates a fork of the
contract, so you don’t have to make a copy before.</p>
<h3 id="2-run-the-fuzzer"><a class="header" href="#2-run-the-fuzzer">2. Run the fuzzer</a></h3>
<p>After instrumenting your contract and writing properties, execute the fuzzing process:</p>
<p>After <strong>instrumenting</strong> your contract and <strong>writing</strong> properties and <strong>configuring</strong> your <code>phink.toml</code>, execute the
fuzzing process:</p>
<pre><code class="language-sh">phink fuzz
</code></pre>
<p>This command runs your fuzzing tests based on the configuration set in your <code>phink.toml</code> file. A user interface should
appear.</p>
<h2 id="analyzing-results"><a class="header" href="#analyzing-results">Analyzing Results</a></h2>
<h3 id="coverage-reports"><a class="header" href="#coverage-reports">Coverage Reports</a></h3>
<h3 id="crashes"><a class="header" href="#crashes">Crashes</a></h3>
<p>In case of crashes, you should see something like</p>
<h3 id="coverage"><a class="header" href="#coverage">Coverage</a></h3>
<p><strong>IMPORTANT: this feature is in alpha.</strong></p>
<h4 id="generating-a-coverage-report"><a class="header" href="#generating-a-coverage-report">Generating a coverage report</a></h4>
<p>Generate coverage reports to analyze which parts of the contract were tested:</p>
<pre><code class="language-sh">phink coverage
<pre><code class="language-sh">phink coverage my_contract/
</code></pre>
<h3 id="log-analysis"><a class="header" href="#log-analysis">Log Analysis</a></h3>
<p>Check detailed logs if <code>verbose</code> is enabled in your configuration. Logs provide insights into fuzzing processes and
detected issues.</p>
<h2 id="interpreting-coverage-reports"><a class="header" href="#interpreting-coverage-reports">Interpreting Coverage Reports</a></h2>
<p>The coverage report provides a visual representation of tested code areas. Ensure that all critical paths of your
contract are covered.</p>
<h2 id="debugging-fuzzing-results"><a class="header" href="#debugging-fuzzing-results">Debugging Fuzzing Results</a></h2>
<h3 id="harness-coverage"><a class="header" href="#harness-coverage">Harness Coverage</a></h3>
<p>Use the harness coverage feature for debugging:</p>
<pre><code class="language-sh">phink harness-cover
</code></pre>
<p>This isolates test harness issues from contract logic problems.</p>
<h2 id="writing-effective-properties"><a class="header" href="#writing-effective-properties">Writing Effective Properties</a></h2>
<h3 id="key-tips"><a class="header" href="#key-tips">Key Tips:</a></h3>
<ul>
<li>Ensure properties are clear and address potential vulnerabilities.</li>
<li>Regularly update properties based on contract changes.</li>
</ul>
<p>By following these guidelines, you can effectively leverage Phink to ensure the reliability and security of your ink!
smart contracts.</p>
<p>Some HTML files should then be generated in the path you’ve configured inside your <code>phink.toml</code>.</p>
<h4 id="interpreting-coverage-reports"><a class="header" href="#interpreting-coverage-reports">Interpreting Coverage Reports</a></h4>
<p>The coverage report provides a visual representation of tested code areas. Basically, the more green lines, the better.</p>

</main>

Expand Down
7 changes: 2 additions & 5 deletions book/documentation/START.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ <h5 id="building-from-source"><a class="header" href="#building-from-source">Bui
<ol>
<li>
<p><strong>Clone the Repository</strong></p>
<pre><code class="language-bash">git clone https://github.com/srlabs/phink
cd phink/
<pre><code class="language-bash">git clone https://github.com/srlabs/phink &amp;&amp; cd phink/
</code></pre>
<p>You can also use:</p>
<pre><code class="language-bash">cargo +nightly install --git https://github.com/srlabs/phink
Expand All @@ -221,9 +220,7 @@ <h5 id="building-from-source"><a class="header" href="#building-from-source">Bui
<li>
<p><strong>Run Phink</strong></p>
<pre><code class="language-bash">./target/release/phink --help
</code></pre>
<p>Or if installed via <code>cargo install</code>:</p>
<pre><code class="language-bash">phink --help
phink --help # if installed via `cargo install`
</code></pre>
</li>
</ol>
Expand Down
5 changes: 5 additions & 0 deletions book/documentation/TROUBLESHOTING.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ <h1 class="menu-title">Phink Book</h1>
<p>Common Issues and Solutions
Performance Tuning
Community Support Channels</p>
<h3 id="debugging-phink"><a class="header" href="#debugging-phink">Debugging Phink</a></h3>
<p>Use the harness coverage feature for debugging. You should only use this if you want to have a coverage of Phink itself,
for instance if you are planning to contribute to Phink, or to debug it.</p>
<pre><code class="language-sh">phink harness-cover
</code></pre>

</main>

Expand Down
48 changes: 19 additions & 29 deletions book/documentation/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ <h5 id="building-from-source"><a class="header" href="#building-from-source">Bui
<ol>
<li>
<p><strong>Clone the Repository</strong></p>
<pre><code class="language-bash">git clone https://github.com/srlabs/phink
cd phink/
<pre><code class="language-bash">git clone https://github.com/srlabs/phink &amp;&amp; cd phink/
</code></pre>
<p>You can also use:</p>
<pre><code class="language-bash">cargo +nightly install --git https://github.com/srlabs/phink
Expand All @@ -247,9 +246,7 @@ <h5 id="building-from-source"><a class="header" href="#building-from-source">Bui
<li>
<p><strong>Run Phink</strong></p>
<pre><code class="language-bash">./target/release/phink --help
</code></pre>
<p>Or if installed via <code>cargo install</code>:</p>
<pre><code class="language-bash">phink --help
phink --help # if installed via `cargo install`
</code></pre>
</li>
</ol>
Expand Down Expand Up @@ -408,36 +405,24 @@ <h3 id="1-instrument-the-contract"><a class="header" href="#1-instrument-the-con
<p>This step modifies the contract to include necessary hooks for Phink’s fuzzing process. It creates a fork of the
contract, so you don’t have to make a copy before.</p>
<h3 id="2-run-the-fuzzer"><a class="header" href="#2-run-the-fuzzer">2. Run the fuzzer</a></h3>
<p>After instrumenting your contract and writing properties, execute the fuzzing process:</p>
<p>After <strong>instrumenting</strong> your contract and <strong>writing</strong> properties and <strong>configuring</strong> your <code>phink.toml</code>, execute the
fuzzing process:</p>
<pre><code class="language-sh">phink fuzz
</code></pre>
<p>This command runs your fuzzing tests based on the configuration set in your <code>phink.toml</code> file. A user interface should
appear.</p>
<h2 id="analyzing-results"><a class="header" href="#analyzing-results">Analyzing Results</a></h2>
<h3 id="coverage-reports"><a class="header" href="#coverage-reports">Coverage Reports</a></h3>
<h3 id="crashes"><a class="header" href="#crashes">Crashes</a></h3>
<p>In case of crashes, you should see something like</p>
<h3 id="coverage"><a class="header" href="#coverage">Coverage</a></h3>
<p><strong>IMPORTANT: this feature is in alpha.</strong></p>
<h4 id="generating-a-coverage-report"><a class="header" href="#generating-a-coverage-report">Generating a coverage report</a></h4>
<p>Generate coverage reports to analyze which parts of the contract were tested:</p>
<pre><code class="language-sh">phink coverage
<pre><code class="language-sh">phink coverage my_contract/
</code></pre>
<h3 id="log-analysis"><a class="header" href="#log-analysis">Log Analysis</a></h3>
<p>Check detailed logs if <code>verbose</code> is enabled in your configuration. Logs provide insights into fuzzing processes and
detected issues.</p>
<h2 id="interpreting-coverage-reports"><a class="header" href="#interpreting-coverage-reports">Interpreting Coverage Reports</a></h2>
<p>The coverage report provides a visual representation of tested code areas. Ensure that all critical paths of your
contract are covered.</p>
<h2 id="debugging-fuzzing-results"><a class="header" href="#debugging-fuzzing-results">Debugging Fuzzing Results</a></h2>
<h3 id="harness-coverage"><a class="header" href="#harness-coverage">Harness Coverage</a></h3>
<p>Use the harness coverage feature for debugging:</p>
<pre><code class="language-sh">phink harness-cover
</code></pre>
<p>This isolates test harness issues from contract logic problems.</p>
<h2 id="writing-effective-properties"><a class="header" href="#writing-effective-properties">Writing Effective Properties</a></h2>
<h3 id="key-tips"><a class="header" href="#key-tips">Key Tips:</a></h3>
<ul>
<li>Ensure properties are clear and address potential vulnerabilities.</li>
<li>Regularly update properties based on contract changes.</li>
</ul>
<p>By following these guidelines, you can effectively leverage Phink to ensure the reliability and security of your ink!
smart contracts.</p>
<p>Some HTML files should then be generated in the path you’ve configured inside your <code>phink.toml</code>.</p>
<h4 id="interpreting-coverage-reports"><a class="header" href="#interpreting-coverage-reports">Interpreting Coverage Reports</a></h4>
<p>The coverage report provides a visual representation of tested code areas. Basically, the more green lines, the better.</p>
<div style="break-before: page; page-break-before: always;"></div><p>Maximizing Coverage
Ensuring Robustness and Security
Simple ink! Contract Example
Expand Down Expand Up @@ -481,7 +466,7 @@ <h3 id="instrumentation"><a class="header" href="#instrumentation">Instrumentati
instrumentation is used to trace execution paths, enabling coverage-guided techniques to generate more informed and
effective test cases.</p>
<hr />
<h3 id="coverage"><a class="header" href="#coverage">Coverage</a></h3>
<h3 id="coverage-1"><a class="header" href="#coverage-1">Coverage</a></h3>
<p><strong>Coverage</strong> is a measure of how much of a program’s code is tested during fuzzing. High coverage corresponds to a
good assessment of the contracts logic.</p>
<hr />
Expand All @@ -493,6 +478,11 @@ <h3 id="contract-selectors"><a class="header" href="#contract-selectors">Contrac
<div style="break-before: page; page-break-before: always;"></div><p>Common Issues and Solutions
Performance Tuning
Community Support Channels</p>
<h3 id="debugging-phink"><a class="header" href="#debugging-phink">Debugging Phink</a></h3>
<p>Use the harness coverage feature for debugging. You should only use this if you want to have a coverage of Phink itself,
for instance if you are planning to contribute to Phink, or to debug it.</p>
<pre><code class="language-sh">phink harness-cover
</code></pre>

</main>

Expand Down
2 changes: 1 addition & 1 deletion book/documentation/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion book/documentation/searchindex.json

Large diffs are not rendered by default.

41 changes: 12 additions & 29 deletions book/src/CAMPAIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ contract, so you don't have to make a copy before.

### 2. Run the fuzzer

After instrumenting your contract and writing properties, execute the fuzzing process:
After **instrumenting** your contract and **writing** properties and **configuring** your `phink.toml`, execute the
fuzzing process:

```sh
phink fuzz
Expand All @@ -69,42 +70,24 @@ appear.

## Analyzing Results

### Coverage Reports
### Crashes

Generate coverage reports to analyze which parts of the contract were tested:

```sh
phink coverage
```

### Log Analysis
In case of crashes, you should see something like

Check detailed logs if `verbose` is enabled in your configuration. Logs provide insights into fuzzing processes and
detected issues.
### Coverage

## Interpreting Coverage Reports
**IMPORTANT: this feature is in alpha.**

The coverage report provides a visual representation of tested code areas. Ensure that all critical paths of your
contract are covered.
#### Generating a coverage report

## Debugging Fuzzing Results

### Harness Coverage

Use the harness coverage feature for debugging:
Generate coverage reports to analyze which parts of the contract were tested:

```sh
phink harness-cover
phink coverage my_contract/
```

This isolates test harness issues from contract logic problems.

## Writing Effective Properties

### Key Tips:
Some HTML files should then be generated in the path you've configured inside your `phink.toml`.

- Ensure properties are clear and address potential vulnerabilities.
- Regularly update properties based on contract changes.
#### Interpreting Coverage Reports

By following these guidelines, you can effectively leverage Phink to ensure the reliability and security of your ink!
smart contracts.
The coverage report provides a visual representation of tested code areas. Basically, the more green lines, the better.
9 changes: 3 additions & 6 deletions book/src/START.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ You can install Phink by building it from the source or by using Docker. Choose

1. **Clone the Repository**
```bash
git clone https://github.com/srlabs/phink
cd phink/
git clone https://github.com/srlabs/phink && cd phink/
```

You can also use:
```bash
cargo +nightly install --git https://github.com/srlabs/phink
Expand All @@ -46,10 +46,7 @@ You can install Phink by building it from the source or by using Docker. Choose
5. **Run Phink**
```bash
./target/release/phink --help
```
Or if installed via `cargo install`:
```bash
phink --help
phink --help # if installed via `cargo install`
```

##### Using Docker
Expand Down
9 changes: 9 additions & 0 deletions book/src/TROUBLESHOTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Common Issues and Solutions
Performance Tuning
Community Support Channels

### Debugging Phink

Use the harness coverage feature for debugging. You should only use this if you want to have a coverage of Phink itself,
for instance if you are planning to contribute to Phink, or to debug it.

```sh
phink harness-cover
```

0 comments on commit b28e2cd

Please sign in to comment.