# Wake, a Python-based Solidity development and testing framework with built-in vulnerability detectors
![Wake cover](https://github.com/Ackee-Blockchain/wake/blob/main/images/wake_cover.png?raw=true)
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 actions for [setting up Wake](https://github.com/marketplace/actions/wake-setup) and [running detectors](https://github.com/marketplace/actions/wake-detect)
- 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 (version 3.7 or higher)
- Rosetta must be enabled on Apple Silicon Macs
> ⚠️ Python 3.12 is experimentally supported.
## Installation
via `pip`
```shell
pip3 install eth-wake
```
## Documentation & Contribution
Wake documentation can be found [here](https://ackee.xyz/wake/docs/latest).
There you can also find a section on [contributing](https://ackee.xyz/wake/docs/latest/contributing/).
## Discovered vulnerabilities
| Vulnerability | Severity | Project | Method | Discovered by | Resources |
|-------------------------------------------------|----------|---------|------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Profit & loss accounted twice | Critical | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [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 | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [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 | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [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 | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [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 | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [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 | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |
| Liquidation deposits accounted into LP balance | Medium | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_st_eth_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) |
| `SafeERC20` not used for `approve` | Medium | Lido | Fuzz test | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-lido-stonks/blob/main/tests/test_fuzz.py) |
## Features
### Testing framework
See [examples](https://github.com/Ackee-Blockchain/wake/tree/main/examples) and [documentation](https://ackee.xyz/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://ackee.xyz/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://ackee.xyz/wake/docs/latest/static-analysis/using-printers/) for a list of all printers.
### Custom detectors & printers
Refer to the [getting started](https://ackee.xyz/wake/docs/latest/static-analysis/getting-started/) guide for more information.
Also check out [wake_detectors](https://github.com/Ackee-Blockchain/wake/tree/main/wake_detectors) and [wake_printers](https://github.com/Ackee-Blockchain/wake/tree/main/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://ackee.xyz/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/)
Raw data
{
"_id": null,
"home_page": "https://getwake.io",
"name": "eth-wake",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.7.9",
"maintainer_email": null,
"keywords": "ethereum, solidity, security, testing, development, static analysis, framework, audit",
"author": "Ackee Blockchain",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1b/be/4c46f451021c5b8aeac020a3a79dfd9daddeb213b89586aecfb1a5cff225/eth_wake-4.9.0.tar.gz",
"platform": null,
"description": "# Wake, a Python-based Solidity development and testing framework with built-in vulnerability detectors\n\n![Wake cover](https://github.com/Ackee-Blockchain/wake/blob/main/images/wake_cover.png?raw=true)\n\nFeatures:\n\n- testing framework based on [pytest](https://docs.pytest.org/en)\n- property-based fuzzer\n- deployments & mainnet interactions\n- vulnerability and code quality detectors\n- printers for extracting useful information from Solidity code\n- static analysis framework for implementing custom detectors and printers\n- Github actions for [setting up Wake](https://github.com/marketplace/actions/wake-setup) and [running detectors](https://github.com/marketplace/actions/wake-detect)\n- language server ([LSP](https://microsoft.github.io/language-server-protocol/))\n- VS Code extension ([Tools for Solidity](https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity))\n- solc version manager\n\n## Dependencies\n\n- Python (version 3.7 or higher)\n- Rosetta must be enabled on Apple Silicon Macs\n\n> \u26a0\ufe0f Python 3.12 is experimentally supported.\n\n## Installation\n\nvia `pip`\n\n```shell\npip3 install eth-wake\n```\n\n## Documentation & Contribution\n\nWake documentation can be found [here](https://ackee.xyz/wake/docs/latest).\n\nThere you can also find a section on [contributing](https://ackee.xyz/wake/docs/latest/contributing/).\n\n## Discovered vulnerabilities\n\n| Vulnerability | Severity | Project | Method | Discovered by | Resources |\n|-------------------------------------------------|----------|---------|------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Profit & loss accounted twice | Critical | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| 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) |\n| Swap unwinding formula error | High | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| Swap unwinding fee accounted twice | High | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| 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) |\n| `INTEREST_FROM_STRATEGY_BELOW_ZERO` reverts DoS | Medium | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| Inaccurate hypothetical interest formula | Medium | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| Swap unwinding fee normalization error | Medium | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_fuzz.py) |\n| Liquidation deposits accounted into LP balance | Medium | IPOR | Fuzz test | Ackee Blockchain | [Report](https://github.com/Ackee-Blockchain/public-audit-reports/blob/master/2023/ackee-blockchain-ipor-protocol-report.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-ipor/blob/main/tests/test_st_eth_fuzz.py) |\n| 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) |\n| `SafeERC20` not used for `approve` | Medium | Lido | Fuzz test | Ackee Blockchain | [Wake tests](https://github.com/Ackee-Blockchain/tests-lido-stonks/blob/main/tests/test_fuzz.py) |\n\n## Features\n\n### Testing framework\n\nSee [examples](https://github.com/Ackee-Blockchain/wake/tree/main/examples) and [documentation](https://ackee.xyz/wake/docs/latest/testing-framework/overview) for more information.\n\nWriting tests is as simple as:\n\n```python\nfrom wake.testing import *\nfrom pytypes.contracts.Counter import Counter\n\n@default_chain.connect()\ndef test_counter():\n counter = Counter.deploy()\n assert counter.count() == 0\n\n counter.increment()\n assert counter.count() == 1\n```\n\n### Fuzzer\n\nFuzzer builds on top of the testing framework and allows efficient fuzz testing of Solidity smart contracts.\n\n```python\nfrom wake.testing import *\nfrom wake.testing.fuzzing import *\nfrom pytypes.contracts.Counter import Counter\n\nclass CounterTest(FuzzTest):\n def pre_sequence(self) -> None:\n self.counter = Counter.deploy()\n self.count = 0\n\n @flow()\n def increment(self) -> None:\n self.counter.increment()\n self.count += 1\n\n @flow()\n def decrement(self) -> None:\n with may_revert(PanicCodeEnum.UNDERFLOW_OVERFLOW) as e:\n self.counter.decrement()\n\n if e.value is not None:\n assert self.count == 0\n else:\n self.count -= 1\n\n @invariant(period=10)\n def count(self) -> None:\n assert self.counter.count() == self.count\n\n@default_chain.connect()\ndef test_counter():\n CounterTest().run(sequences_count=30, flows_count=100)\n```\n\n### Detectors\n\nAll vulnerability & code quality detectors can be run using:\n```shell\nwake detect all\n```\n\nA specific detector can be run using:\n```shell\nwake detect <detector-name>\n```\n\nSee the [documentation](https://ackee.xyz/wake/docs/latest/static-analysis/using-detectors/) for a list of all detectors.\n\n### Printers\n\nA specific printer can be run using:\n```shell\nwake print <printer-name>\n```\n\nSee the [documentation](https://ackee.xyz/wake/docs/latest/static-analysis/using-printers/) for a list of all printers.\n\n### Custom detectors & printers\n\nRefer to the [getting started](https://ackee.xyz/wake/docs/latest/static-analysis/getting-started/) guide for more information.\nAlso check out [wake_detectors](https://github.com/Ackee-Blockchain/wake/tree/main/wake_detectors) and [wake_printers](https://github.com/Ackee-Blockchain/wake/tree/main/wake_printers) for the implementation of built-in detectors and printers.\n\n### LSP server\n\nWake implements an [LSP](https://microsoft.github.io/language-server-protocol/) server for Solidity. The only currently supported communication channel is TCP.\n\nWake LSP server can be run using:\n\n```shell\nwake lsp\n```\n\nOr with an optional --port argument (default 65432):\n\n```shell\nwake lsp --port 1234\n```\n\nAll LSP server features can be found in the [documentation](https://ackee.xyz/wake/docs/latest/language-server/).\n\n## License\n\nThis project is licensed under the [ISC license](https://github.com/Ackee-Blockchain/wake/blob/main/LICENSE).\n\n## Partners\n\nRockawayX | Coinbase\n:-------------------------:|:-------------------------:\n[![](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/)\n\n\n\n\n\n\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "Wake is a Python-based Solidity development and testing framework with built-in vulnerability detectors.",
"version": "4.9.0",
"project_urls": {
"Documentation": "https://ackee.xyz/wake/docs/latest",
"Homepage": "https://getwake.io",
"Repository": "https://github.com/Ackee-Blockchain/wake",
"VS Code Extension": "https://marketplace.visualstudio.com/items?itemName=AckeeBlockchain.tools-for-solidity"
},
"split_keywords": [
"ethereum",
" solidity",
" security",
" testing",
" development",
" static analysis",
" framework",
" audit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "09190387d94b77e285fd03e464dbf56e6a5e8bdb2b5be852d4ff7e50d76abbcc",
"md5": "7367e1d336ea3b04014dd3478b88d079",
"sha256": "7d49c82e9e0bde8f5a3bd94438378753f421d3f7d28bf2123f936ba42fa98b06"
},
"downloads": -1,
"filename": "eth_wake-4.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7367e1d336ea3b04014dd3478b88d079",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.7.9",
"size": 532514,
"upload_time": "2024-04-25T15:45:34",
"upload_time_iso_8601": "2024-04-25T15:45:34.386497Z",
"url": "https://files.pythonhosted.org/packages/09/19/0387d94b77e285fd03e464dbf56e6a5e8bdb2b5be852d4ff7e50d76abbcc/eth_wake-4.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1bbe4c46f451021c5b8aeac020a3a79dfd9daddeb213b89586aecfb1a5cff225",
"md5": "d515d7382afa84352766f3f9e0445370",
"sha256": "0e84b4f2e499354453e38ef781b05ca93d4407cd4cc8fa5919d84137a33dfb07"
},
"downloads": -1,
"filename": "eth_wake-4.9.0.tar.gz",
"has_sig": false,
"md5_digest": "d515d7382afa84352766f3f9e0445370",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.7.9",
"size": 385421,
"upload_time": "2024-04-25T15:45:36",
"upload_time_iso_8601": "2024-04-25T15:45:36.163465Z",
"url": "https://files.pythonhosted.org/packages/1b/be/4c46f451021c5b8aeac020a3a79dfd9daddeb213b89586aecfb1a5cff225/eth_wake-4.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-25 15:45:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Ackee-Blockchain",
"github_project": "wake",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "eth-wake"
}