Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump chia rs 0.14.0 #18643

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions chia/_tests/clvm/test_program.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import pytest
from chia_rs import ENABLE_FIXED_DIV
from clvm.EvalError import EvalError
from clvm.operators import KEYWORD_TO_ATOM
from clvm_tools.binutils import assemble, disassemble
Expand Down Expand Up @@ -120,27 +119,32 @@ def test_run() -> None:
assert ret.atom == bytes([0xFE])

# run()
with pytest.raises(ValueError, match="div operator with negative operands is deprecated"):
cost, ret = div.run_with_cost(100000, [10, -5], 0)
cost, ret = div.run_with_cost(100000, [10, -5], 0)
assert cost == 1107
print(ret)
assert ret.atom == bytes([0xFE])

cost, ret = div.run_with_cost(100000, [10, -5], ENABLE_FIXED_DIV)
cost, ret = div.run_with_cost(100000, [10, -5], 0)
assert cost == 1107
print(ret)
assert ret.atom == bytes([0xFE])

# run_with_flags()
with pytest.raises(ValueError, match="div operator with negative operands is deprecated"):
cost, ret = div.run_with_flags(100000, 0, [10, -5])
cost, ret = div.run_with_flags(100000, 0, [10, -5])
assert cost == 1107
print(ret)
assert ret.atom == bytes([0xFE])

cost, ret = div.run_with_flags(100000, ENABLE_FIXED_DIV, [10, -5])
cost, ret = div.run_with_flags(100000, 0, [10, -5])
assert cost == 1107
print(ret)
assert ret.atom == bytes([0xFE])

# run_with_cost()
with pytest.raises(ValueError, match="div operator with negative operands is deprecated"):
ret = div.run([10, -5], 100000, 0)
ret = div.run([10, -5], 100000, 0)
print(ret)
assert ret.atom == bytes([0xFE])

ret = div.run([10, -5], 100000, ENABLE_FIXED_DIV)
ret = div.run([10, -5], 100000, 0)
print(ret)
assert ret.atom == bytes([0xFE])
5 changes: 1 addition & 4 deletions chia/_tests/core/full_node/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,7 @@ async def test_agg_sig_infinity(
)

# infinity is disallowed after soft-fork-5 activates
if consensus_mode >= ConsensusMode.SOFT_FORK_5:
expected_error = Err.INVALID_CONDITION
else:
expected_error = None
expected_error = Err.INVALID_CONDITION
await check_conditions(bt, conditions, expected_error)

@pytest.mark.anyio
Expand Down
15 changes: 5 additions & 10 deletions chia/_tests/core/mempool/test_mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
from typing import Any, Awaitable, Callable, Collection, Dict, List, Optional, Set, Tuple

import pytest
from chia_rs import ELIGIBLE_FOR_DEDUP, ELIGIBLE_FOR_FF, AugSchemeMPL, G2Element
from chia_rs import ELIGIBLE_FOR_DEDUP, ELIGIBLE_FOR_FF, AugSchemeMPL, G2Element, get_conditions_from_spendbundle
from chiabip158 import PyBIP158

from chia._tests.conftest import ConsensusMode
from chia._tests.util.misc import invariant_check_mempool
from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, setup_simulators_and_wallets
from chia.consensus.constants import ConsensusConstants
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.full_node.bundle_tools import simple_solution_generator
from chia.full_node.mempool import MAX_SKIPPED_ITEMS, PRIORITY_TX_THRESHOLD
from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions, mempool_check_time_locks
from chia.full_node.mempool_check_conditions import mempool_check_time_locks
from chia.full_node.mempool_manager import (
MEMPOOL_MIN_FEE_INCREASE,
QUOTE_BYTES,
Expand Down Expand Up @@ -442,16 +441,12 @@ def make_bundle_spends_map_and_fee(


def mempool_item_from_spendbundle(spend_bundle: SpendBundle) -> MempoolItem:
generator = simple_solution_generator(spend_bundle)
npc_result = get_name_puzzle_conditions(
generator=generator, max_cost=INFINITE_COST, mempool_mode=True, height=uint32(0), constants=DEFAULT_CONSTANTS
)
assert npc_result.conds is not None
bundle_coin_spends, fee = make_bundle_spends_map_and_fee(spend_bundle, npc_result.conds)
conds = get_conditions_from_spendbundle(spend_bundle, INFINITE_COST, DEFAULT_CONSTANTS, uint32(0))
bundle_coin_spends, fee = make_bundle_spends_map_and_fee(spend_bundle, conds)
return MempoolItem(
spend_bundle=spend_bundle,
fee=fee,
conds=npc_result.conds,
conds=conds,
spend_bundle_name=spend_bundle.name(),
height_added_to_mempool=TEST_HEIGHT,
bundle_coin_spends=bundle_coin_spends,
Expand Down
4 changes: 3 additions & 1 deletion chia/_tests/wallet/test_signer_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ async def test_p2dohp_wallet_signer_protocol(wallet_environments: WalletTestFram
)
assert derivation_record is not None
pubkey: G1Element = derivation_record.pubkey
synthetic_pubkey: G1Element = G1Element.from_bytes(puzzle.uncurry()[1].at("f").atom)
atom = puzzle.uncurry()[1].at("f").atom
assert atom is not None
synthetic_pubkey: G1Element = G1Element.from_bytes(atom)
message: bytes = delegated_puzzle_hash + coin.name() + wallet_state_manager.constants.AGG_SIG_ME_ADDITIONAL_DATA

utx: UnsignedTransaction = UnsignedTransaction(
Expand Down
5 changes: 3 additions & 2 deletions chia/consensus/multiprocess_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ def batch_pre_validate_blocks(
header_block = get_block_header(block, tx_additions, removals)
prev_ses_block = None
if prev_ses_block_bytes is not None and len(prev_ses_block_bytes) > 0:
if prev_ses_block_bytes[i] is not None:
prev_ses_block = BlockRecord.from_bytes_unchecked(prev_ses_block_bytes[i])
buffer = prev_ses_block_bytes[i]
if buffer is not None:
prev_ses_block = BlockRecord.from_bytes_unchecked(buffer)
required_iters, error = validate_finished_header_block(
constants,
BlockCache(blocks),
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async def pre_validate_spendbundle(
self._worker_queue_size -= 1

if bls_cache is not None:
bls_cache.update([(e[0], bytes(e[1])) for e in new_cache_entries])
bls_cache.update(new_cache_entries)

ret = NPCResult(None, sbc)

Expand Down
12 changes: 2 additions & 10 deletions chia/types/blockchain_format/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
import io
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Tuple, Type, TypeVar

from chia_rs import (
ALLOW_BACKREFS,
DISALLOW_INFINITY_G1,
ENABLE_BLS_OPS_OUTSIDE_GUARD,
ENABLE_FIXED_DIV,
MEMPOOL_MODE,
run_chia_program,
tree_hash,
)
from chia_rs import ALLOW_BACKREFS, MEMPOOL_MODE, run_chia_program, tree_hash
from clvm.casts import int_from_bytes
from clvm.CLVMObject import CLVMStorage
from clvm.EvalError import EvalError
Expand All @@ -26,7 +18,7 @@

INFINITE_COST = 11000000000

DEFAULT_FLAGS = ENABLE_BLS_OPS_OUTSIDE_GUARD | ENABLE_FIXED_DIV | DISALLOW_INFINITY_G1 | MEMPOOL_MODE
DEFAULT_FLAGS = MEMPOOL_MODE

T_CLVMStorage = TypeVar("T_CLVMStorage", bound=CLVMStorage)
T_Program = TypeVar("T_Program", bound="Program")
Expand Down
59 changes: 31 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bitstring = "4.1.4" # Binary data management library
boto3 = "1.34.143" # AWS S3 for Data Layer S3 plugin
chiabip158 = "1.5.1" # bip158-style wallet filters
chiapos = "2.0.4" # proof of space
chia_rs = "0.13.0"
chia_rs = "0.14.0"
chiavdf = "1.1.4" # timelord and vdf verification
click = "8.1.7" # For the CLI
clvm = "0.9.10"
Expand Down
Loading