# 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.8 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) |
| Non-optimistic vetting & unbonded keys bad accounting | Medium | Lido | Fuzz test | Ackee Blockchain | [Report](https://github.com/lidofinance/audits/blob/main/Ackee%20Blockchain%20Lido%20Community%20Staking%20Module%20Report%2010-24.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-lido-csm/blob/main/tests/test_csm_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
@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
@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,>=3.8",
"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/f5/e9/341f56c36ffd34e4f0ae46967a31866d5ad2c64a14a51dec4f278db3b7a9/eth_wake-4.13.2.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.8 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| Non-optimistic vetting & unbonded keys bad accounting | Medium | Lido | Fuzz test | Ackee Blockchain | [Report](https://github.com/lidofinance/audits/blob/main/Ackee%20Blockchain%20Lido%20Community%20Staking%20Module%20Report%2010-24.pdf), [Wake tests](https://github.com/Ackee-Blockchain/tests-lido-csm/blob/main/tests/test_csm_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@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@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.13.2",
"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": "4931da2b4748424f8f330212e4c1a04183ebaa760764ef36940f0c77bc5d11a6",
"md5": "02cbfabd59f3b2cf7300813378c09c88",
"sha256": "1384a50a297f8ec5bc880b3bafa44029753525d9176a2c1a6f6e55650abb8b69"
},
"downloads": -1,
"filename": "eth_wake-4.13.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "02cbfabd59f3b2cf7300813378c09c88",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 589718,
"upload_time": "2024-11-14T20:55:58",
"upload_time_iso_8601": "2024-11-14T20:55:58.932718Z",
"url": "https://files.pythonhosted.org/packages/49/31/da2b4748424f8f330212e4c1a04183ebaa760764ef36940f0c77bc5d11a6/eth_wake-4.13.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f5e9341f56c36ffd34e4f0ae46967a31866d5ad2c64a14a51dec4f278db3b7a9",
"md5": "9d18c882436071f9fbead8b27d728ae2",
"sha256": "673713165c1da0524c6deef1ebbe052a5b605f3e018d67413a2f813574f9ada6"
},
"downloads": -1,
"filename": "eth_wake-4.13.2.tar.gz",
"has_sig": false,
"md5_digest": "9d18c882436071f9fbead8b27d728ae2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 428774,
"upload_time": "2024-11-14T20:56:02",
"upload_time_iso_8601": "2024-11-14T20:56:02.523568Z",
"url": "https://files.pythonhosted.org/packages/f5/e9/341f56c36ffd34e4f0ae46967a31866d5ad2c64a14a51dec4f278db3b7a9/eth_wake-4.13.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-14 20:56:02",
"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"
}