ConsenSysDiligence / ConsenSysDiligence/scribble-generator

Issues generating annotations in dapptools fuzz test

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

I have a small dapp fuzz test I'm trying to test the scribble generator with but it doesn't work.

Here's what I'm doing:

`scribble-generate`

returns:
```console
Usage: scribble-generate

Options:
--help Show help [boolean]
--version Show version number [boolean]
-t, --targets targets to automatically annotate [array] [required]

Missing required argument: t
```

Then I run:

`scribble-generate -t src/Code.t.sol`

It returns:

```console
info: Generating Scribble annotations for fuzz tests
info: Instrumenting 1 solidity file(s) for target "/Users/jesserc/Desktop/Dev/dapp-test/src/Code.t.sol"
warn: TypeError: Cannot read properties of undefined (reading 'text'). Skipping target
```

This is my test file:

```solidity

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;

import "ds-test/test.sol";

import "./Code.sol";

contract CodeTest is DSTest {
Code code;

function setUp() public {
code = new Code{value: 1 ether}();
}

function test_fuzz(uint256 password_) public {
code.withdraw(password_);
assert(code.balance() == 1 ether);
}

receive() external payable {}
}

```

This is my contract:

```solidity
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

contract Code {
uint256 private password;

constructor() payable {
require(msg.value >= 1 ether);
password = 25;
}

function withdraw(uint256 password_) public {
if (password_ == password) {
(bool success, ) = msg.sender.call{value: address(this).balance}(
""
);
require(success, "failed to send");
}
}

function balance() public view returns (uint) {
return address(this).balance;
}
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.