Skip to content

Commit

Permalink
Use bls from chia rs (Chia-Network#16715)
Browse files Browse the repository at this point in the history
* replace blspy imports with chia_rs imports for BLS types

* remove blspy-stubs, since we're dropping the blspy dependency. chia_rs has type stubs already
  • Loading branch information
arvidn authored Nov 7, 2023
1 parent a53652c commit 95e5b97
Show file tree
Hide file tree
Showing 133 changed files with 169 additions and 375 deletions.
7 changes: 0 additions & 7 deletions Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ param(
$ErrorActionPreference = "Stop"

$extras = @()
$blspy = $False
if ($d)
{
$extras += "dev"
$blspy = $True
}

$editable_cli = "--editable"
Expand Down Expand Up @@ -118,11 +116,6 @@ venv\scripts\python -m pip install --upgrade pip setuptools wheel
venv\scripts\pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
venv\scripts\pip install $editable_cli ".$extras_cli" --extra-index-url https://pypi.chia.net/simple/

if ($blspy)
{
venv\scripts\pip install $editable_cli .\blspy-stubs
}

if ($p)
{
$PREV_VIRTUAL_ENV = "$env:VIRTUAL_ENV"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/mempool-long-lived.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from time import monotonic
from typing import Dict, Optional

from blspy import G2Element
from chia_rs import G2Element
from clvm.casts import int_to_bytes

from chia.consensus.cost_calculator import NPCResult
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import aiosqlite
import click
from blspy import AugSchemeMPL, G1Element, G2Element
from chia_rs import AugSchemeMPL, G1Element, G2Element

from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
from chia.consensus.default_constants import DEFAULT_CONSTANTS
Expand Down
118 changes: 0 additions & 118 deletions blspy-stubs/blspy-stubs/__init__.pyi

This file was deleted.

9 changes: 0 additions & 9 deletions blspy-stubs/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion chia/cmds/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def search_cmd(
) -> None:
import sys

from blspy import PrivateKey
from chia_rs import PrivateKey

from .keys_funcs import resolve_derivation_master_key, search_derive

Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/keys_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union

from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey

from chia.cmds.passphrase_funcs import obtain_current_passphrase
from chia.consensus.coinbase import create_puzzlehash_for_pk
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/sim_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Dict, List, Optional

from aiohttp import ClientConnectorError
from blspy import PrivateKey
from chia_rs import PrivateKey

from chia.cmds.cmds_util import get_any_service_client
from chia.cmds.start_funcs import async_start
Expand Down
7 changes: 3 additions & 4 deletions chia/consensus/block_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from dataclasses import replace
from typing import Callable, Dict, List, Optional, Tuple

import blspy
from blspy import G1Element, G2Element
from chia_rs import compute_merkle_set_root
import chia_rs
from chia_rs import G1Element, G2Element, compute_merkle_set_root
from chiabip158 import PyBIP158

from chia.consensus.block_record import BlockRecord
Expand Down Expand Up @@ -367,7 +366,7 @@ def create_unfinished_block(
rc_sp_signature: Optional[G2Element] = get_plot_signature(rc_sp_hash, proof_of_space.plot_public_key)
assert cc_sp_signature is not None
assert rc_sp_signature is not None
assert blspy.AugSchemeMPL.verify(proof_of_space.plot_public_key, cc_sp_hash, cc_sp_signature)
assert chia_rs.AugSchemeMPL.verify(proof_of_space.plot_public_key, cc_sp_hash, cc_sp_signature)

total_iters = uint128(sub_slot_start_total_iters + ip_iters + (sub_slot_iters if overflow else 0))

Expand Down
2 changes: 1 addition & 1 deletion chia/consensus/block_header_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from typing import Optional, Tuple

from blspy import AugSchemeMPL
from chia_rs import AugSchemeMPL

from chia.consensus.block_record import BlockRecord
from chia.consensus.blockchain_interface import BlockchainInterface
Expand Down
2 changes: 1 addition & 1 deletion chia/consensus/coinbase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from blspy import G1Element
from chia_rs import G1Element

from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.sized_bytes import bytes32
Expand Down
2 changes: 1 addition & 1 deletion chia/consensus/multiprocess_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataclasses import dataclass
from typing import Awaitable, Callable, Dict, List, Optional, Sequence, Tuple

from blspy import AugSchemeMPL, G1Element
from chia_rs import AugSchemeMPL, G1Element

from chia.consensus.block_header_validation import validate_finished_header_block
from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 1 addition & 1 deletion chia/daemon/keychain_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Dict, List, Optional, Tuple

from aiohttp import ClientConnectorError, ClientSession
from blspy import AugSchemeMPL, PrivateKey
from chia_rs import AugSchemeMPL, PrivateKey

from chia.cmds.init_funcs import check_keys
from chia.daemon.client import DaemonProxy
Expand Down
2 changes: 1 addition & 1 deletion chia/daemon/keychain_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Type

from blspy import PrivateKey
from chia_rs import PrivateKey

from chia.cmds.init_funcs import check_keys
from chia.util.errors import KeychainException, KeychainFingerprintNotFound
Expand Down
2 changes: 1 addition & 1 deletion chia/daemon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from types import FrameType
from typing import Any, AsyncIterator, Dict, List, Optional, Set, TextIO, Tuple

from blspy import G1Element
from chia_rs import G1Element
from typing_extensions import Protocol

from chia import __version__
Expand Down
2 changes: 1 addition & 1 deletion chia/data_layer/data_layer_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from operator import attrgetter
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast

from blspy import G1Element, G2Element
from chia_rs import G1Element, G2Element
from clvm.EvalError import EvalError
from typing_extensions import Unpack, final

Expand Down
2 changes: 1 addition & 1 deletion chia/farmer/farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast

import aiohttp
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey

from chia.consensus.constants import ConsensusConstants
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
Expand Down
2 changes: 1 addition & 1 deletion chia/farmer/farmer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, Dict, List, Optional, Union

import aiohttp
from blspy import AugSchemeMPL, G2Element, PrivateKey
from chia_rs import AugSchemeMPL, G2Element, PrivateKey

from chia import __version__
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
final,
)

from blspy import AugSchemeMPL
from chia_rs import AugSchemeMPL

from chia.consensus.block_creation import unfinished_block_to_full_block
from chia.consensus.block_record import BlockRecord
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/full_node_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple

from blspy import AugSchemeMPL, G1Element, G2Element
from chia_rs import AugSchemeMPL, G1Element, G2Element
from chiabip158 import PyBIP158

from chia.consensus.block_creation import create_unfinished_block
Expand Down
3 changes: 1 addition & 2 deletions chia/full_node/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from enum import Enum
from typing import Callable, Dict, Iterator, List, Optional, Tuple

from blspy import AugSchemeMPL, G2Element
from chia_rs import Coin
from chia_rs import AugSchemeMPL, Coin, G2Element

from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.full_node.fee_estimation import FeeMempoolInfo, MempoolInfo, MempoolItemInfo
Expand Down
3 changes: 1 addition & 2 deletions chia/full_node/mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from multiprocessing.context import BaseContext
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, TypeVar

from blspy import GTElement
from chia_rs import ELIGIBLE_FOR_DEDUP
from chia_rs import ELIGIBLE_FOR_DEDUP, GTElement
from chiabip158 import PyBIP158

from chia.consensus.block_record import BlockRecordProtocol
Expand Down
2 changes: 1 addition & 1 deletion chia/harvester/harvester_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import List, Optional, Tuple

from blspy import AugSchemeMPL, G1Element, G2Element
from chia_rs import AugSchemeMPL, G1Element, G2Element

from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
from chia.harvester.harvester import Harvester
Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import Dict, ItemsView, KeysView, List, Optional, Tuple, ValuesView

from blspy import G1Element
from chia_rs import G1Element
from chiapos import DiskProver

from chia.plotting.util import parse_plot_info
Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/check_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from time import sleep, time
from typing import List, Optional

from blspy import G1Element
from chia_rs import G1Element
from chiapos import Verifier

from chia.plotting.manager import PlotManager
Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/create_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import Dict, List, Optional, Tuple

from blspy import AugSchemeMPL, G1Element, PrivateKey
from chia_rs import AugSchemeMPL, G1Element, PrivateKey
from chiapos import DiskPlotter

from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple

from blspy import G1Element
from chia_rs import G1Element
from chiapos import DiskProver, decompressor_context_queue

from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size
Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union

from blspy import G1Element, PrivateKey
from chia_rs import G1Element, PrivateKey
from chiapos import DiskProver
from typing_extensions import final

Expand Down
2 changes: 1 addition & 1 deletion chia/pools/pool_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import List

from blspy import G1Element
from chia_rs import G1Element

from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.byte_types import hexstr_to_bytes
Expand Down
Loading

0 comments on commit 95e5b97

Please sign in to comment.