diff --git a/chia/_tests/core/consensus/test_pot_iterations.py b/chia/_tests/core/consensus/test_pot_iterations.py index 0f93ed8b621e..12dfb7dd3d90 100644 --- a/chia/_tests/core/consensus/test_pot_iterations.py +++ b/chia/_tests/core/consensus/test_pot_iterations.py @@ -5,10 +5,10 @@ calculate_sp_iters, is_overflow_block, ) +from chia_rs import expected_plot_size as _expected_plot_size from pytest import raises from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.pos_quality import _expected_plot_size from chia.consensus.pot_iterations import ( calculate_iterations_quality, ) diff --git a/chia/_tests/plot_sync/test_receiver.py b/chia/_tests/plot_sync/test_receiver.py index a291664de98c..0f175b52633d 100644 --- a/chia/_tests/plot_sync/test_receiver.py +++ b/chia/_tests/plot_sync/test_receiver.py @@ -8,9 +8,10 @@ import pytest from chia_rs import G1Element +from chia_rs import expected_plot_size as _expected_plot_size from chia._tests.plot_sync.util import get_dummy_connection -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 from chia.plot_sync.delta import Delta from chia.plot_sync.receiver import Receiver, Sync, get_list_or_len from chia.plot_sync.util import ErrorCodes, State diff --git a/chia/consensus/pos_quality.py b/chia/consensus/pos_quality.py index 4a5b12464925..37a70f76c032 100644 --- a/chia/consensus/pos_quality.py +++ b/chia/consensus/pos_quality.py @@ -1,19 +1,5 @@ from __future__ import annotations -from chia.util.ints import uint64 - # The actual space in bytes of a plot, is _expected_plot_size(k) * UI_ACTUAL_SPACE_CONSTANT_FACTO # This is not used in consensus, only for display purposes UI_ACTUAL_SPACE_CONSTANT_FACTOR = 0.78 - - -def _expected_plot_size(k: int) -> uint64: - """ - Given the plot size parameter k (which is between 32 and 59), computes the - expected size of the plot in bytes (times a constant factor). This is based on efficient encoding - of the plot, and aims to be scale agnostic, so larger plots don't - necessarily get more rewards per byte. The +1 is added to give half a bit more space per entry, which - is necessary to store the entries in the plot. - """ - - return uint64(((2 * k) + 1) * (2 ** (k - 1))) diff --git a/chia/consensus/pot_iterations.py b/chia/consensus/pot_iterations.py index b399539859b8..ebcff9dadb26 100644 --- a/chia/consensus/pot_iterations.py +++ b/chia/consensus/pot_iterations.py @@ -1,6 +1,7 @@ from __future__ import annotations -from chia.consensus.pos_quality import _expected_plot_size +from chia_rs import expected_plot_size as _expected_plot_size + from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.hash import std_hash from chia.util.ints import uint64, uint128 diff --git a/chia/plot_sync/receiver.py b/chia/plot_sync/receiver.py index 0379a446426a..4043794fd502 100644 --- a/chia/plot_sync/receiver.py +++ b/chia/plot_sync/receiver.py @@ -6,9 +6,10 @@ from dataclasses import dataclass, field from typing import Any, Callable, Optional, Union +from chia_rs import expected_plot_size as _expected_plot_size from typing_extensions import Protocol -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 from chia.plot_sync.delta import Delta, PathListDelta, PlotListDelta from chia.plot_sync.exceptions import ( InvalidIdentifierError, diff --git a/chia/plotting/manager.py b/chia/plotting/manager.py index 460d7fc036fb..6f3f28a27d43 100644 --- a/chia/plotting/manager.py +++ b/chia/plotting/manager.py @@ -9,9 +9,10 @@ from typing import Any, Callable, Optional from chia_rs import G1Element +from chia_rs import expected_plot_size as _expected_plot_size 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 from chia.plotting.cache import Cache, CacheEntry from chia.plotting.util import ( HarvestingMode,