Metadata-Version: 2.1
Name: sindi
Version: 0.1.14
Summary: SInDi: Semantic Invariant Differencing for Solidity Smart Contracts
Home-page: https://github.com/mojtaba-eshghie/SInDi
Author: Mojtaba Eshghie
Author-email: eshghie@kth.se
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: sympy>=1.13.0rc2
Requires-Dist: colorama>=0.4.6
Requires-Dist: pyyaml>=6.0.1

# SINA: Semantic Invariant Analysis for Smart Contracts 

SINA is a tool to compare two predicates written in Solidity, the smart contract programming language. PreDi determines if two predicates are equivalent or if one is stronger than the other.

## Features

- Tokenizes and parses each Solidity predicate into an Abstract Syntax Tree (AST)
- Simplifies AST using symbolic mathematics
- Compare predicates for equivalence and logical strength either using predefined rules (when applicable) or checking for satisfiability when pre-defined rules are not applicable.

## Install Using pip and Use as a Python Library

Running the following command should suffice:

```sh
pip install predi
```

### Library Usage

#### Simple Predicate Comparison

```Python
>>> from predi.comparator import Comparator
>>> comparator = Comparator()
>>> comparator.compare("a < b", "a <= b")
'The first predicate is stronger.'
>>> comparator.compare("a > b", "a <= b")
'The predicates are not equivalent and neither is stronger.'
```

## Installing and Using as a CLI Tool

### Prerequisites

- Python 3.8 or higher
- Install required packages using pip

```sh
pip install -r requirements.txt
```

### Running the Tests

To ensure everything is set up correctly, run the unit tests:

```sh
python -m unittest discover -s tests
```

To run an specific test:

```sh
python -m unittest tests.test_comparator.TestComparator.test_comparator
```

### CLI Usage

You can compare two predicates using the `main.py` script. Here's an example:

```sh
$ python main.py "msg.sender == msg.origin" "msg.origin == msg.sender"
The predicates are equivalent.

$ python main.py "msg.sender == msg.origin && a >= b" "msg.sender == msg.origin"
The first predicate is stronger.

$ python main.py "msg.sender == msg.origin || a < b" "a < b"
The second predicate is stronger.
```
