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.1.tar.gz (41.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.1-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sindi-0.2.1.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for sindi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3af8a63707d9b8087baea08868cce50dc6b5b166a04beff6f9dfaf01955a9158
MD5 3b2b463304e27854632c3731b8127f8b
BLAKE2b-256 41feef853a0e422da80cc6ba9caa0f3f7fcfe2636d1670a02c31618c21dde5c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sindi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for sindi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9be604d965ec9e13f2b0417d94048949009280fb9c2353100be83f2ff9823514
MD5 c9eec7feca14ac18de1f6b0ce0f5b28d
BLAKE2b-256 5f170eaa88ec47763122adef3318aa0ef4eeaa90bee932f31fdc424a6f12aae9

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