-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
894e46d
commit b626a7e
Showing
5 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
body: | ||
- | ||
attributes: | ||
value: | | ||
Please check the issues tab to avoid duplicates. | ||
If you are having difficulty installing test-generator, | ||
please head over to the "Discussions" page. | ||
Thanks for taking the time to fill out this bug report! | ||
type: markdown | ||
- | ||
attributes: | ||
label: "Describe the issue:" | ||
id: what-happened | ||
type: textarea | ||
validations: | ||
required: true | ||
- | ||
attributes: | ||
description: "It can be a github repo, etherscan link, or code snippet." | ||
label: "Code example to reproduce the issue:" | ||
placeholder: "`contract A {}`\n" | ||
id: reproduce | ||
type: textarea | ||
validations: | ||
required: true | ||
- | ||
attributes: | ||
description: | | ||
What version of test-generator are you running? | ||
Run `test-generator --version` | ||
label: "Version:" | ||
id: version | ||
type: textarea | ||
validations: | ||
required: true | ||
- | ||
attributes: | ||
description: | | ||
Please copy and paste any relevant log output. This | ||
will be automatically formatted into code, so no need for backticks. | ||
render: shell | ||
label: "Relevant log output:" | ||
id: logs | ||
type: textarea | ||
description: "File a bug report" | ||
labels: | ||
- bug-candidate | ||
name: "Bug Report" | ||
title: "[Bug-Candidate]: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: Feature request | ||
description: Suggest a feature | ||
labels: ["enhancement"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Please check the issues tab to avoid duplicates. | ||
Thanks for providing feedback on test-generator! | ||
- type: textarea | ||
attributes: | ||
label: Describe the desired feature | ||
description: Explain what the feature solves/ improves. | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @tuturu-tech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Contributing to Test-generator | ||
|
||
First, thanks for your interest in contributing to test-generator! We welcome and appreciate all contributions, including bug reports, feature suggestions, tutorials/blog posts, and code improvements. | ||
|
||
If you're unsure where to start, we recommend our [`good first issue`](https://github.com/crytic/test-generator/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [`help wanted`](https://github.com/crytic/test-generator/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) issue labels. | ||
|
||
## Bug reports and feature suggestions | ||
|
||
Bug reports and feature suggestions can be submitted to our issue tracker. For bug reports, attaching the contract and the call sequence that caused the bug will help us in debugging and resolving the issue quickly. If you find a security vulnerability, do not open an issue; email [email protected] instead. | ||
|
||
## Questions | ||
|
||
Questions can be submitted to the "Discussions" page, and you may also join our [chat room](https://empireslacking.herokuapp.com/) (in the #ethereum channel). | ||
|
||
## Code | ||
|
||
Test-generator uses the pull request contribution model. Please make an account on Github, fork this repo, and submit code contributions via pull request. For more documentation, look [here](https://guides.github.com/activities/forking/). | ||
|
||
Some pull request guidelines: | ||
|
||
- Work from the [`dev`](https://github.com/crytic/test-generator/tree/dev) branch. We performed extensive tests prior to merging anything to `master`, working from `dev` will allow us to merge your work faster. | ||
- Minimize irrelevant changes (formatting, whitespace, etc) to code that would otherwise not be touched by this patch. Save formatting or style corrections for a separate pull request that does not make any semantic changes. | ||
- When possible, large changes should be split up into smaller focused pull requests. | ||
- Fill out the pull request description with a summary of what your patch does, key changes that have been made, and any further points of discussion, if applicable. | ||
- Title your pull request with a brief description of what it's changing. "Fixes #123" is a good comment to add to the description, but makes for an unclear title on its own. | ||
|
||
## Directory Structure | ||
|
||
Below is a rough outline of test-generator's design: | ||
|
||
```text | ||
. | ||
├── fuzzers # Contains supported fuzzer classes that parse and generate the test files | ||
├── templates # String templates used for test generation | ||
├── utils # Utility functions | ||
├── main.py # Main entry point | ||
└── ... | ||
``` | ||
|
||
## Development Environment | ||
|
||
Test-generator currently runs requires at least Python3.8 so make sure you have a sufficiently up-to-date installation by running `python --version`. We recommend [pyenv](https://github.com/pyenv/pyenv) to manage python versions. | ||
|
||
To start working on modifications to test-generator locally, run: | ||
```bash | ||
git clone https://github.com/crytic/test-generator | ||
cd test-generator | ||
git checkout dev | ||
|
||
python3 -m venv env | ||
source env/bin/activate | ||
python -m pip install --upgrade pip | ||
python -m pip install -e . | ||
``` | ||
This will create a virtual environment, ./env/, in the root of the repo, activate it, and install dependencies. | ||
|
||
To run commands using your development version of test-generator, run: | ||
```bash | ||
source ./env/bin/activate | ||
``` | ||
|
||
### Setting up IDE-based debugging | ||
1. Configure your IDE to use `./env/bin/python` as the interpreter. | ||
2. Use test-generator as the entrypoint for the debugger. | ||
3. Pycharm specific: Set the environment working directory to `./env/bin/` | ||
|
||
To run the unit tests, you need to clone this repository and run `make test`. Run a specific test with `make test TESTS=$test_name`. The names of tests can be obtained with `pytest tests --collect-only`. | ||
|
||
### Linters | ||
|
||
Several linters and security checkers are run on the PRs. | ||
|
||
To run them locally in the root dir of the repository: | ||
|
||
- `make lint` | ||
|
||
> Note, this only validates but does not modify the code. | ||
To automatically reformat the code: | ||
|
||
- `make reformat` | ||
|
||
We use pylint `2.13.4`, black `22.3.0`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
SHELL := /bin/bash | ||
|
||
PY_MODULE := test-generator | ||
TEST_MODULE := tests | ||
|
||
# Optionally overriden by the user, if they're using a virtual environment manager. | ||
VENV ?= test-generator | ||
|
||
# On Windows, venv scripts/shims are under `Scripts` instead of `bin`. | ||
VENV_BIN := $(VENV)/bin | ||
ifeq ($(OS),Windows_NT) | ||
VENV_BIN := $(VENV)/Scripts | ||
endif | ||
|
||
# Optionally overridden by the user in the `release` target. | ||
BUMP_ARGS := | ||
|
||
# Optionally overridden by the user in the `test` target. | ||
TESTS := | ||
|
||
# If the user selects a specific test pattern to run, set `pytest` to fail fast | ||
# and only run tests that match the pattern. | ||
# Otherwise, run all tests and enable coverage assertions, since we expect | ||
# complete test coverage. | ||
ifneq ($(TESTS),) | ||
TEST_ARGS := -x -k $(TESTS) | ||
else | ||
TEST_ARGS := | ||
endif | ||
|
||
.PHONY: all | ||
all: | ||
@echo "Run my targets individually!" | ||
|
||
.PHONY: run | ||
run: $(VENV)/pyvenv.cfg | ||
@. $(VENV_BIN)/activate && test-generator $(ARGS) | ||
|
||
.PHONY: lint | ||
lint: $(VENV)/pyvenv.cfg | ||
. $(VENV_BIN)/activate && \ | ||
black --check . && \ | ||
pylint $(PY_MODULE) $(TEST_MODULE) | ||
# ruff $(ALL_PY_SRCS) && \ | ||
# mypy $(PY_MODULE) && | ||
|
||
.PHONY: reformat | ||
reformat: | ||
. $(VENV_BIN)/activate && \ | ||
black . | ||
|
||
.PHONY: test | ||
. pytest | ||
|
||
.PHONY: test tests | ||
test tests: $(VENV)/pyvenv.cfg | ||
. $(VENV_BIN)/activate && \ | ||
pytest $(T) $(TEST_ARGS) | ||
|
||
.PHONY: package | ||
package: $(VENV)/pyvenv.cfg | ||
. $(VENV_BIN)/activate && \ | ||
python3 -m build |