Skip to main content

SInDi: Semantic Invariant Differencing for Solidity Smart Contracts

Project description

Δ Sindi: Semantic Invariant Differencing for Solidity Smart Contracts

SInDi compares two Solidity boolean predicates (e.g., require guards) and decides whether they are equivalent, or one is stronger.

Install

pip install sindi

Quick usage

Library

from sindi import Comparator, ComparatorRulesOnly

cmp = Comparator()
print(cmp.compare("a > b", "a >= b"))
# "The first predicate is stronger."

light = ComparatorRulesOnly()
print(light.compare("a > b * 2", "a > b"))
# "The first predicate is stronger."

CLI

# Compare (full)
sindi compare "msg.sender == msg.origin && a >= b" "msg.sender == msg.origin"

# Light comparator (no SMT)
sindi compare "a > b * 2" "a > b" --light

# Rewrite / tokenize / parse / simplify
sindi rewrite "isOwner() && now >= 0"
sindi tokenize "..." --json
sindi parse "..." --tree
sindi simplify "..." --show-sympy --json

API (tiny)

  • Comparator().compare(p1: str, p2: str) -> str Full semantic differencing (SymPy + selective Z3 where needed).

  • ComparatorRulesOnly().compare(p1: str, p2: str) -> str Lightweight, solver-free structural/rewrites reasoning.


Notes: Functions & arrays are treated as uninterpreted symbols for reasoning. Division is modeled as a * b**-1. Variables are assumed non-negative in SMT checks.

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

sindi-0.2.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sindi-0.2.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file sindi-0.2.0.tar.gz.

File metadata

  • Download URL: sindi-0.2.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for sindi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ac3fc83bcb38d6103ed911667d30623513ca6a3d0294c9efd0a46e516db519ce
MD5 ca71d551b1be32d1b35cbbd0bfb021fe
BLAKE2b-256 75c98e2c4ad1d6a306829381c0d4174837dbeeb1f62364b8becd99055e8b2047

See more details on using hashes here.

File details

Details for the file sindi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sindi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for sindi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ca4d2e4ec88540f5739c0eef748f1209360dda9e4baf6838948f3ccf4987e1c
MD5 279dbae7e64780072b5e857d48b3e3eb
BLAKE2b-256 9ff85b43f5c0599d1742902cdfd6a837964ec80f01ee6e3245ddc531a7b1110f

See more details on using hashes here.

Supported by

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