• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OpShin / opshin / 18500088700

14 Oct 2025 02:33PM UTC coverage: 90.329%. First build
18500088700

Pull #549

github

nielstron
Fix formatting
Pull Request #549: Plutus V3 support

1294 of 1584 branches covered (81.69%)

Branch coverage included in aggregate %.

273 of 354 new or added lines in 16 files covered. (77.12%)

4740 of 5096 relevant lines covered (93.01%)

4.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.12
/opshin/std/bls12_381.py
1
from pyblst import BlstP1Element, BlstP2Element, BlstFP12Element
5✔
2

3

4
class BLS12381G1Element:
5✔
5
    _value: BlstP1Element
5✔
6

7
    def __init__(self, value: BlstP1Element):
5✔
NEW
8
        if not isinstance(value, BlstP1Element):
×
NEW
9
            raise TypeError("value must be a BlstP1Element")
×
NEW
10
        self._value = value
×
11

12
    def compress(self) -> bytes:
5✔
NEW
13
        return self._value.compress()
×
14

15
    def __eq__(self, other) -> bool:
5✔
NEW
16
        if not isinstance(other, BLS12381G1Element):
×
NEW
17
            raise TypeError("Can only compare BLS12381G1Element with BLS12381G1Element")
×
NEW
18
        return self._value == other._value
×
19

20
    def __add__(self, other) -> "BLS12381G1Element":
5✔
NEW
21
        if not isinstance(other, BLS12381G1Element):
×
NEW
22
            raise TypeError("Can only add BLS12381G1Element with BLS12381G1Element")
×
NEW
23
        return BLS12381G1Element(value=self._value + other._value)
×
24

25
    def __neg__(self) -> "BLS12381G1Element":
5✔
NEW
26
        return BLS12381G1Element(value=-self._value)
×
27

28
    def __mul__(self, other) -> "BLS12381G1Element":
5✔
NEW
29
        return self.scalar_mul(other)
×
30

31
    def __rmul__(self, other) -> "BLS12381G1Element":
5✔
NEW
32
        return self.__mul__(other)
×
33

34
    def scalar_mul(self, other) -> "BLS12381G1Element":
5✔
NEW
35
        if not isinstance(other, int):
×
NEW
36
            raise TypeError("Can only multiply BLS12381G1Element with int")
×
NEW
37
        return BLS12381G1Element(value=self._value.scalar_mul(other))
×
38

39

40
class BLS12381G2Element:
5✔
41
    _value: BlstP2Element
5✔
42

43
    def __init__(self, value: BlstP2Element):
5✔
NEW
44
        if not isinstance(value, BlstP2Element):
×
NEW
45
            raise TypeError("value must be a BlstP2Element")
×
NEW
46
        self._value = value
×
47

48
    def compress(self) -> bytes:
5✔
NEW
49
        return self._value.compress()
×
50

51
    def __eq__(self, other) -> bool:
5✔
NEW
52
        if not isinstance(other, BLS12381G2Element):
×
NEW
53
            raise TypeError("Can only compare BLS12381G2Element with BLS12381G2Element")
×
NEW
54
        return self._value == other._value
×
55

56
    def __add__(self, other) -> "BLS12381G2Element":
5✔
NEW
57
        if not isinstance(other, BLS12381G2Element):
×
NEW
58
            raise TypeError("Can only add BLS12381G2Element with BLS12381G2Element")
×
NEW
59
        return BLS12381G2Element(value=self._value + other._value)
×
60

61
    def __neg__(self) -> "BLS12381G2Element":
5✔
NEW
62
        return BLS12381G2Element(value=-self._value)
×
63

64
    def __mul__(self, other) -> "BLS12381G2Element":
5✔
NEW
65
        return self.scalar_mul(other)
×
66

67
    def __rmul__(self, other) -> "BLS12381G2Element":
5✔
NEW
68
        return self.__mul__(other)
×
69

70
    def scalar_mul(self, other) -> "BLS12381G2Element":
5✔
NEW
71
        if not isinstance(other, int):
×
NEW
72
            raise TypeError("Can only multiply BLS12381G2Element with int")
×
NEW
73
        return BLS12381G2Element(value=self._value.scalar_mul(other))
×
74

75

76
class BLS12381MillerLoopResult:
5✔
77
    _value: BlstFP12Element
5✔
78

79
    def __init__(self, value: BlstFP12Element):
5✔
NEW
80
        if not isinstance(value, BlstFP12Element):
×
NEW
81
            raise TypeError("value must be a BlstFP12Element")
×
NEW
82
        self._value = value
×
83

84
    def __mul__(self, other) -> "BLS12381MillerLoopResult":
5✔
NEW
85
        if not isinstance(other, BLS12381MillerLoopResult):
×
NEW
86
            raise TypeError(
×
87
                "Can only multiply BLS12381MillerLoopResult with BLS12381MillerLoopResult"
88
            )
NEW
89
        return BLS12381MillerLoopResult(value=self._value * other._value)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc