Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Running Examples

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install locally
run: |
pip install -e .

- name: Run all Examples
run: |
for example in examples/*.py; do
python3 "$example"
done
3 changes: 2 additions & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: "3.10"

- name: Install pypa/build
run: >-
python3 -m
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruff-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
- uses: astral-sh/ruff-action@v3
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'

- name: Install locally
run: |
Expand Down
18 changes: 0 additions & 18 deletions examples/example_multisig.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/example_transfer_transaction_bls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pactus.crypto.address import Address
from pactus.crypto.bls.private_key import PrivateKey
from pactus.transaction.transaction import Transaction
from pactus.types.amount import Amount
from pactus.amount import Amount


def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/example_transfer_transaction_ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pactus.crypto.address import Address
from pactus.crypto.ed25519.private_key import PrivateKey
from pactus.transaction.transaction import Transaction
from pactus.types.amount import Amount
from pactus.amount import Amount


def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion examples/example_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def main() -> None:
if len(sys.argv) < 2:
print("Usage: python3 ./example_zmq.py <connect_to> [topic topic ...]")
sys.exit(1)
sys.exit(0)

connect_to = sys.argv[1]
topics = sys.argv[2:]
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions pactus/crypto/bls/bls12_381/bls_sig_g1.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def aggregate(sigs):

# aggregate verification
def aggregate_verify(pks, msgs, sig, ciphersuite):
assert len(pks) == len(
msgs
), "FAIL: aggregate_verify needs same number of sigs and msgs"
assert len(pks) == len(msgs), (
"FAIL: aggregate_verify needs same number of sigs and msgs"
)
if not subgroup_check_g1(sig):
return False
Ps = [None] * (1 + len(msgs))
Expand All @@ -103,9 +103,9 @@ def _agg_ver_nul(pks, msgs, sig, ciphersuite, ver_fn):

# aggregate verification with message augmentation
def _agg_ver_aug(pks, msgs, sig, ciphersuite, ver_fn):
assert len(pks) == len(
msgs
), "FAIL: aggregate_verify_aug needs same number of sigs and msgs"
assert len(pks) == len(msgs), (
"FAIL: aggregate_verify_aug needs same number of sigs and msgs"
)
msgs_aug = [serialize(pk, True) + msg for (pk, msg) in zip(pks, msgs)]
return ver_fn(pks, msgs_aug, sig, ciphersuite)

Expand Down
6 changes: 3 additions & 3 deletions pactus/crypto/bls/bls12_381/bls_sig_g2.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def verify(pk, sig, msg, ciphersuite):

# aggregate verification
def aggregate_verify(pks, msgs, sig, ciphersuite):
assert len(pks) == len(
msgs
), "FAIL: aggregate_verify needs same number of sigs and msgs"
assert len(pks) == len(msgs), (
"FAIL: aggregate_verify needs same number of sigs and msgs"
)
if not subgroup_check_g2(sig):
return False
Qs = [None] * (1 + len(msgs))
Expand Down
2 changes: 1 addition & 1 deletion pactus/transaction/_payload.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from abc import ABC, abstractmethod
from enum import Enum

from pactus.amount import Amount
from pactus.crypto.address import Address
from pactus.encoding import encoding
from pactus.types.amount import Amount


class PayloadType(Enum):
Expand Down
2 changes: 1 addition & 1 deletion pactus/transaction/transaction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pactus.amount import Amount
from pactus.crypto.address import Address
from pactus.crypto.private_key import PrivateKey
from pactus.encoding import encoding
from pactus.types.amount import Amount

from ._payload import (
BondPayload,
Expand Down
Empty file removed pactus/types/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
URL = "https://github.com/pactus-project/python-sdk"

# Package dependencies
REQUIRED = ["ripemd-hash", "grpcio", "grpcio-tools", "cryptography>=43.0"]
REQUIRED = ["ripemd-hash", "grpcio", "grpcio-tools", "cryptography>=43.0", "zmq"]

CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_amount.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from pactus.types.amount import NANO_PAC_PER_PAC, Amount
from pactus.amount import NANO_PAC_PER_PAC, Amount


class TestAmount(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pactus.crypto.address import Address
from pactus.crypto.bls.private_key import PrivateKey
from pactus.transaction.transaction import Transaction
from pactus.types.amount import Amount
from pactus.amount import Amount


class TestTransaction(unittest.TestCase):
Expand Down