Metadata-Version: 2.1
Name: eth-wake
Version: 4.0.0
Summary: Wake is a Python-based Solidity development and testing framework with built-in vulnerability detectors.
Home-page: https://getwake.io
License: ISC
Keywords: ethereum,solidity,security,testing,development,static analysis,framework,audit
Author: Ackee Blockchain
Requires-Python: >=3.7.9,<4.0.0
Classifier: License :: OSI Approved
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: dev
Provides-Extra: tests
Requires-Dist: GitPython (>=3.1.20,<4.0.0) ; extra == "tests"
Requires-Dist: abch_tree_sitter (>=1.1.1,<2.0.0)
Requires-Dist: abch_tree_sitter_solidity (>=1.2.0,<2.0.0)
Requires-Dist: aiofiles (>=0.8,<0.9)
Requires-Dist: aiohttp (>=3.8,<4.0) ; python_version < "3.12"
Requires-Dist: aiohttp (>=3.9.0b1) ; python_version >= "3.12"
Requires-Dist: black (>=22,<23) ; extra == "dev"
Requires-Dist: cairosvg (>=2.7,<3.0) ; extra == "dev"
Requires-Dist: click (>=8,<9)
Requires-Dist: eth-abi (>=4.0.0b2,<5.0.0)
Requires-Dist: eth-account (>=0.8,<0.9)
Requires-Dist: eth-hash[pycryptodome] (>=0.5.1,<0.6.0)
Requires-Dist: eth-utils (>=2.1,<3.0)
Requires-Dist: graphviz (>=0.19,<0.20)
Requires-Dist: importlib-metadata (==4.8) ; python_version < "3.10"
Requires-Dist: intervaltree (>=3.1,<4.0)
Requires-Dist: ipdb (>=0.13.9,<0.14.0)
Requires-Dist: isort (>=5,<6) ; extra == "dev"
Requires-Dist: jschema-to-python (>=1.2.3,<2.0.0)
Requires-Dist: lazy-import (>=0.2.2,<0.3.0)
Requires-Dist: mike (>=2.0.0,<3.0.0) ; extra == "dev"
Requires-Dist: mkdocs-material (>=9,<10) ; extra == "dev"
Requires-Dist: mkdocstrings (>=0.20,<0.21) ; extra == "dev"
Requires-Dist: mkdocstrings-python (>=1,<2) ; extra == "dev"
Requires-Dist: networkx (>=2.5,<3.0)
Requires-Dist: packaging (>=22.0)
Requires-Dist: parsimonious (>=0.9,<0.10)
Requires-Dist: pathvalidate (>=2.5,<3.0)
Requires-Dist: pillow (>=10.1,<11.0) ; (python_version >= "3.12") and (extra == "dev")
Requires-Dist: pillow (>=9,<10) ; (python_version < "3.12") and (extra == "dev")
Requires-Dist: pydantic (>=1.9.1,<2.0.0)
Requires-Dist: pygments (>=2,<3) ; extra == "dev"
Requires-Dist: pymdown-extensions (>=9,<10) ; extra == "dev"
Requires-Dist: pytest (>=7,<8)
Requires-Dist: pytest-asyncio (>=0.17,<0.18) ; extra == "tests"
Requires-Dist: pywin32 (>=302) ; sys_platform == "win32"
Requires-Dist: rich (>=13.3.2,<14.0.0)
Requires-Dist: rich-click (>=1.6,<2.0)
Requires-Dist: sarif-om (>=1.0.4,<2.0.0)
Requires-Dist: tblib (>=1.7,<2.0)
Requires-Dist: tomli (>=2,<3)
Requires-Dist: tomli-w (>=1.0.0,<2.0.0)
Requires-Dist: typing-extensions (>=4,<5)
Requires-Dist: watchdog (>=2.2.0,<2.3.0)
Requires-Dist: websocket-client (>=1.4,<2.0)
Project-URL: Documentation, https://ackeeblockchain.com/wake/docs/latest
Project-URL: Repository, https://github.com/Ackee-Blockchain/wake
Project-URL: VS Code Extension, https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity
Description-Content-Type: text/markdown

# Wake

Wake is a Python-based Solidity development and testing framework with built-in vulnerability detectors.

Features:

- testing framework based on [pytest](https://docs.pytest.org/en)
- property-based fuzzer
- deployments & mainnet interactions
- vulnerability and code quality detectors
- printers for extracting useful information from Solidity code
- static analysis framework for implementing custom detectors and printers
- [Github action](https://github.com/marketplace/actions/wake-detect) with CodeQL code scanning support
- language server ([LSP](https://microsoft.github.io/language-server-protocol/))
- VS Code extension ([Tools for Solidity](https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity))
- solc version manager

## Dependencies

- [Python](https://www.python.org/downloads/release/python-3910/) (version 3.7 or higher)
- Rosetta must be enabled on Apple Silicon (M1 & M2) Macs

> ⚠️ Python 3.12 is experimentally supported.

## Installation

via `pip`

```shell
pip3 install eth-wake
```

## Documentation & Contribution

Wake documentation can be found [here](https://ackeeblockchain.com/wake/docs/latest).

There you can also find a section on [contributing](https://ackeeblockchain.com/wake/docs/latest/contributing/).

## Discovered vulnerabilities

| Vulnerability                                   | Severity | Project | Method           | Discovered by    | Resources                                                                                                                                                                                                              |
|-------------------------------------------------|----------|---------|------------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Profit & loss accounted twice                   | Critical | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Console permanent denial of service             | High     | Brahma  | Fuzz test        | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-brahma-console-v2-report.pdf)                                                                                      |
| Swap unwinding formula error                    | High     | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Swap unwinding fee accounted twice              | High     | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Incorrect event data                            | High     | Solady  | Integration test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-solady-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-solady/blob/main/tests/test_erc1155.py) |
| `INTEREST_FROM_STRATEGY_BELOW_ZERO` reverts DoS | Medium   | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Inaccurate hypothetical interest formula        | Medium   | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Swap unwinding fee normalization error          | Medium   | IPOR    | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py)                                                                                                                              |
| Missing receive function                        | Medium   | Axelar  | Fuzz test        | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-axelar-interchain-governance-executor/blob/main/tests/test_fuzz.py)                                                                                             |

## Features

### Testing framework

See [examples](examples) and [documentation](https://ackeeblockchain.com/wake/docs/latest/testing-framework/overview) for more information.

Writing tests is as simple as:

```python
from wake.testing import *
from pytypes.contracts.Counter import Counter

@default_chain.connect()
def test_counter():
    counter = Counter.deploy()
    assert counter.count() == 0

    counter.increment()
    assert counter.count() == 1
```

### Fuzzer

Fuzzer builds on top of the testing framework and allows efficient fuzz testing of Solidity smart contracts.

```python
from wake.testing import *
from wake.testing.fuzzing import *
from pytypes.contracts.Counter import Counter

class CounterTest(FuzzTest):
    def pre_sequence(self) -> None:
        self.counter = Counter.deploy()
        self.count = 0

    @flow()
    def increment(self) -> None:
        self.counter.increment()
        self.count += 1

    @flow()
    def decrement(self) -> None:
        with may_revert(PanicCodeEnum.UNDERFLOW_OVERFLOW) as e:
            self.counter.decrement()

        if e.value is not None:
            assert self.count == 0
        else:
            self.count -= 1

    @invariant(period=10)
    def count(self) -> None:
        assert self.counter.count() == self.count

@default_chain.connect()
def test_counter():
    CounterTest().run(sequences_count=30, flows_count=100)
```

### Detectors

All vulnerability & code quality detectors can be run using:
```shell
wake detect all
```

A specific detector can be run using:
```shell
wake detect <detector-name>
```

See the [documentation](https://ackeeblockchain.com/wake/docs/latest/static-analysis/using-detectors/) for a list of all detectors.

### Printers

A specific printer can be run using:
```shell
wake print <printer-name>
```

See the [documentation](https://ackeeblockchain.com/wake/docs/latest/static-analysis/using-printers/) for a list of all printers.

### Custom detectors & printers

Refer to the [getting started]() guide for more information.
Also check out [wake_detectors](wake_detectors) and [wake_printers](wake_printers) for the implementation of built-in detectors and printers.

### LSP server

Wake implements an [LSP](https://microsoft.github.io/language-server-protocol/) server for Solidity. The only currently supported communication channel is TCP.

Wake LSP server can be run using:

```shell
wake lsp
```

Or with an optional --port argument (default 65432):

```shell
wake lsp --port 1234
```

All LSP server features can be found in the [documentation](https://ackeeblockchain.com/wake/docs/latest/language-server/).

## License

This project is licensed under the [ISC license](https://github.com/Ackee-Blockchain/wake/blob/main/LICENSE).

## Partners

RockawayX             |  Coinbase
:-------------------------:|:-------------------------:
[![](https://github.com/Ackee-Blockchain/wake/blob/main/images/rockawayx.jpg?raw=true)](https://rockawayx.com/)  |  [![](https://github.com/Ackee-Blockchain/wake/blob/main/images/coinbase.png?raw=true)](https://www.coinbase.com/)







