mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 02:24:23 -05:00
Fix spelling typos in wallet conditions, solver API, and config (#21058)
This commit is contained in:
@@ -100,7 +100,7 @@ async def test_basic_message_send_receive(mode: int, cost_logger: CostLogger) ->
|
|||||||
|
|
||||||
|
|
||||||
def test_message_error_conditions() -> None:
|
def test_message_error_conditions() -> None:
|
||||||
with pytest.raises(ValueError, match="Must specify at least one committment"):
|
with pytest.raises(ValueError, match="Must specify at least one commitment"):
|
||||||
MessageParticipant()
|
MessageParticipant()
|
||||||
|
|
||||||
test_coin = Coin(bytes32.zeros, bytes32.zeros, uint64(0))
|
test_coin = Coin(bytes32.zeros, bytes32.zeros, uint64(0))
|
||||||
@@ -124,7 +124,7 @@ def test_message_error_conditions() -> None:
|
|||||||
amount_committed=test_coin.amount if (not mode & 0b001) or (mode == 0b111) else None,
|
amount_committed=test_coin.amount if (not mode & 0b001) or (mode == 0b111) else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(ValueError, match="without committment information"):
|
with pytest.raises(ValueError, match="without commitment information"):
|
||||||
MessageParticipant(
|
MessageParticipant(
|
||||||
mode_integer=uint8(0b111),
|
mode_integer=uint8(0b111),
|
||||||
).necessary_args
|
).necessary_args
|
||||||
|
|||||||
@@ -1807,7 +1807,7 @@ async def test_new_unfinished_block2_forward_limit(
|
|||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"committment,expected",
|
"commitment,expected",
|
||||||
[
|
[
|
||||||
(0, Err.INVALID_TRANSACTIONS_GENERATOR_HASH),
|
(0, Err.INVALID_TRANSACTIONS_GENERATOR_HASH),
|
||||||
(1, Err.INVALID_TRANSACTIONS_INFO_HASH),
|
(1, Err.INVALID_TRANSACTIONS_INFO_HASH),
|
||||||
@@ -1824,7 +1824,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
|
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
|
||||||
],
|
],
|
||||||
self_hostname: str,
|
self_hostname: str,
|
||||||
committment: int,
|
commitment: int,
|
||||||
expected: Err,
|
expected: Err,
|
||||||
) -> None:
|
) -> None:
|
||||||
full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
|
full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
|
||||||
@@ -1838,7 +1838,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
|
|
||||||
replaced_generator = SerializedProgram.from_bytes(b"\x80")
|
replaced_generator = SerializedProgram.from_bytes(b"\x80")
|
||||||
|
|
||||||
if committment > 0:
|
if commitment > 0:
|
||||||
tr = block.transactions_info
|
tr = block.transactions_info
|
||||||
assert tr is not None
|
assert tr is not None
|
||||||
transactions_info = TransactionsInfo(
|
transactions_info = TransactionsInfo(
|
||||||
@@ -1853,7 +1853,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
assert block.transactions_info is not None
|
assert block.transactions_info is not None
|
||||||
transactions_info = block.transactions_info
|
transactions_info = block.transactions_info
|
||||||
|
|
||||||
if committment > 1:
|
if commitment > 1:
|
||||||
tb = block.foliage_transaction_block
|
tb = block.foliage_transaction_block
|
||||||
assert tb is not None
|
assert tb is not None
|
||||||
transaction_block = FoliageTransactionBlock(
|
transaction_block = FoliageTransactionBlock(
|
||||||
@@ -1868,7 +1868,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
assert block.foliage_transaction_block is not None
|
assert block.foliage_transaction_block is not None
|
||||||
transaction_block = block.foliage_transaction_block
|
transaction_block = block.foliage_transaction_block
|
||||||
|
|
||||||
if committment > 2:
|
if commitment > 2:
|
||||||
fl = block.foliage
|
fl = block.foliage
|
||||||
foliage = Foliage(
|
foliage = Foliage(
|
||||||
fl.prev_block_hash,
|
fl.prev_block_hash,
|
||||||
@@ -1881,7 +1881,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
else:
|
else:
|
||||||
foliage = block.foliage
|
foliage = block.foliage
|
||||||
|
|
||||||
if committment > 3:
|
if commitment > 3:
|
||||||
fl = block.foliage
|
fl = block.foliage
|
||||||
|
|
||||||
secret_key: PrivateKey = AugSchemeMPL.key_gen(bytes([2] * 32))
|
secret_key: PrivateKey = AugSchemeMPL.key_gen(bytes([2] * 32))
|
||||||
@@ -1897,10 +1897,10 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
signature,
|
signature,
|
||||||
)
|
)
|
||||||
|
|
||||||
if committment > 4:
|
if commitment > 4:
|
||||||
pos = block.reward_chain_block.proof_of_space
|
pos = block.reward_chain_block.proof_of_space
|
||||||
|
|
||||||
if committment > 5:
|
if commitment > 5:
|
||||||
if pos.pool_public_key is None:
|
if pos.pool_public_key is None:
|
||||||
assert pos.pool_contract_puzzle_hash is not None
|
assert pos.pool_contract_puzzle_hash is not None
|
||||||
plot_id = calculate_plot_id_ph(pos.pool_contract_puzzle_hash, public_key)
|
plot_id = calculate_plot_id_ph(pos.pool_contract_puzzle_hash, public_key)
|
||||||
@@ -1949,7 +1949,7 @@ async def test_unfinished_block_with_replaced_generator(
|
|||||||
reward_chain_block = block.reward_chain_block.get_unfinished()
|
reward_chain_block = block.reward_chain_block.get_unfinished()
|
||||||
|
|
||||||
generator_refs: list[uint32] = []
|
generator_refs: list[uint32] = []
|
||||||
if committment > 6:
|
if commitment > 6:
|
||||||
generator_refs = [uint32(n) for n in range(600)]
|
generator_refs = [uint32(n) for n in range(600)]
|
||||||
|
|
||||||
unf = UnfinishedBlock(
|
unf = UnfinishedBlock(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class SolverAPI:
|
|||||||
) -> Message | None:
|
) -> Message | None:
|
||||||
"""
|
"""
|
||||||
Solve a V2 plot partial proof to get the full proof of space.
|
Solve a V2 plot partial proof to get the full proof of space.
|
||||||
This is called by the farmer when it receives V2 parital proofs from harvester.
|
This is called by the farmer when it receives V2 partial proofs from harvester.
|
||||||
"""
|
"""
|
||||||
if not self.solver.started:
|
if not self.solver.started:
|
||||||
self.log.error("Solver is not started")
|
self.log.error("Solver is not started")
|
||||||
@@ -47,7 +47,7 @@ class SolverAPI:
|
|||||||
try:
|
try:
|
||||||
proof = self.solver.solve(request.partial_proof, request.plot_id, request.strength, request.size)
|
proof = self.solver.solve(request.partial_proof, request.plot_id, request.strength, request.size)
|
||||||
if proof is None:
|
if proof is None:
|
||||||
self.log.warning(f"Solver returned no proof for parital {request.partial_proof.fragments[:5]}")
|
self.log.warning(f"Solver returned no proof for partial {request.partial_proof.fragments[:5]}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self.log.debug(f"Successfully solved partial proof, returning {len(proof)} byte proof")
|
self.log.debug(f"Successfully solved partial proof, returning {len(proof)} byte proof")
|
||||||
@@ -57,5 +57,5 @@ class SolverAPI:
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error(f"Error solving parital {request.partial_proof.fragments[:5]}: {e}")
|
self.log.error(f"Error solving partial {request.partial_proof.fragments[:5]}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ class MessageParticipant(Streamable):
|
|||||||
and self.coin_id_committed is None
|
and self.coin_id_committed is None
|
||||||
and self.mode_integer is None
|
and self.mode_integer is None
|
||||||
):
|
):
|
||||||
raise ValueError("Must specify at least one committment. Anyone-can-send/recieve is not allowed.")
|
raise ValueError("Must specify at least one commitment. Anyone-can-send/receive is not allowed.")
|
||||||
if self.coin_id_committed is not None:
|
if self.coin_id_committed is not None:
|
||||||
if self.parent_id_committed is None or self.puzzle_hash_committed is None or self.amount_committed is None:
|
if self.parent_id_committed is None or self.puzzle_hash_committed is None or self.amount_committed is None:
|
||||||
if not (
|
if not (
|
||||||
@@ -465,7 +465,7 @@ class MessageParticipant(Streamable):
|
|||||||
), "The value for coin_id_committed must be equal to the implied ID of the other three arguments"
|
), "The value for coin_id_committed must be equal to the implied ID of the other three arguments"
|
||||||
if self.mode_integer is not None:
|
if self.mode_integer is not None:
|
||||||
assert self.mode == self.mode_integer, (
|
assert self.mode == self.mode_integer, (
|
||||||
"If mode_integer is manually specified, you must specify committments that match with the mode"
|
"If mode_integer is manually specified, you must specify commitments that match with the mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -497,7 +497,7 @@ class MessageParticipant(Streamable):
|
|||||||
@property
|
@property
|
||||||
def necessary_args(self) -> list[Program]:
|
def necessary_args(self) -> list[Program]:
|
||||||
if self._nothing_committed:
|
if self._nothing_committed:
|
||||||
raise ValueError("Cannot generate necessary_args for a participant without committment information")
|
raise ValueError("Cannot generate necessary_args for a participant without commitment information")
|
||||||
|
|
||||||
if self.coin_id_committed:
|
if self.coin_id_committed:
|
||||||
return [Program.to(self.coin_id_committed)]
|
return [Program.to(self.coin_id_committed)]
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ignore = [
|
|||||||
# Ruff Specific
|
# Ruff Specific
|
||||||
|
|
||||||
# This code is problematic because using instantiated types as defaults is so common across the codebase.
|
# This code is problematic because using instantiated types as defaults is so common across the codebase.
|
||||||
# Its purpose is to prevent accidenatally assigning mutable defaults. However, this is a bit overkill for that.
|
# Its purpose is to prevent accidentally assigning mutable defaults. However, this is a bit overkill for that.
|
||||||
# That being said, it would be nice to add some way to actually guard against that specific mutable default behavior.
|
# That being said, it would be nice to add some way to actually guard against that specific mutable default behavior.
|
||||||
"RUF009", # function-call-in-dataclass-default-argument
|
"RUF009", # function-call-in-dataclass-default-argument
|
||||||
"RUF056", # falsy-dict-get-fallback
|
"RUF056", # falsy-dict-get-fallback
|
||||||
|
|||||||
Reference in New Issue
Block a user