Skip to main content

Woke is a Python-based development and testing framework for Solidity.

Project description

Woke

Woke is a Python-based development and testing framework for Solidity.

Features:

  • Testing framework - a testing framework for Solidity smart contracts with Python-native equivalents of Solidity types and blazing fast execution.

  • Fuzzer - a property-based fuzzer for Solidity smart contracts that allows testers to write their fuzz tests in Python.

  • Vulnerability detectors

  • LSP server

Dependencies

  • Python (version 3.7 or higher)

:warning: Python 3.11 is experimentally supported.

Installation

via pip

pip3 install woke

Documentation & Contribution

Woke documentation can be found here.

There you can also find a section on contributing.

Features

Testing framework

See examples and documentation for more information.

Writing tests is as simple as:

from woke.testing import *
from pytypes.contracts.Counter import Counter

@default_chain.connect()
def test_counter():
    default_chain.set_default_accounts(default_chain.accounts[0])

    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.

from woke.testing import *
from woke.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(Panic(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():
    default_chain.set_default_accounts(default_chain.accounts[0])
    CounterTest().run(sequences_count=30, flows_count=100)

Vulnerability detectors

Vulnerability detectors can be run using:

woke detect

LSP server

Woke implements an LSP server for Solidity. The only currently supported communication channel is TCP.

Woke LSP server can be run using:

woke lsp

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

woke lsp --port 1234

All LSP server features can be found in the documentation.

License

This project is licensed under the ISC license.

Partners

RockawayX Coinbase

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

woke-4.0.0a1.tar.gz (290.3 kB view details)

Uploaded Source

Built Distribution

woke-4.0.0a1-py3-none-any.whl (400.0 kB view details)

Uploaded Python 3

File details

Details for the file woke-4.0.0a1.tar.gz.

File metadata

  • Download URL: woke-4.0.0a1.tar.gz
  • Upload date:
  • Size: 290.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.7.12 Linux/6.4.9-1-MANJARO

File hashes

Hashes for woke-4.0.0a1.tar.gz
Algorithm Hash digest
SHA256 ce45ac9e66b40ab694833c87938023f0524c2f753ba73bfa8d674eb84e04705f
MD5 96915f50141eeec5ed5e339bfc98fd3e
BLAKE2b-256 18c1087879b2588b4dc5305f1887ebab6f1fcdb797ec3eef59fb01a97bb4cb96

See more details on using hashes here.

File details

Details for the file woke-4.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: woke-4.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 400.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.7.12 Linux/6.4.9-1-MANJARO

File hashes

Hashes for woke-4.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f2874a9462f79efd608d326edfe5f4b846ff992d0028b8819ccd82de564eb7b
MD5 35f2422f34c8f90d159d017c074163df
BLAKE2b-256 37d7e48d93c6bf85a767f2cf3775a0552cf2c5e1e59eaeb619b17af07cc7ded6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page