mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-20 17:56:45 +03:00
Use bls from chia rs (#16715)
* 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
This commit is contained in:
parent
a53652cfda
commit
95e5b97557
@ -10,11 +10,9 @@ param(
|
|||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
$extras = @()
|
$extras = @()
|
||||||
$blspy = $False
|
|
||||||
if ($d)
|
if ($d)
|
||||||
{
|
{
|
||||||
$extras += "dev"
|
$extras += "dev"
|
||||||
$blspy = $True
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$editable_cli = "--editable"
|
$editable_cli = "--editable"
|
||||||
@ -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 --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/
|
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)
|
if ($p)
|
||||||
{
|
{
|
||||||
$PREV_VIRTUAL_ENV = "$env:VIRTUAL_ENV"
|
$PREV_VIRTUAL_ENV = "$env:VIRTUAL_ENV"
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from time import monotonic
|
from time import monotonic
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
|
|
||||||
from chia.consensus.cost_calculator import NPCResult
|
from chia.consensus.cost_calculator import NPCResult
|
||||||
|
@ -11,7 +11,7 @@ from typing import Any, Generic, Optional, Tuple, Type, TypeVar, Union
|
|||||||
|
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
import click
|
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.coinbase import create_farmer_coin, create_pool_coin
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
|
@ -1,118 +0,0 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
class G1Element:
|
|
||||||
SIZE: ClassVar[int] = ...
|
|
||||||
def __new__(cls) -> G1Element: ...
|
|
||||||
def get_fingerprint(self) -> int: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes_unchecked(b: bytes) -> G1Element: ...
|
|
||||||
def pair(self, other: G2Element) -> GTElement: ...
|
|
||||||
@staticmethod
|
|
||||||
def generator() -> G1Element: ...
|
|
||||||
def __add__(self, other: G1Element) -> G1Element: ...
|
|
||||||
def __iadd__(self, other: G1Element) -> None: ...
|
|
||||||
def __init__(self) -> None: ...
|
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def __str__(self) -> str: ...
|
|
||||||
def __repr__(self) -> str: ...
|
|
||||||
def __richcmp__(self) -> Any: ...
|
|
||||||
def __deepcopy__(self) -> G1Element: ...
|
|
||||||
def __copy__(self) -> G1Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes(bytes) -> G1Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def parse_rust(ReadableBuffer) -> Tuple[G1Element, int]: ...
|
|
||||||
def to_bytes(self) -> bytes: ...
|
|
||||||
def __bytes__(self) -> bytes: ...
|
|
||||||
def get_hash(self) -> bytes32: ...
|
|
||||||
def to_json_dict(self) -> Dict[str, Any]: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_json_dict(o: Dict[str, Any]) -> G1Element: ...
|
|
||||||
|
|
||||||
class G2Element:
|
|
||||||
SIZE: ClassVar[int] = ...
|
|
||||||
def __new__(cls) -> G2Element: ...
|
|
||||||
def get_fingerprint(self) -> int: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes_unchecked(b: bytes) -> G2Element: ...
|
|
||||||
def pair(self, other: G1Element) -> GTElement: ...
|
|
||||||
@staticmethod
|
|
||||||
def generator() -> G2Element: ...
|
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def __str__(self) -> str: ...
|
|
||||||
def __repr__(self) -> str: ...
|
|
||||||
def __richcmp__(self) -> bool: ...
|
|
||||||
def __deepcopy__(self) -> G2Element: ...
|
|
||||||
def __copy__(self) -> G2Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes(bytes) -> G2Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def parse_rust(ReadableBuffer) -> Tuple[G2Element, int]: ...
|
|
||||||
def to_bytes(self) -> bytes: ...
|
|
||||||
def __bytes__(self) -> bytes: ...
|
|
||||||
def get_hash(self) -> bytes32: ...
|
|
||||||
def to_json_dict(self) -> Dict[str, Any]: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_json_dict(o: Dict[str, Any]) -> G2Element: ...
|
|
||||||
|
|
||||||
class GTElement:
|
|
||||||
SIZE: ClassVar[int] = ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes_unchecked(b: bytes) -> GTElement: ...
|
|
||||||
def __mul__(self, rhs: GTElement) -> GTElement: ...
|
|
||||||
def __imul__(self, rhs: GTElement) -> None: ...
|
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def __str__(self) -> str: ...
|
|
||||||
def __repr__(self) -> str: ...
|
|
||||||
def __richcmp__(self) -> bool: ...
|
|
||||||
def __deepcopy__(self) -> GTElement: ...
|
|
||||||
def __copy__(self) -> GTElement: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes(bytes) -> GTElement: ...
|
|
||||||
@staticmethod
|
|
||||||
def parse_rust(ReadableBuffer) -> Tuple[GTElement, int]: ...
|
|
||||||
def to_bytes(self) -> bytes: ...
|
|
||||||
def __bytes__(self) -> bytes: ...
|
|
||||||
def get_hash(self) -> bytes32: ...
|
|
||||||
def to_json_dict(self) -> Dict[str, Any]: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_json_dict(o: Dict[str, Any]) -> GTElement: ...
|
|
||||||
|
|
||||||
class PrivateKey:
|
|
||||||
PRIVATE_KEY_SIZE: ClassVar[int] = ...
|
|
||||||
def sign_g2(self, msg: bytes, dst: bytes) -> G2Element: ...
|
|
||||||
def get_g1(self) -> G1Element: ...
|
|
||||||
def __hash__(self) -> int: ...
|
|
||||||
def __str__(self) -> str: ...
|
|
||||||
def __repr__(self) -> str: ...
|
|
||||||
def __richcmp__(self) -> bool: ...
|
|
||||||
def __deepcopy__(self) -> PrivateKey: ...
|
|
||||||
def __copy__(self) -> PrivateKey: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_bytes(bytes) -> PrivateKey: ...
|
|
||||||
@staticmethod
|
|
||||||
def parse_rust(ReadableBuffer) -> Tuple[PrivateKey, int]: ...
|
|
||||||
def to_bytes(self) -> bytes: ...
|
|
||||||
def __bytes__(self) -> bytes: ...
|
|
||||||
def get_hash(self) -> bytes32: ...
|
|
||||||
def to_json_dict(self) -> Dict[str, Any]: ...
|
|
||||||
@staticmethod
|
|
||||||
def from_json_dict(o: Dict[str, Any]) -> PrivateKey: ...
|
|
||||||
|
|
||||||
class AugSchemeMPL:
|
|
||||||
@staticmethod
|
|
||||||
def sign(pk: PrivateKey, msg: bytes, prepend_pk: G1Element = None) -> G2Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def aggregate(sigs: Sequence[G2Element]) -> G2Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def verify(pk: G1Element, msg: bytes, sig: G2Element) -> bool: ...
|
|
||||||
@staticmethod
|
|
||||||
def aggregate_verify(pks: Sequence[G1Element], msgs: Sequence[bytes], sig: G2Element) -> bool: ...
|
|
||||||
@staticmethod
|
|
||||||
def key_gen(seed: bytes) -> PrivateKey: ...
|
|
||||||
@staticmethod
|
|
||||||
def g2_from_message(msg: bytes) -> G2Element: ...
|
|
||||||
@staticmethod
|
|
||||||
def derive_child_sk(pk: PrivateKey, index: int) -> PrivateKey: ...
|
|
||||||
@staticmethod
|
|
||||||
def derive_child_sk_unhardened(pk: PrivateKey, index: int) -> PrivateKey: ...
|
|
@ -1,9 +0,0 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="blspy-stubs",
|
|
||||||
packages=["blspy-stubs"],
|
|
||||||
package_data={"blspy-stubs": ["__init__.pyi"]},
|
|
||||||
)
|
|
@ -318,7 +318,7 @@ def search_cmd(
|
|||||||
) -> None:
|
) -> None:
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from blspy import PrivateKey
|
from chia_rs import PrivateKey
|
||||||
|
|
||||||
from .keys_funcs import resolve_derivation_master_key, search_derive
|
from .keys_funcs import resolve_derivation_master_key, search_derive
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ from enum import Enum
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
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.cmds.passphrase_funcs import obtain_current_passphrase
|
||||||
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
||||||
|
@ -8,7 +8,7 @@ from random import randint
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from aiohttp import ClientConnectorError
|
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.cmds_util import get_any_service_client
|
||||||
from chia.cmds.start_funcs import async_start
|
from chia.cmds.start_funcs import async_start
|
||||||
|
@ -5,9 +5,8 @@ import random
|
|||||||
from dataclasses import replace
|
from dataclasses import replace
|
||||||
from typing import Callable, Dict, List, Optional, Tuple
|
from typing import Callable, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import blspy
|
import chia_rs
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element, compute_merkle_set_root
|
||||||
from chia_rs import compute_merkle_set_root
|
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
|
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
@ -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)
|
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 cc_sp_signature is not None
|
||||||
assert rc_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))
|
total_iters = uint128(sub_slot_start_total_iters + ip_iters + (sub_slot_iters if overflow else 0))
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
from blspy import AugSchemeMPL
|
from chia_rs import AugSchemeMPL
|
||||||
|
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
from chia.consensus.blockchain_interface import BlockchainInterface
|
from chia.consensus.blockchain_interface import BlockchainInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
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.coin import Coin
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -7,7 +7,7 @@ from concurrent.futures import Executor
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Awaitable, Callable, Dict, List, Optional, Sequence, Tuple
|
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_header_validation import validate_finished_header_block
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from aiohttp import ClientConnectorError, ClientSession
|
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.cmds.init_funcs import check_keys
|
||||||
from chia.daemon.client import DaemonProxy
|
from chia.daemon.client import DaemonProxy
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass, field
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Type
|
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.cmds.init_funcs import check_keys
|
||||||
from chia.util.errors import KeychainException, KeychainFingerprintNotFound
|
from chia.util.errors import KeychainException, KeychainFingerprintNotFound
|
||||||
|
@ -18,7 +18,7 @@ from pathlib import Path
|
|||||||
from types import FrameType
|
from types import FrameType
|
||||||
from typing import Any, AsyncIterator, Dict, List, Optional, Set, TextIO, Tuple
|
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 typing_extensions import Protocol
|
||||||
|
|
||||||
from chia import __version__
|
from chia import __version__
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
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 clvm.EvalError import EvalError
|
||||||
from typing_extensions import Unpack, final
|
from typing_extensions import Unpack, final
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
||||||
|
|
||||||
import aiohttp
|
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.consensus.constants import ConsensusConstants
|
||||||
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
|
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from blspy import AugSchemeMPL, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G2Element, PrivateKey
|
||||||
|
|
||||||
from chia import __version__
|
from chia import __version__
|
||||||
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
|
from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
|
||||||
|
@ -27,7 +27,7 @@ from typing import (
|
|||||||
final,
|
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_creation import unfinished_block_to_full_block
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
|
@ -10,7 +10,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple
|
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 chiabip158 import PyBIP158
|
||||||
|
|
||||||
from chia.consensus.block_creation import create_unfinished_block
|
from chia.consensus.block_creation import create_unfinished_block
|
||||||
|
@ -6,8 +6,7 @@ from datetime import datetime
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Callable, Dict, Iterator, List, Optional, Tuple
|
from typing import Callable, Dict, Iterator, List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G2Element
|
from chia_rs import AugSchemeMPL, Coin, G2Element
|
||||||
from chia_rs import Coin
|
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
from chia.full_node.fee_estimation import FeeMempoolInfo, MempoolInfo, MempoolItemInfo
|
from chia.full_node.fee_estimation import FeeMempoolInfo, MempoolInfo, MempoolItemInfo
|
||||||
|
@ -9,8 +9,7 @@ from dataclasses import dataclass
|
|||||||
from multiprocessing.context import BaseContext
|
from multiprocessing.context import BaseContext
|
||||||
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, TypeVar
|
from typing import Awaitable, Callable, Dict, List, Optional, Set, Tuple, TypeVar
|
||||||
|
|
||||||
from blspy import GTElement
|
from chia_rs import ELIGIBLE_FOR_DEDUP, GTElement
|
||||||
from chia_rs import ELIGIBLE_FOR_DEDUP
|
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
|
|
||||||
from chia.consensus.block_record import BlockRecordProtocol
|
from chia.consensus.block_record import BlockRecordProtocol
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional, Tuple
|
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.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters
|
||||||
from chia.harvester.harvester import Harvester
|
from chia.harvester.harvester import Harvester
|
||||||
|
@ -8,7 +8,7 @@ from math import ceil
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, ItemsView, KeysView, List, Optional, Tuple, ValuesView
|
from typing import Dict, ItemsView, KeysView, List, Optional, Tuple, ValuesView
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from chiapos import DiskProver
|
from chiapos import DiskProver
|
||||||
|
|
||||||
from chia.plotting.util import parse_plot_info
|
from chia.plotting.util import parse_plot_info
|
||||||
|
@ -9,7 +9,7 @@ from threading import Lock
|
|||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from chiapos import Verifier
|
from chiapos import Verifier
|
||||||
|
|
||||||
from chia.plotting.manager import PlotManager
|
from chia.plotting.manager import PlotManager
|
||||||
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Tuple
|
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 chiapos import DiskPlotter
|
||||||
|
|
||||||
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
|
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
|
||||||
|
@ -8,7 +8,7 @@ from concurrent.futures.thread import ThreadPoolExecutor
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
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 chiapos import DiskProver, decompressor_context_queue
|
||||||
|
|
||||||
from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size
|
from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size
|
||||||
|
@ -6,7 +6,7 @@ from enum import Enum, IntEnum
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
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 chiapos import DiskProver
|
||||||
from typing_extensions import final
|
from typing_extensions import final
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.util.byte_types import hexstr_to_bytes
|
from chia.util.byte_types import hexstr_to_bytes
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from clvm.casts import int_from_bytes, int_to_bytes
|
from clvm.casts import int_from_bytes, int_to_bytes
|
||||||
|
|
||||||
from chia.clvm.singleton import SINGLETON_LAUNCHER
|
from chia.clvm.singleton import SINGLETON_LAUNCHER
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
||||||
|
|
||||||
from blspy import G1Element, G2Element, PrivateKey
|
from chia_rs import G1Element, G2Element, PrivateKey
|
||||||
from typing_extensions import final
|
from typing_extensions import final
|
||||||
|
|
||||||
from chia.clvm.singleton import SINGLETON_LAUNCHER
|
from chia.clvm.singleton import SINGLETON_LAUNCHER
|
||||||
|
@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION
|
from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.pool_target import PoolTarget
|
from chia.types.blockchain_format.pool_target import PoolTarget
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -7,7 +7,7 @@ import zlib
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, ClassVar, Dict, List, Optional, Set, Tuple, Union
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
||||||
from clvm_tools.binutils import assemble
|
from clvm_tools.binutils import assemble
|
||||||
|
|
||||||
from chia.consensus.block_rewards import calculate_base_farmer_reward
|
from chia.consensus.block_rewards import calculate_base_farmer_reward
|
||||||
|
@ -15,8 +15,15 @@ from dataclasses import dataclass, replace
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import (
|
||||||
from chia_rs import ALLOW_BACKREFS, MEMPOOL_MODE, compute_merkle_set_root
|
ALLOW_BACKREFS,
|
||||||
|
MEMPOOL_MODE,
|
||||||
|
AugSchemeMPL,
|
||||||
|
G1Element,
|
||||||
|
G2Element,
|
||||||
|
PrivateKey,
|
||||||
|
compute_merkle_set_root,
|
||||||
|
)
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
from clvm.casts import int_from_bytes
|
from clvm.casts import int_from_bytes
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, AsyncGenerator, Dict, Optional, Tuple
|
from typing import Any, AsyncGenerator, Dict, Optional, Tuple
|
||||||
|
|
||||||
from blspy import PrivateKey
|
from chia_rs import PrivateKey
|
||||||
|
|
||||||
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
||||||
from chia.daemon.server import WebSocketServer, daemon_launch_lock_path
|
from chia.daemon.server import WebSocketServer, daemon_launch_lock_path
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
||||||
from clvm.casts import int_from_bytes, int_to_bytes
|
from clvm.casts import int_from_bytes, int_to_bytes
|
||||||
|
|
||||||
from chia.consensus.constants import ConsensusConstants
|
from chia.consensus.constants import ConsensusConstants
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.pool_target import PoolTarget
|
from chia.types.blockchain_format.pool_target import PoolTarget
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Optional, cast
|
from typing import Optional, cast
|
||||||
|
|
||||||
from bitstring import BitArray
|
from bitstring import BitArray
|
||||||
from blspy import AugSchemeMPL, G1Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, PrivateKey
|
||||||
from chiapos import Verifier
|
from chiapos import Verifier
|
||||||
|
|
||||||
from chia.consensus.constants import ConsensusConstants
|
from chia.consensus.constants import ConsensusConstants
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -4,7 +4,7 @@ import warnings
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Dict, List, cast
|
from typing import Any, Dict, List, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G2Element
|
from chia_rs import AugSchemeMPL, G2Element
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
import functools
|
import functools
|
||||||
from typing import Dict, List, Optional, Sequence
|
from typing import Dict, List, Optional, Sequence
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, GTElement
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, GTElement
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
from chia.types.blockchain_format.sized_bytes import bytes32, bytes48
|
||||||
from chia.util.hash import std_hash
|
from chia.util.hash import std_hash
|
||||||
|
@ -4,8 +4,7 @@ import io
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Callable, List, Optional, Tuple
|
from typing import Callable, List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element, serialized_length
|
||||||
from chia_rs import serialized_length
|
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
|
@ -9,7 +9,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
|||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from bitstring import BitArray # pyright: reportMissingImports=false
|
from bitstring import BitArray # pyright: reportMissingImports=false
|
||||||
from blspy import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false
|
from chia_rs import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false
|
||||||
from typing_extensions import final
|
from typing_extensions import final
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -23,7 +23,6 @@ from typing import (
|
|||||||
get_type_hints,
|
get_type_hints,
|
||||||
)
|
)
|
||||||
|
|
||||||
from blspy import G1Element, G2Element, PrivateKey
|
|
||||||
from typing_extensions import Literal, get_args, get_origin
|
from typing_extensions import Literal, get_args, get_origin
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
@ -82,16 +81,7 @@ class ConversionError(StreamableError):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# TODO: Remove hack, this allows streaming these objects from binary
|
|
||||||
size_hints = {
|
|
||||||
"PrivateKey": PrivateKey.PRIVATE_KEY_SIZE,
|
|
||||||
"G1Element": G1Element.SIZE,
|
|
||||||
"G2Element": G2Element.SIZE,
|
|
||||||
}
|
|
||||||
unhashable_types = [
|
unhashable_types = [
|
||||||
"PrivateKey",
|
|
||||||
"G1Element",
|
|
||||||
"G2Element",
|
|
||||||
"Program",
|
"Program",
|
||||||
"SerializedProgram",
|
"SerializedProgram",
|
||||||
]
|
]
|
||||||
@ -402,15 +392,6 @@ def parse_tuple(f: BinaryIO, list_parse_inner_type_f: List[ParseFunctionType]) -
|
|||||||
return tuple(full_list)
|
return tuple(full_list)
|
||||||
|
|
||||||
|
|
||||||
def parse_size_hints(f: BinaryIO, f_type: Type[Any], bytes_to_read: int, unchecked: bool) -> Any:
|
|
||||||
bytes_read = f.read(bytes_to_read)
|
|
||||||
assert bytes_read is not None and len(bytes_read) == bytes_to_read
|
|
||||||
if unchecked:
|
|
||||||
return f_type.from_bytes_unchecked(bytes_read)
|
|
||||||
else:
|
|
||||||
return f_type.from_bytes(bytes_read)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_str(f: BinaryIO) -> str:
|
def parse_str(f: BinaryIO) -> str:
|
||||||
str_size = parse_uint32(f)
|
str_size = parse_uint32(f)
|
||||||
str_read_bytes = f.read(str_size)
|
str_read_bytes = f.read(str_size)
|
||||||
@ -445,12 +426,6 @@ def function_to_parse_one_item(f_type: Type[Any]) -> ParseFunctionType:
|
|||||||
inner_types = get_args(f_type)
|
inner_types = get_args(f_type)
|
||||||
list_parse_inner_type_f = [function_to_parse_one_item(_) for _ in inner_types]
|
list_parse_inner_type_f = [function_to_parse_one_item(_) for _ in inner_types]
|
||||||
return lambda f: parse_tuple(f, list_parse_inner_type_f)
|
return lambda f: parse_tuple(f, list_parse_inner_type_f)
|
||||||
if hasattr(f_type, "from_bytes_unchecked") and f_type.__name__ in size_hints:
|
|
||||||
bytes_to_read = size_hints[f_type.__name__]
|
|
||||||
return lambda f: parse_size_hints(f, f_type, bytes_to_read, unchecked=True)
|
|
||||||
if hasattr(f_type, "from_bytes") and f_type.__name__ in size_hints:
|
|
||||||
bytes_to_read = size_hints[f_type.__name__]
|
|
||||||
return lambda f: parse_size_hints(f, f_type, bytes_to_read, unchecked=False)
|
|
||||||
if f_type is str:
|
if f_type is str:
|
||||||
return parse_str
|
return parse_str
|
||||||
raise UnsupportedType(f"Type {f_type} does not have parse")
|
raise UnsupportedType(f"Type {f_type} does not have parse")
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
from typing import Iterator, List, Optional
|
from typing import Iterator, List, Optional
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin, coin_as_list
|
from chia.types.blockchain_format.coin import Coin, coin_as_list
|
||||||
from chia.types.blockchain_format.program import INFINITE_COST, Program
|
from chia.types.blockchain_format.program import INFINITE_COST, Program
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack
|
||||||
|
|
||||||
from chia.server.ws_connection import WSChiaConnection
|
from chia.server.ws_connection import WSChiaConnection
|
||||||
|
@ -5,7 +5,7 @@ import time
|
|||||||
from secrets import token_bytes
|
from secrets import token_bytes
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, List, Optional, Set, Tuple, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, List, Optional, Set, Tuple, cast
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.server.ws_connection import WSChiaConnection
|
from chia.server.ws_connection import WSChiaConnection
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
|
@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
|
|||||||
from dataclasses import dataclass, fields, replace
|
from dataclasses import dataclass, fields, replace
|
||||||
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union, final, get_type_hints
|
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union, final, get_type_hints
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from clvm.casts import int_from_bytes, int_to_bytes
|
from clvm.casts import int_from_bytes, int_to_bytes
|
||||||
|
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
@ -37,7 +37,7 @@ class AggSigParent(Condition):
|
|||||||
parent_id: Optional[bytes32] = None
|
parent_id: Optional[bytes32] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -58,7 +58,7 @@ class AggSigPuzzle(Condition):
|
|||||||
puzzle_hash: Optional[bytes32] = None
|
puzzle_hash: Optional[bytes32] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PUZZLE, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PUZZLE, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -79,7 +79,7 @@ class AggSigAmount(Condition):
|
|||||||
amount: Optional[uint64] = None
|
amount: Optional[uint64] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_AMOUNT, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_AMOUNT, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -101,7 +101,7 @@ class AggSigPuzzleAmount(Condition):
|
|||||||
amount: Optional[uint64] = None
|
amount: Optional[uint64] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PUZZLE_AMOUNT, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PUZZLE_AMOUNT, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -129,7 +129,7 @@ class AggSigParentAmount(Condition):
|
|||||||
amount: Optional[uint64] = None
|
amount: Optional[uint64] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT_AMOUNT, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT_AMOUNT, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -157,7 +157,7 @@ class AggSigParentPuzzle(Condition):
|
|||||||
puzzle_hash: Optional[bytes32] = None
|
puzzle_hash: Optional[bytes32] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT_PUZZLE, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_PARENT_PUZZLE, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -183,7 +183,7 @@ class AggSigUnsafe(Condition):
|
|||||||
msg: bytes
|
msg: bytes
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_UNSAFE, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_UNSAFE, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -204,7 +204,7 @@ class AggSigMe(Condition):
|
|||||||
additional_data: Optional[bytes32] = None
|
additional_data: Optional[bytes32] = None
|
||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
condition: Program = Program.to([ConditionOpcode.AGG_SIG_ME, self.pubkey, self.msg])
|
condition: Program = Program.to([ConditionOpcode.AGG_SIG_ME, self.pubkey.to_bytes(), self.msg])
|
||||||
return condition
|
return condition
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -757,7 +757,7 @@ class AggSig(Condition):
|
|||||||
|
|
||||||
def to_program(self) -> Program:
|
def to_program(self) -> Program:
|
||||||
# We know we are an agg sig or we want to error
|
# We know we are an agg sig or we want to error
|
||||||
return CONDITION_DRIVERS[self.opcode](self.pubkey, self.msg).to_program() # type: ignore[call-arg]
|
return CONDITION_DRIVERS[self.opcode](self.pubkey.to_bytes(), self.msg).to_program() # type: ignore[call-arg]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_program(cls, program: Program, **kwargs: Optional[Union[uint64, bytes32]]) -> AggSig:
|
def from_program(cls, program: Program, **kwargs: Optional[Union[uint64, bytes32]]) -> AggSig:
|
||||||
|
@ -9,7 +9,7 @@ import time
|
|||||||
from secrets import token_bytes
|
from secrets import token_bytes
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
from clvm.casts import int_from_bytes
|
from clvm.casts import int_from_bytes
|
||||||
|
|
||||||
import chia.wallet.singleton
|
import chia.wallet.singleton
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.util.ints import uint32
|
from chia.util.ints import uint32
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import List, Optional, Set, Tuple
|
from typing import List, Optional, Set, Tuple
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, PrivateKey
|
||||||
|
|
||||||
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
from chia.consensus.coinbase import create_puzzlehash_for_pk
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
|
@ -7,7 +7,7 @@ import re
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
|
|
||||||
from chia.protocols.wallet_protocol import CoinState
|
from chia.protocols.wallet_protocol import CoinState
|
||||||
from chia.server.ws_connection import WSChiaConnection
|
from chia.server.ws_connection import WSChiaConnection
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Dict, Iterator, List, Optional, Tuple
|
from typing import Dict, Iterator, List, Optional, Tuple
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -7,7 +7,7 @@ import math
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Type, TypeVar, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Type, TypeVar, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
from clvm.casts import int_from_bytes, int_to_bytes
|
from clvm.casts import int_from_bytes, int_to_bytes
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import dataclasses
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, List, Optional, Set, Tuple
|
from typing import Any, Dict, List, Optional, Set, Tuple
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.protocols.wallet_protocol import CoinState
|
from chia.protocols.wallet_protocol import CoinState
|
||||||
from chia.types.announcement import Announcement
|
from chia.types.announcement import Announcement
|
||||||
|
@ -60,7 +60,7 @@ from __future__ import annotations
|
|||||||
import hashlib
|
import hashlib
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from blspy import G1Element, PrivateKey
|
from chia_rs import G1Element, PrivateKey
|
||||||
from clvm.casts import int_from_bytes
|
from clvm.casts import int_from_bytes
|
||||||
|
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
from clvm_tools import binutils
|
from clvm_tools import binutils
|
||||||
|
|
||||||
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
||||||
|
@ -3,8 +3,7 @@ from __future__ import annotations
|
|||||||
import inspect
|
import inspect
|
||||||
from typing import Any, Callable, List
|
from typing import Any, Callable, List
|
||||||
|
|
||||||
import blspy
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
from blspy import AugSchemeMPL
|
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.types.coin_spend import CoinSpend
|
from chia.types.coin_spend import CoinSpend
|
||||||
@ -18,7 +17,7 @@ async def sign_coin_spends(
|
|||||||
secret_key_for_puzzle_hash: Any, # Potentially awaitable function from bytes32 => Optional[PrivateKey]
|
secret_key_for_puzzle_hash: Any, # Potentially awaitable function from bytes32 => Optional[PrivateKey]
|
||||||
additional_data: bytes,
|
additional_data: bytes,
|
||||||
max_cost: int,
|
max_cost: int,
|
||||||
potential_derivation_functions: List[Callable[[blspy.G1Element], bytes32]],
|
potential_derivation_functions: List[Callable[[G1Element], bytes32]],
|
||||||
) -> SpendBundle:
|
) -> SpendBundle:
|
||||||
"""
|
"""
|
||||||
Sign_coin_spends runs the puzzle code with the given argument and searches the
|
Sign_coin_spends runs the puzzle code with the given argument and searches the
|
||||||
@ -37,15 +36,15 @@ async def sign_coin_spends(
|
|||||||
derived keys (those returned by master_sk_to_wallet_sk from the ['sk'] member of
|
derived keys (those returned by master_sk_to_wallet_sk from the ['sk'] member of
|
||||||
wallet rpc's get_private_key method).
|
wallet rpc's get_private_key method).
|
||||||
"""
|
"""
|
||||||
signatures: List[blspy.G2Element] = []
|
signatures: List[G2Element] = []
|
||||||
pk_list: List[blspy.G1Element] = []
|
pk_list: List[G1Element] = []
|
||||||
msg_list: List[bytes] = []
|
msg_list: List[bytes] = []
|
||||||
for coin_spend in coin_spends:
|
for coin_spend in coin_spends:
|
||||||
# Get AGG_SIG conditions
|
# Get AGG_SIG conditions
|
||||||
conditions_dict = conditions_dict_for_solution(coin_spend.puzzle_reveal, coin_spend.solution, max_cost)
|
conditions_dict = conditions_dict_for_solution(coin_spend.puzzle_reveal, coin_spend.solution, max_cost)
|
||||||
# Create signature
|
# Create signature
|
||||||
for pk_bytes, msg in pkm_pairs_for_conditions_dict(conditions_dict, coin_spend.coin, additional_data):
|
for pk_bytes, msg in pkm_pairs_for_conditions_dict(conditions_dict, coin_spend.coin, additional_data):
|
||||||
pk = blspy.G1Element.from_bytes(pk_bytes)
|
pk = G1Element.from_bytes(pk_bytes)
|
||||||
pk_list.append(pk)
|
pk_list.append(pk)
|
||||||
msg_list.append(msg)
|
msg_list.append(msg)
|
||||||
if inspect.iscoroutinefunction(secret_key_for_public_key_f):
|
if inspect.iscoroutinefunction(secret_key_for_public_key_f):
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, BinaryIO, Dict, List, Optional, Set, Tuple, Union
|
from typing import Any, BinaryIO, Dict, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
from clvm_tools.binutils import disassemble
|
from clvm_tools.binutils import disassemble
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element
|
from chia_rs import AugSchemeMPL, G1Element
|
||||||
from clvm import KEYWORD_FROM_ATOM
|
from clvm import KEYWORD_FROM_ATOM
|
||||||
from clvm_tools.binutils import disassemble as bu_disassemble
|
from clvm_tools.binutils import disassemble as bu_disassemble
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple
|
||||||
|
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack
|
||||||
|
|
||||||
from chia.server.ws_connection import WSChiaConnection
|
from chia.server.ws_connection import WSChiaConnection
|
||||||
|
@ -6,7 +6,7 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, Type, TypeVar, Union
|
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, Type, TypeVar, Union
|
||||||
|
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, cast
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
from typing_extensions import Unpack
|
from typing_extensions import Unpack
|
||||||
|
|
||||||
from chia.types.announcement import Announcement
|
from chia.types.announcement import Announcement
|
||||||
|
@ -12,7 +12,7 @@ from pathlib import Path
|
|||||||
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast
|
||||||
|
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
|
||||||
from chia.consensus.blockchain import AddBlockResult
|
from chia.consensus.blockchain import AddBlockResult
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING, List, Optional, Set, Tuple, TypeVar
|
from typing import TYPE_CHECKING, List, Optional, Set, Tuple, TypeVar
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from typing_extensions import NotRequired, Protocol, TypedDict
|
from typing_extensions import NotRequired, Protocol, TypedDict
|
||||||
|
|
||||||
from chia.server.ws_connection import WSChiaConnection
|
from chia.server.ws_connection import WSChiaConnection
|
||||||
|
@ -4,7 +4,7 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
from typing import Dict, List, Optional, Set
|
from typing import Dict, List, Optional, Set
|
||||||
|
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.util.db_wrapper import DBWrapper2, execute_fetchone
|
from chia.util.db_wrapper import DBWrapper2, execute_fetchone
|
||||||
|
@ -24,7 +24,7 @@ from typing import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
from blspy import G1Element, G2Element, PrivateKey
|
from chia_rs import G1Element, G2Element, PrivateKey
|
||||||
|
|
||||||
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
||||||
from chia.consensus.coinbase import farmer_parent_id, pool_parent_id
|
from chia.consensus.coinbase import farmer_parent_id, pool_parent_id
|
||||||
|
@ -20,7 +20,6 @@ usage() {
|
|||||||
|
|
||||||
PACMAN_AUTOMATED=
|
PACMAN_AUTOMATED=
|
||||||
EXTRAS=
|
EXTRAS=
|
||||||
BLSPY_STUBS=
|
|
||||||
SKIP_PACKAGE_INSTALL=
|
SKIP_PACKAGE_INSTALL=
|
||||||
PLOTTER_INSTALL=
|
PLOTTER_INSTALL=
|
||||||
EDITABLE='-e'
|
EDITABLE='-e'
|
||||||
@ -31,7 +30,7 @@ do
|
|||||||
# automated
|
# automated
|
||||||
a) PACMAN_AUTOMATED=--noconfirm;;
|
a) PACMAN_AUTOMATED=--noconfirm;;
|
||||||
# development
|
# development
|
||||||
d) EXTRAS=${EXTRAS}dev,;BLSPY_STUBS=1;;
|
d) EXTRAS=${EXTRAS}dev,;;
|
||||||
# non-editable
|
# non-editable
|
||||||
i) EDITABLE='';;
|
i) EDITABLE='';;
|
||||||
# legacy keyring
|
# legacy keyring
|
||||||
@ -335,10 +334,6 @@ python -m pip install wheel
|
|||||||
python -m pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
python -m pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
||||||
python -m pip install ${EDITABLE} ."${EXTRAS}" --extra-index-url https://pypi.chia.net/simple/
|
python -m pip install ${EDITABLE} ."${EXTRAS}" --extra-index-url https://pypi.chia.net/simple/
|
||||||
|
|
||||||
if [ -n "$BLSPY_STUBS" ]; then
|
|
||||||
python -m pip install ${EDITABLE} ./blspy-stubs
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$PLOTTER_INSTALL" ]; then
|
if [ -n "$PLOTTER_INSTALL" ]; then
|
||||||
set +e
|
set +e
|
||||||
PREV_VENV="$VIRTUAL_ENV"
|
PREV_VENV="$VIRTUAL_ENV"
|
||||||
|
3
pylintrc
3
pylintrc
@ -279,8 +279,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
|
|||||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||||
# and thus existing member attributes cannot be deduced by static analysis. It
|
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||||
# supports qualified module names, as well as Unix pattern matching.
|
# supports qualified module names, as well as Unix pattern matching.
|
||||||
ignored-modules=blspy,
|
ignored-modules=chiabip158,
|
||||||
chiabip158,
|
|
||||||
chiapos,
|
chiapos,
|
||||||
chiavdf,
|
chiavdf,
|
||||||
chia_rs,
|
chia_rs,
|
||||||
|
1
setup.py
1
setup.py
@ -8,7 +8,6 @@ from setuptools import find_packages, setup
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"aiofiles==23.2.1", # Async IO for files
|
"aiofiles==23.2.1", # Async IO for files
|
||||||
"anyio==4.0.0",
|
"anyio==4.0.0",
|
||||||
"blspy==2.0.2", # Signature library
|
|
||||||
"boto3==1.28.65", # AWS S3 for DL s3 plugin
|
"boto3==1.28.65", # AWS S3 for DL s3 plugin
|
||||||
"chiavdf==1.1.0", # timelord and vdf verification
|
"chiavdf==1.1.0", # timelord and vdf verification
|
||||||
"chiabip158==1.3", # bip158-style wallet filters
|
"chiabip158==1.3", # bip158-style wallet filters
|
||||||
|
@ -10,7 +10,7 @@ from dataclasses import replace
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL, G2Element
|
from chia_rs import AugSchemeMPL, G2Element
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
|
|
||||||
from chia.consensus.block_header_validation import validate_finished_header_block
|
from chia.consensus.block_header_validation import validate_finished_header_block
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Callable, SupportsBytes
|
from typing import Callable, SupportsBytes
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import G1Element, G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Iterable, List, Tuple
|
from typing import Iterable, List, Tuple
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
||||||
|
|
||||||
from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client
|
from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.clvm.spend_sim import sim_and_client
|
from chia.clvm.spend_sim import sim_and_client
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -6,8 +6,7 @@ from dataclasses import dataclass, field
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, AsyncIterator, Dict, Iterable, List, Optional, Tuple, Type, Union, cast
|
from typing import Any, AsyncIterator, Dict, Iterable, List, Optional, Tuple, Type, Union, cast
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import Coin, G2Element
|
||||||
from chia_rs import Coin
|
|
||||||
|
|
||||||
import chia.cmds.wallet_funcs
|
import chia.cmds.wallet_funcs
|
||||||
from chia.cmds.chia import cli as chia_cli
|
from chia.cmds.chia import cli as chia_cli
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import Coin, G2Element
|
||||||
from chia_rs import Coin
|
|
||||||
|
|
||||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||||
from chia.types.spend_bundle import SpendBundle
|
from chia.types.spend_bundle import SpendBundle
|
||||||
|
@ -3,8 +3,7 @@ from __future__ import annotations
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union, cast
|
from typing import Any, Dict, List, Optional, Tuple, Union, cast
|
||||||
|
|
||||||
from blspy import G2Element
|
from chia_rs import Coin, G2Element
|
||||||
from chia_rs import Coin
|
|
||||||
|
|
||||||
from chia.server.outbound_message import NodeType
|
from chia.server.outbound_message import NodeType
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
from chia.types.blockchain_format.proof_of_space import ProofOfSpace, passes_plot_filter, verify_and_get_quality_string
|
from chia.types.blockchain_format.proof_of_space import ProofOfSpace, passes_plot_filter, verify_and_get_quality_string
|
||||||
|
@ -6,7 +6,7 @@ import unittest
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
|
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
from chia.types.blockchain_format.program import Program
|
from chia.types.blockchain_format.program import Program
|
||||||
|
@ -9,7 +9,7 @@ import logging
|
|||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
from clvm_tools.binutils import assemble
|
from clvm_tools.binutils import assemble
|
||||||
|
|
||||||
from chia.simulator.block_tools import BlockTools
|
from chia.simulator.block_tools import BlockTools
|
||||||
|
@ -9,7 +9,7 @@ import time
|
|||||||
from typing import Coroutine, Dict, List, Optional, Tuple
|
from typing import Coroutine, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G2Element, PrivateKey
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
|
|
||||||
from chia.consensus.pot_iterations import is_overflow_block
|
from chia.consensus.pot_iterations import is_overflow_block
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
import blspy
|
from chia_rs import G1Element, G2Element, PrivateKey
|
||||||
|
|
||||||
from chia.full_node.bundle_tools import simple_solution_generator
|
from chia.full_node.bundle_tools import simple_solution_generator
|
||||||
from chia.types.blockchain_format.coin import Coin
|
from chia.types.blockchain_format.coin import Coin
|
||||||
@ -18,14 +18,14 @@ from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_
|
|||||||
GROUP_ORDER = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001
|
GROUP_ORDER = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001
|
||||||
|
|
||||||
|
|
||||||
def int_to_public_key(index: int) -> blspy.G1Element:
|
def int_to_public_key(index: int) -> G1Element:
|
||||||
index = index % GROUP_ORDER
|
index = index % GROUP_ORDER
|
||||||
private_key_from_int = blspy.PrivateKey.from_bytes(index.to_bytes(32, "big"))
|
private_key_from_int = PrivateKey.from_bytes(index.to_bytes(32, "big"))
|
||||||
return private_key_from_int.get_g1()
|
return private_key_from_int.get_g1()
|
||||||
|
|
||||||
|
|
||||||
def puzzle_hash_for_index(index: int, puzzle_hash_db: dict) -> bytes32:
|
def puzzle_hash_for_index(index: int, puzzle_hash_db: dict) -> bytes32:
|
||||||
public_key: blspy.G1Element = int_to_public_key(index)
|
public_key: G1Element = int_to_public_key(index)
|
||||||
puzzle: Program = puzzle_for_pk(public_key)
|
puzzle: Program = puzzle_for_pk(public_key)
|
||||||
puzzle_hash: bytes32 = puzzle.get_tree_hash()
|
puzzle_hash: bytes32 = puzzle.get_tree_hash()
|
||||||
puzzle_hash_db[puzzle_hash] = puzzle
|
puzzle_hash_db[puzzle_hash] = puzzle
|
||||||
@ -61,7 +61,7 @@ def make_spend_bundle(count: int) -> SpendBundle:
|
|||||||
coin_spend = CoinSpend(coin, puzzle_reveal, solution)
|
coin_spend = CoinSpend(coin, puzzle_reveal, solution)
|
||||||
coin_spends.append(coin_spend)
|
coin_spends.append(coin_spend)
|
||||||
|
|
||||||
spend_bundle = SpendBundle(coin_spends, blspy.G2Element())
|
spend_bundle = SpendBundle(coin_spends, G2Element())
|
||||||
return spend_bundle
|
return spend_bundle
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import random
|
|||||||
from typing import Callable, Dict, List, Optional, Tuple
|
from typing import Callable, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G2Element
|
from chia_rs import G2Element
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
from clvm_tools import binutils
|
from clvm_tools import binutils
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Tuple
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element, G2Element
|
from chia_rs import ELIGIBLE_FOR_DEDUP, G1Element, G2Element
|
||||||
from chia_rs import ELIGIBLE_FOR_DEDUP
|
|
||||||
from chiabip158 import PyBIP158
|
from chiabip158 import PyBIP158
|
||||||
|
|
||||||
from chia.consensus.constants import ConsensusConstants
|
from chia.consensus.constants import ConsensusConstants
|
||||||
|
@ -5,7 +5,7 @@ import pathlib
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from clvm_tools import binutils
|
from clvm_tools import binutils
|
||||||
|
|
||||||
from chia.consensus.condition_costs import ConditionCost
|
from chia.consensus.condition_costs import ConditionCost
|
||||||
|
@ -4,8 +4,7 @@ from __future__ import annotations
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL
|
from chia_rs import AugSchemeMPL
|
||||||
from chia_rs import CoinSpend
|
|
||||||
from clvm.casts import int_to_bytes
|
from clvm.casts import int_to_bytes
|
||||||
|
|
||||||
from chia.consensus.block_record import BlockRecord
|
from chia.consensus.block_record import BlockRecord
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from blspy import AugSchemeMPL, G1Element
|
from chia_rs import AugSchemeMPL, G1Element
|
||||||
|
|
||||||
from chia.util import cached_bls
|
from chia.util import cached_bls
|
||||||
from chia.util.hash import std_hash
|
from chia.util.hash import std_hash
|
||||||
|
@ -7,7 +7,7 @@ from dataclasses import replace
|
|||||||
from typing import Callable, List, Optional, Tuple
|
from typing import Callable, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL, G1Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, PrivateKey
|
||||||
|
|
||||||
import tests
|
import tests
|
||||||
from chia.simulator.keyring import TempKeyring
|
from chia.simulator.keyring import TempKeyring
|
||||||
|
@ -6,7 +6,7 @@ from dataclasses import dataclass, field, fields
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, get_type_hints
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, get_type_hints
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
from clvm_tools import binutils
|
from clvm_tools import binutils
|
||||||
from typing_extensions import Literal, get_args
|
from typing_extensions import Literal, get_args
|
||||||
|
|
||||||
@ -35,7 +35,6 @@ from chia.util.streamable import (
|
|||||||
parse_bytes,
|
parse_bytes,
|
||||||
parse_list,
|
parse_list,
|
||||||
parse_optional,
|
parse_optional,
|
||||||
parse_size_hints,
|
|
||||||
parse_str,
|
parse_str,
|
||||||
parse_tuple,
|
parse_tuple,
|
||||||
parse_uint32,
|
parse_uint32,
|
||||||
@ -204,35 +203,15 @@ class ConvertUnhashableTypeFailures(Streamable):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"input_dict, error, error_msg",
|
"input_dict, error, error_msg",
|
||||||
[
|
[
|
||||||
pytest.param({"a": 0}, InvalidTypeError, "Invalid type: Expected str, Actual: int"),
|
pytest.param({"a": 0}, TypeError, "invalid input type for PublicKey"),
|
||||||
pytest.param({"a": []}, InvalidTypeError, "Invalid type: Expected str, Actual: list"),
|
pytest.param({"a": []}, ValueError, "PublicKey, invalid length 0 expected 48"),
|
||||||
pytest.param({"a": {}}, InvalidTypeError, "Invalid type: Expected str, Actual: dict"),
|
pytest.param({"a": {}}, TypeError, "invalid input type for PublicKey"),
|
||||||
pytest.param({"a": "invalid"}, ConversionError, "non-hexadecimal number found in fromhex() arg at position 0"),
|
pytest.param({"a": "invalid"}, ValueError, "invalid hex"),
|
||||||
pytest.param(
|
pytest.param({"a": "00" * (G1Element.SIZE - 1)}, ValueError, "PublicKey, invalid length 47 expected 48"),
|
||||||
{"a": "00" * (G1Element.SIZE - 1)},
|
pytest.param({"a": "00" * (G1Element.SIZE + 1)}, ValueError, "PublicKey, invalid length 49 expected 48"),
|
||||||
ConversionError,
|
pytest.param({"a": b"\00" * (G1Element.SIZE - 1)}, ValueError, "PublicKey, invalid length 47 expected 48"),
|
||||||
"from type bytes to G1Element: ValueError: Length of bytes object not equal to G1Element::SIZE",
|
pytest.param({"a": b"\00" * (G1Element.SIZE + 1)}, ValueError, "PublicKey, invalid length 49 expected 48"),
|
||||||
),
|
pytest.param({"a": b"\00" * G1Element.SIZE}, ValueError, "BLS Error G1InfinityInvalidBits"),
|
||||||
pytest.param(
|
|
||||||
{"a": "00" * (G1Element.SIZE + 1)},
|
|
||||||
ConversionError,
|
|
||||||
"from type bytes to G1Element: ValueError: Length of bytes object not equal to G1Element::SIZE",
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
{"a": b"\00" * (G1Element.SIZE - 1)},
|
|
||||||
ConversionError,
|
|
||||||
"from type bytes to G1Element: ValueError: Length of bytes object not equal to G1Element::SIZE",
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
{"a": b"\00" * (G1Element.SIZE + 1)},
|
|
||||||
ConversionError,
|
|
||||||
"from type bytes to G1Element: ValueError: Length of bytes object not equal to G1Element::SIZE",
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
{"a": b"\00" * G1Element.SIZE},
|
|
||||||
ConversionError,
|
|
||||||
"from type bytes to G1Element: ValueError: Given G1 non-infinity element must start with 0b10",
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_convert_unhashable_type_failures(input_dict: Dict[str, Any], error: Any, error_msg: str) -> None:
|
def test_convert_unhashable_type_failures(input_dict: Dict[str, Any], error: Any, error_msg: str) -> None:
|
||||||
@ -282,16 +261,14 @@ def test_convert_primitive_failures(input_dict: Dict[str, Any], error: Any) -> N
|
|||||||
[
|
[
|
||||||
StreamableFromDict1,
|
StreamableFromDict1,
|
||||||
{"a": 1, "b": "2", "c": "asd"},
|
{"a": 1, "b": "2", "c": "asd"},
|
||||||
ConversionError,
|
ValueError,
|
||||||
"Failed to convert 'asd' from type str to bytes: ValueError: non-hexadecimal number found in fromhex() arg "
|
"invalid hex",
|
||||||
"at position 1",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
StreamableFromDict1,
|
StreamableFromDict1,
|
||||||
{"a": 1, "b": "2", "c": "00" * G1Element.SIZE},
|
{"a": 1, "b": "2", "c": "00" * G1Element.SIZE},
|
||||||
ConversionError,
|
ValueError,
|
||||||
f"Failed to convert {bytes.fromhex('00' * G1Element.SIZE)!r} from type bytes to G1Element: ValueError: "
|
"BLS Error G1InfinityInvalidBits",
|
||||||
"Given G1 non-infinity element must start with 0b10",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
StreamableFromDict1,
|
StreamableFromDict1,
|
||||||
@ -321,7 +298,7 @@ def test_convert_primitive_failures(input_dict: Dict[str, Any], error: Any) -> N
|
|||||||
StreamableFromDict2,
|
StreamableFromDict2,
|
||||||
{"a": {"a": 1, "b": "2", "c": G1Element()}, "b": {"a": 1, "b": "2"}},
|
{"a": {"a": 1, "b": "2", "c": G1Element()}, "b": {"a": 1, "b": "2"}},
|
||||||
ParameterMissingError,
|
ParameterMissingError,
|
||||||
"1 field missing for StreamableFromDict1: c",
|
"1 field missing for StreamableFromDict2: c",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
StreamableFromDict2,
|
StreamableFromDict2,
|
||||||
@ -828,18 +805,6 @@ class FailFromBytes:
|
|||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
||||||
|
|
||||||
def test_parse_size_hints() -> None:
|
|
||||||
assert parse_size_hints(io.BytesIO(b"1337"), TestFromBytes, 4, False).b == b"1337"
|
|
||||||
|
|
||||||
# EOF
|
|
||||||
with pytest.raises(AssertionError):
|
|
||||||
parse_size_hints(io.BytesIO(b"133"), TestFromBytes, 4, False)
|
|
||||||
|
|
||||||
# error in underlying type
|
|
||||||
with pytest.raises(ValueError):
|
|
||||||
parse_size_hints(io.BytesIO(b"1337"), FailFromBytes, 4, False)
|
|
||||||
|
|
||||||
|
|
||||||
def test_parse_str() -> None:
|
def test_parse_str() -> None:
|
||||||
assert parse_str(io.BytesIO(b"\x00\x00\x00\x00")) == ""
|
assert parse_str(io.BytesIO(b"\x00\x00\x00\x00")) == ""
|
||||||
assert parse_str(io.BytesIO(b"\x00\x00\x00\x01a")) == "a"
|
assert parse_str(io.BytesIO(b"\x00\x00\x00\x01a")) == "a"
|
||||||
|
@ -8,7 +8,7 @@ from types import TracebackType
|
|||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
|
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
|
||||||
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
||||||
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.cmds.cmds_util import get_any_service_client
|
from chia.cmds.cmds_util import get_any_service_client
|
||||||
from chia.farmer.farmer import Farmer
|
from chia.farmer.farmer import Farmer
|
||||||
|
@ -5,8 +5,7 @@ import logging
|
|||||||
from typing import Callable, List, Optional, Tuple
|
from typing import Callable, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G2Element
|
from chia_rs import Coin, G2Element
|
||||||
from chia_rs import Coin
|
|
||||||
|
|
||||||
from chia.clvm.spend_sim import SimClient, SpendSim, sim_and_client
|
from chia.clvm.spend_sim import SimClient, SpendSim, sim_and_client
|
||||||
from chia.consensus.constants import ConsensusConstants
|
from chia.consensus.constants import ConsensusConstants
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.plot_sync.delta import Delta, DeltaType, PathListDelta, PlotListDelta
|
from chia.plot_sync.delta import Delta, DeltaType, PathListDelta, PlotListDelta
|
||||||
from chia.protocols.harvester_protocol import Plot
|
from chia.protocols.harvester_protocol import Plot
|
||||||
|
@ -8,7 +8,7 @@ from shutil import copy
|
|||||||
from typing import Any, Callable, List, Optional, Tuple
|
from typing import Any, Callable, List, Optional, Tuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.farmer.farmer import Farmer
|
from chia.farmer.farmer import Farmer
|
||||||
from chia.farmer.farmer_api import FarmerAPI
|
from chia.farmer.farmer_api import FarmerAPI
|
||||||
|
@ -7,7 +7,7 @@ import time
|
|||||||
from typing import Any, Callable, List, Tuple, Type, Union
|
from typing import Any, Callable, List, Tuple, Type, Union
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from blspy import G1Element
|
from chia_rs import G1Element
|
||||||
|
|
||||||
from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size
|
from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size
|
||||||
from chia.plot_sync.delta import Delta
|
from chia.plot_sync.delta import Delta
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user