Skip to content

Commit

Permalink
bump chia_rs dependency to 0.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jul 13, 2023
1 parent ede354c commit e66070f
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 6 deletions.
24 changes: 23 additions & 1 deletion benchmarks/mempool-long-lived.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,29 @@ async def get_coin_record(coin_id: bytes32) -> Optional[CoinRecord]:
npc_result = NPCResult(
None,
SpendBundleConditions(
[Spend(most_recent_coin_id, bytes32(b" " * 32), None, 0, None, None, None, None, [], [], 0)],
[
Spend(
most_recent_coin_id,
bytes32(b" " * 32),
bytes32(b" " * 32),
123,
None,
0,
None,
None,
None,
None,
[],
[],
[],
[],
[],
[],
[],
[],
0,
)
],
0,
0,
0,
Expand Down
48 changes: 46 additions & 2 deletions benchmarks/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,29 @@ async def add_spend_bundles(spend_bundles: List[SpendBundle]) -> None:
npc_result = NPCResult(
None,
SpendBundleConditions(
[Spend(coin_id, bytes32(b" " * 32), None, None, None, None, None, None, [], [], 0)],
[
Spend(
coin_id,
bytes32(b" " * 32),
bytes32(b" " * 32),
123,
None,
None,
None,
None,
None,
None,
[],
[],
[],
[],
[],
[],
[],
[],
0,
)
],
0,
0,
0,
Expand Down Expand Up @@ -274,7 +296,29 @@ async def add_spend_bundles(spend_bundles: List[SpendBundle]) -> None:
npc_result = NPCResult(
None,
SpendBundleConditions(
[Spend(coin_id, bytes32(b" " * 32), None, None, None, None, None, None, [], [], 0)],
[
Spend(
coin_id,
bytes32(b" " * 32),
bytes32(b" " * 32),
123,
None,
None,
None,
None,
None,
None,
[],
[],
[],
[],
[],
[],
[],
[],
0,
)
],
0,
0,
0,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"chiapos==2.0.0b4", # proof of space
"clvm==0.9.7",
"clvm_tools==0.4.6", # Currying, Program.to, other conveniences
"chia_rs==0.2.8",
"chia_rs==0.2.9",
"clvm-tools-rs==0.1.34", # Rust implementation of clvm_tools' compiler
"aiohttp==3.8.4", # HTTP server for full node rpc
"aiosqlite==0.19.0", # asyncio wrapper for sqlite, to store blocks
Expand Down
17 changes: 17 additions & 0 deletions tests/core/full_node/test_generator_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
from chia.util.ints import uint32, uint64

coin_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
parent_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
phs = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
spends: List[Spend] = [
Spend(
coin_ids[0],
parent_ids[0],
phs[0],
123,
None,
uint64(5),
None,
Expand All @@ -27,11 +30,19 @@
(phs[4], uint64(0), b"1" * 300),
],
[],
[],
[],
[],
[],
[],
[],
0,
),
Spend(
coin_ids[1],
parent_ids[1],
phs[0],
123,
None,
uint64(2),
None,
Expand All @@ -44,6 +55,12 @@
(phs[7], uint64(0), b"1" * 300),
],
[],
[],
[],
[],
[],
[],
[],
0,
),
]
Expand Down
25 changes: 25 additions & 0 deletions tests/core/full_node/test_hint_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
from tests.blockchain.blockchain_test_utils import _validate_and_add_block

coin_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
parent_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
phs = [std_hash(i.to_bytes(4, "big")) for i in range(10)]
spends: List[Spend] = [
Spend(
coin_ids[0],
parent_ids[0],
phs[0],
123,
None,
uint64(5),
None,
Expand All @@ -33,11 +36,19 @@
(phs[4], uint64(3), b"1" * 32),
],
[],
[],
[],
[],
[],
[],
[],
0,
),
Spend(
coin_ids[2],
parent_ids[2],
phs[0],
123,
None,
uint64(6),
None,
Expand All @@ -50,11 +61,19 @@
(phs[9], uint64(123), b"1" * 32),
],
[],
[],
[],
[],
[],
[],
[],
0,
),
Spend(
coin_ids[1],
parent_ids[1],
phs[7],
123,
None,
uint64(2),
None,
Expand All @@ -66,6 +85,12 @@
(phs[6], uint64(5), b"1" * 3),
],
[],
[],
[],
[],
[],
[],
[],
0,
),
]
Expand Down
58 changes: 56 additions & 2 deletions tests/core/mempool/test_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2570,6 +2570,8 @@ class TestPkmPairs:
h2 = bytes32(b"b" * 32)
h3 = bytes32(b"c" * 32)
h4 = bytes32(b"d" * 32)
h5 = bytes32(b"e" * 32)
h6 = bytes32(b"f" * 32)

pk1 = G1Element.generator()
pk2 = G1Element.generator()
Expand All @@ -2582,7 +2584,29 @@ def test_empty_list(self):

def test_no_agg_sigs(self):
# one create coin: h1 amount: 1 and not hint
spends = [Spend(self.h3, self.h4, None, None, None, None, None, None, [(self.h1, 1, b"")], [], 0)]
spends = [
Spend(
self.h3,
self.h5,
self.h4,
123,
None,
None,
None,
None,
None,
None,
[(self.h1, 1, b"")],
[],
[],
[],
[],
[],
[],
[],
0,
)
]
conds = SpendBundleConditions(spends, 0, 0, 0, None, None, [], 0, 0, 0)
pks, msgs = pkm_pairs(conds, b"foobar")
assert pks == []
Expand All @@ -2592,7 +2616,9 @@ def test_agg_sig_me(self):
spends = [
Spend(
self.h1,
self.h6,
self.h2,
123,
None,
None,
None,
Expand All @@ -2601,6 +2627,12 @@ def test_agg_sig_me(self):
None,
[],
[(bytes48(self.pk1), b"msg1"), (bytes48(self.pk2), b"msg2")],
[],
[],
[],
[],
[],
[],
0,
)
]
Expand All @@ -2618,7 +2650,29 @@ def test_agg_sig_unsafe(self):
assert msgs == [b"msg1", b"msg2"]

def test_agg_sig_mixed(self):
spends = [Spend(self.h1, self.h2, None, None, None, None, None, None, [], [(bytes48(self.pk1), b"msg1")], 0)]
spends = [
Spend(
self.h1,
self.h5,
self.h2,
123,
None,
None,
None,
None,
None,
None,
[],
[(bytes48(self.pk1), b"msg1")],
[],
[],
[],
[],
[],
[],
0,
)
]
conds = SpendBundleConditions(spends, 0, 0, 0, None, None, [(bytes48(self.pk2), b"msg2")], 0, 0, 0)
pks, msgs = pkm_pairs(conds, b"foobar")
assert [bytes(pk) for pk in pks] == [bytes(self.pk2), bytes(self.pk1)]
Expand Down
8 changes: 8 additions & 0 deletions tests/core/mempool/test_mempool_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def make_test_conds(
Spend(
spend_id,
IDENTITY_PUZZLE_HASH,
IDENTITY_PUZZLE_HASH,
TEST_COIN_AMOUNT,
None if height_relative is None else uint32(height_relative),
None if seconds_relative is None else uint64(seconds_relative),
None if before_height_relative is None else uint32(before_height_relative),
Expand All @@ -167,6 +169,12 @@ def make_test_conds(
None if birth_seconds is None else uint64(birth_seconds),
[],
[],
[],
[],
[],
[],
[],
[],
0,
)
for spend_id in spend_ids
Expand Down
8 changes: 8 additions & 0 deletions tests/generator/test_rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def test_get_name_puzzle_conditions(self, softfork_height: int) -> None:

spend = Spend(
coin_id=bytes32.fromhex("e8538c2d14f2a7defae65c5c97f5d4fae7ee64acef7fec9d28ad847a0880fd03"),
parent_id=bytes32.fromhex("0000000000000000000000000000000000000000000000000000000000000000"),
puzzle_hash=bytes32.fromhex("9dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2"),
coin_amount=50000,
height_relative=None,
seconds_relative=None,
before_height_relative=None,
Expand All @@ -142,6 +144,12 @@ def test_get_name_puzzle_conditions(self, softfork_height: int) -> None:
birth_seconds=None,
create_coin=[(bytes([0] * 31 + [1]), 500, None)],
agg_sig_me=[],
agg_sig_parent=[],
agg_sig_puzzle=[],
agg_sig_amount=[],
agg_sig_puzzle_amount=[],
agg_sig_parent_amount=[],
agg_sig_parent_puzzle=[],
flags=ELIGIBLE_FOR_DEDUP,
)

Expand Down

0 comments on commit e66070f

Please sign in to comment.