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
12 changes: 5 additions & 7 deletions src/lean_spec/subspecs/xmss/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
- Type-2: a merge of N Type-1 proofs over distinct messages.
"""

from __future__ import annotations

from collections.abc import Sequence

from lean_multisig_py import (
Expand Down Expand Up @@ -67,8 +65,8 @@ class TypeOneMultiSignature(Container):

@staticmethod
def select_greedily(
*proof_sets: set[TypeOneMultiSignature] | None,
) -> tuple[list[TypeOneMultiSignature], set[ValidatorIndex]]:
*proof_sets: set["TypeOneMultiSignature"] | None,
) -> tuple[list["TypeOneMultiSignature"], set[ValidatorIndex]]:
"""Greedy set-cover over Type-1 proofs to maximise validator coverage.

Repeatedly selects the proof covering the most uncovered validators
Expand Down Expand Up @@ -102,13 +100,13 @@ def select_greedily(

@staticmethod
def aggregate(
children: Sequence[tuple[TypeOneMultiSignature, Sequence[PublicKey]]],
children: Sequence[tuple["TypeOneMultiSignature", Sequence[PublicKey]]],
raw_xmss: Sequence[tuple[PublicKey, Signature]],
xmss_participants: AggregationBits | None,
message: Bytes32,
slot: Slot,
mode: LeanEnvMode | None = None,
) -> TypeOneMultiSignature:
) -> "TypeOneMultiSignature":
"""Aggregate raw XMSS signatures and child Type-1 proofs into one Type-1 proof.

Proof bytes are stored in compact no-pubkeys form. Participant identity is
Expand Down Expand Up @@ -224,7 +222,7 @@ def aggregate(
parts: Sequence[TypeOneMultiSignature],
public_keys_per_part: Sequence[Sequence[PublicKey]] | None = None,
mode: LeanEnvMode | None = None,
) -> TypeTwoMultiSignature:
) -> "TypeTwoMultiSignature":
"""Merge several Type-1 proofs (each over a distinct message) into one Type-2 proof.

The returned Type-2 proof bytes are stored in compact no-pubkeys form.
Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/subspecs/xmss/containers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Generalized XMSS containers."""

from __future__ import annotations

from typing import override

from pydantic import field_serializer, field_validator, model_serializer
Expand Down
10 changes: 5 additions & 5 deletions src/lean_spec/subspecs/xmss/subtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
implementing the memory-efficient top-bottom tree traversal approach.
"""

from __future__ import annotations
from typing import Self

from lean_spec.types import Uint64
from lean_spec.types.container import Container
Expand Down Expand Up @@ -103,7 +103,7 @@ def new(
start_index: Uint64,
parameter: Parameter,
lowest_layer_nodes: list[HashDigestVector],
) -> HashSubTree:
) -> Self:
"""
Builds a new sparse Merkle subtree starting from a specified layer.

Expand Down Expand Up @@ -187,7 +187,7 @@ def new_top_tree(
start_bottom_tree_index: Uint64,
parameter: Parameter,
bottom_tree_roots: list[HashDigestVector],
) -> HashSubTree:
) -> Self:
"""
Constructs a top tree from the roots of bottom trees.

Expand Down Expand Up @@ -243,7 +243,7 @@ def new_bottom_tree(
bottom_tree_index: Uint64,
parameter: Parameter,
leaves: list[HashDigestVector],
) -> HashSubTree:
) -> Self:
"""
Constructs a single bottom tree from leaf hashes.

Expand Down Expand Up @@ -327,7 +327,7 @@ def from_prf_key(
prf_key: PRFKey,
bottom_tree_index: Uint64,
parameter: Parameter,
) -> HashSubTree:
) -> Self:
"""
Generates a single bottom tree on-demand from the PRF key.

Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/types/bitfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
Bit i of the input lands in byte i // 8 at position i % 8.
"""

from __future__ import annotations

import math
from collections.abc import Sequence
from typing import (
Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/types/byte_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
Both flavors serialize as the raw bytes themselves — no length prefix, no delimiter.
"""

from __future__ import annotations

from collections.abc import Iterable
from typing import IO, Any, ClassVar, Self, override

Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/types/collections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Vector and List Type Specifications."""

from __future__ import annotations

import io
from collections.abc import Iterator, Sequence
from typing import (
Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/types/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Ethereum's serialization format.
"""

from __future__ import annotations

from typing import IO, Any, Self, override

from .constants import OFFSET_BYTE_LENGTH
Expand Down
2 changes: 0 additions & 2 deletions src/lean_spec/types/ssz_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Base classes and interfaces for all SSZ types."""

from __future__ import annotations

import io
from abc import ABC, abstractmethod
from collections.abc import Sequence
Expand Down
Loading