Skip to content

Commit

Permalink
bump chia_rs dependency (#18695)
Browse files Browse the repository at this point in the history
bump chia_rs dependency and accomodate for changes to SpendBundleConditions and run_block_generator()
  • Loading branch information
arvidn authored Oct 11, 2024
1 parent 1481118 commit 837f0e2
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 39 deletions.
2 changes: 1 addition & 1 deletion chia/_tests/core/full_node/test_generator_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


def test_tx_removals_and_additions() -> None:
conditions = SpendBundleConditions(spends, uint64(0), uint32(0), uint64(0), None, None, [], uint64(0), 0, 0)
conditions = SpendBundleConditions(spends, uint64(0), uint32(0), uint64(0), None, None, [], uint64(0), 0, 0, False)
expected_rems = [coin_ids[0], coin_ids[1]]
expected_additions = []
for spend in spends:
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/core/mempool/test_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def make_item(
return MempoolItem(
SpendBundle([], G2Element()),
fee,
SpendBundleConditions([], 0, 0, 0, None, None, [], cost, 0, 0),
SpendBundleConditions([], 0, 0, 0, None, None, [], cost, 0, 0, False),
spend_bundle_name,
uint32(0),
assert_height,
Expand Down
1 change: 1 addition & 0 deletions chia/_tests/core/mempool/test_mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def make_test_conds(
cost,
0,
0,
False,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def make_mempoolitem() -> MempoolItem:

fee = uint64(10000000)
spends: List[SpendConditions] = []
conds = SpendBundleConditions(spends, 0, 0, 0, None, None, [], cost, 0, 0)
conds = SpendBundleConditions(spends, 0, 0, 0, None, None, [], cost, 0, 0, False)
mempool_item = MempoolItem(
spend_bundle,
fee,
Expand Down
4 changes: 2 additions & 2 deletions chia/_tests/util/test_condition_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def mk_agg_sig_conditions(
agg_sig_puzzle_amount=agg_sig_data if opcode == ConditionOpcode.AGG_SIG_PUZZLE_AMOUNT else [],
flags=0,
)
return SpendBundleConditions([spend], 0, 0, 0, None, None, agg_sig_unsafe_data, 0, 0, 0)
return SpendBundleConditions([spend], 0, 0, 0, None, None, agg_sig_unsafe_data, 0, 0, 0, False)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -100,7 +100,7 @@ def test_pkm_pairs_vs_for_conditions_dict(opcode: ConditionOpcode) -> None:

class TestPkmPairs:
def test_empty_list(self) -> None:
conds = SpendBundleConditions([], 0, 0, 0, None, None, [], 0, 0, 0)
conds = SpendBundleConditions([], 0, 0, 0, None, None, [], 0, 0, 0, False)
pks, msgs = pkm_pairs(conds, b"foobar")
assert pks == []
assert msgs == []
Expand Down
6 changes: 3 additions & 3 deletions chia/full_node/mempool_check_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import Dict, List, Optional

from chia_rs import MEMPOOL_MODE, get_flags_for_height_and_constants
from chia_rs import DONT_VALIDATE_SIGNATURE, MEMPOOL_MODE, G2Element, get_flags_for_height_and_constants
from chia_rs import get_puzzle_and_solution_for_coin2 as get_puzzle_and_solution_for_coin_rust
from chia_rs import run_block_generator, run_block_generator2, run_chia_program

Expand Down Expand Up @@ -36,7 +36,7 @@ def get_name_puzzle_conditions(
height: uint32,
constants: ConsensusConstants,
) -> NPCResult:
flags = get_flags_for_height_and_constants(height, constants)
flags = get_flags_for_height_and_constants(height, constants) | DONT_VALIDATE_SIGNATURE

if mempool_mode:
flags = flags | MEMPOOL_MODE
Expand All @@ -48,7 +48,7 @@ def get_name_puzzle_conditions(

try:
block_args = generator.generator_refs
err, result = run_block(bytes(generator.program), block_args, max_cost, flags, constants)
err, result = run_block(bytes(generator.program), block_args, max_cost, flags, G2Element(), None, constants)
assert (err is None) != (result is None)
if err is not None:
return NPCResult(uint16(err), None)
Expand Down
56 changes: 28 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.14.0"
chia_rs = "0.15.0"
chiavdf = "1.1.6" # timelord and vdf verification
click = "8.1.7" # For the CLI
clvm = "0.9.10"
Expand Down
14 changes: 12 additions & 2 deletions tools/analyze-chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@

import click
import zstd
from chia_rs import MEMPOOL_MODE, AugSchemeMPL, G1Element, SpendBundleConditions, run_block_generator
from chia_rs import (
DONT_VALIDATE_SIGNATURE,
MEMPOOL_MODE,
AugSchemeMPL,
G1Element,
G2Element,
SpendBundleConditions,
run_block_generator,
)

from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.types.block_protocol import BlockInfo
Expand All @@ -34,7 +42,9 @@ def run_gen(
bytes(generator_program),
block_program_args,
DEFAULT_CONSTANTS.MAX_BLOCK_COST_CLVM,
flags,
flags | DONT_VALIDATE_SIGNATURE,
G2Element(),
None,
DEFAULT_CONSTANTS,
)
run_time = time() - start_time
Expand Down

0 comments on commit 837f0e2

Please sign in to comment.