diff --git a/chia/wallet/cat_wallet/dao_cat_wallet.py b/chia/wallet/cat_wallet/dao_cat_wallet.py index bb0a783cfcc3..f90558c3fcc7 100644 --- a/chia/wallet/cat_wallet/dao_cat_wallet.py +++ b/chia/wallet/cat_wallet/dao_cat_wallet.py @@ -2,7 +2,6 @@ import logging import time -from secrets import token_bytes from typing import TYPE_CHECKING, Any, ClassVar, List, Optional, Set, Tuple, cast from chia_rs import G1Element @@ -480,7 +479,7 @@ async def exit_vote_state( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=full_spend.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) diff --git a/chia/wallet/dao_wallet/dao_wallet.py b/chia/wallet/dao_wallet/dao_wallet.py index 7a2ec7938a0a..acbe4db189c4 100644 --- a/chia/wallet/dao_wallet/dao_wallet.py +++ b/chia/wallet/dao_wallet/dao_wallet.py @@ -6,7 +6,6 @@ import logging import re import time -from secrets import token_bytes from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Set, Tuple, Union, cast from chia_rs import AugSchemeMPL, G1Element, G2Element @@ -792,7 +791,7 @@ async def generate_new_dao( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=full_spend.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) @@ -956,7 +955,7 @@ async def generate_new_proposal( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=full_spend.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) @@ -1139,7 +1138,7 @@ async def generate_proposal_vote_spend( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=spend_bundle.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) @@ -1499,7 +1498,7 @@ async def create_proposal_close_spend( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=full_spend.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) @@ -1646,7 +1645,7 @@ async def free_coins_from_finished_proposals( sent_to=[], trade_id=None, type=uint32(TransactionType.INCOMING_TX.value), - name=bytes32(token_bytes()), + name=full_spend.name(), memos=[], valid_times=parse_timelock_info(extra_conditions), ) diff --git a/chia/wallet/puzzles/dao_proposal.clsp b/chia/wallet/puzzles/dao_proposal.clsp index e7a45949d968..b3c3ba187c88 100644 --- a/chia/wallet/puzzles/dao_proposal.clsp +++ b/chia/wallet/puzzles/dao_proposal.clsp @@ -217,7 +217,10 @@ ) (c (list ASSERT_MY_AMOUNT my_amount) - output + (if TOTAL_VOTES + (c (list ASSERT_HEIGHT_RELATIVE 1) output) + output + ) ) ) ) diff --git a/chia/wallet/puzzles/dao_proposal.clsp.hex b/chia/wallet/puzzles/dao_proposal.clsp.hex index 54bc22952b6b..dc27469ea6e1 100644 --- a/chia/wallet/puzzles/dao_proposal.clsp.hex +++ b/chia/wallet/puzzles/dao_proposal.clsp.hex @@ -1 +1 @@ -ff02ffff01ff02ffff03ff8402ffffffffff01ff02ffff01ff02ffff03ffff15ff8400bfffffff8305ffff80ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff2cffff04ff02ffff04ffff04ff0bffff04ff8217ffff178080ffff04ff5fff8080808080ffff04ffff0101ffff04ffff04ff8205ffffff018080ffff018080808080ffff04ffff04ffff0152ffff04ff8400bfffffffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ffff018080ffff01808080ffff0180808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff02ffff03ff835fffffffff01ff02ffff01ff04ffff04ffff0152ffff04ff835fffffffff01808080ffff04ffff04ffff0133ffff04ffff02ff2cffff04ff02ffff04ffff04ff0bffff04ff8217ffff178080ffff04ff5fff8080808080ffff04ffff0101ffff04ffff04ff8205ffffff018080ffff018080808080ffff04ffff04ffff013fffff04ffff0bffff02ff3cffff04ff02ffff04ff05ffff04ff820bffffff04ffff04ff0bffff04ff8217ffff178080ff808080808080ff8217ff80ffff01808080ffff04ffff04ffff013effff04ff8305ffffffff01808080ffff02ffff03ffff22ffff15ff8300bfffff8317ffff80ffff15ff825fffffff05ffff14ffff12ff8300bfffff830bffff80ffff0182271080808080ffff01ff02ffff01ff04ffff04ffff013cffff04ffff02ff38ffff04ff02ffff04ffff04ff822fffffff04ffff0180ffff01808080ff80808080ffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ff8217ff80ffff01808080ffff01808080ff0180ffff01ff02ffff01ff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ffff018080ffff01808080ffff018080ff018080ff018080808080ff0180ffff01ff02ffff01ff02ff3effff04ff02ffff04ff8217ffffff04ff82017fffff04ff2fffff04ff8202ffffff04ff8205ffffff04ff820bffffff04ff825fffffff04ff8300bfffffff04ff822fffffff04ff8305ffffffff04ff83017fffffff04ff830bffffffff04ff8317ffffffff04ff8302ffffffff04ffff0180ffff04ffff02ffff03ffff21ff825fffff8300bfff80ffff01ff02ffff01ff0180ff0180ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff3cffff04ff02ffff04ff05ffff04ff820bffffff04ffff04ff0bffff04ff8217ffff178080ff808080808080ffff04ffff0180ffff0180808080ffff02ffff03ffff09ffff02ff38ffff04ff02ffff04ff832fffffff80808080ff822fff80ffff01ff02ffff01ff0180ff0180ffff01ff02ffff01ff0880ff018080ff018080ff018080ff0180ffff04ff8405ffffffffff04ffff0180ff808080808080808080808080808080808080808080ff018080ff0180ff018080ff0180ffff04ffff01ffffffff02ffff03ff05ffff01ff02ffff01ff02ff10ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ffff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff10ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff38ffff04ff02ffff04ffff05ff0580ff80808080ffff02ff38ffff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ffff02ffff03ff0bffff01ff02ffff01ff02ffff03ffff09ff05ffff05ff0b8080ffff01ff02ffff01ff0101ff0180ffff01ff02ffff01ff02ff14ffff04ff02ffff04ff05ffff04ffff06ff0b80ff8080808080ff018080ff0180ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ff28ffff04ff02ffff04ff0bffff04ffff0bffff0101ff0b80ffff04ffff02ff38ffff04ff02ffff04ff05ff80808080ff808080808080ff02ff28ffff04ff02ffff04ff05ffff04ffff02ff38ffff04ff02ffff04ff17ff80808080ffff04ffff0bffff0101ff0b80ff808080808080ffffff02ff28ffff04ff02ffff04ff05ffff04ff17ffff04ffff02ff38ffff04ff02ffff04ff0bff80808080ffff04ffff0bffff0101ff0580ff80808080808080ffff02ff28ffff04ff02ffff04ff05ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ffff0bffff0101ff1780ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff808080808080808080ff02ff28ffff04ff02ffff04ff05ffff04ff17ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff80808080808080ffff02ff28ffff04ff02ffff04ff09ffff04ff0bffff04ffff02ff38ffff04ff02ffff04ff05ff80808080ff808080808080ffff02ff16ffff04ff02ffff04ff05ffff04ffff02ff28ffff04ff02ffff04ff0bffff04ffff0bffff0101ff8205ff80ffff04ffff0bffff0101ff8202ff80ffff04ffff0bffff0101ff82017f80ffff04ffff0bffff0101ff8200bf80ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ff17ffff04ffff0bffff0101ff0b80ff808080808080808080808080ff8080808080ff02ffff03ff820bffffff01ff02ffff01ff02ffff03ffff15ffff05ff8217ff80ffff018080ffff01ff02ffff01ff04ffff04ffff013effff04ffff05ff820bff80ffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff3affff04ff02ffff04ff17ffff04ff2fffff04ffff02ff12ffff04ff02ffff04ff0bffff04ffff05ff822fff80ffff04ffff05ff825fff80ff808080808080ff808080808080ffff02ff38ffff04ff02ffff04ffff04ff05ffff04ffff05ff8217ff80ffff04ff8300bfffffff04ffff05ff820bff80ffff018080808080ff8080808080ffff01808080ffff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ff8200bfffff04ff82017fffff04ff8202ffffff04ff8205ffffff04ffff06ff820bff80ffff04ffff06ff8217ff80ffff04ffff06ff822fff80ffff04ffff06ff825fff80ffff04ff8300bfffffff04ffff10ffff05ff8217ff80ff83017fff80ffff04ff8302ffffffff04ff8305ffffffff04ffff02ffff03ffff02ff14ffff04ff02ffff04ffff05ff820bff80ffff04ff830bffffff8080808080ffff01ff02ffff01ff0880ff0180ffff01ff02ffff01ff04ffff05ff820bff80ff830bffff80ff018080ff0180ff8080808080808080808080808080808080808080808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff2affff04ff02ffff04ff8200bfffff04ff05ffff04ff8205ffffff04ffff02ffff03ff8300bfffffff01ff02ffff01ff10ff82017fff83017fff80ff0180ffff01ff02ffff0182017fff018080ff0180ffff04ffff10ff8202ffff83017fff80ff8080808080808080ffff04ff8305ffffffff04ffff04ff5fffff018080ffff018080808080ffff04ffff04ffff0149ffff04ff8305ffffffff01808080ff8302ffff8080ff018080ff0180ff018080 +ff02ffff01ff02ffff03ff8402ffffffffff01ff02ffff01ff02ffff03ffff15ff8400bfffffff8305ffff80ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff2cffff04ff02ffff04ffff04ff0bffff04ff8217ffff178080ffff04ff5fff8080808080ffff04ffff0101ffff04ffff04ff8205ffffff018080ffff018080808080ffff04ffff04ffff0152ffff04ff8400bfffffffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ffff018080ffff01808080ffff0180808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff02ffff03ff835fffffffff01ff02ffff01ff04ffff04ffff0152ffff04ff835fffffffff01808080ffff04ffff04ffff0133ffff04ffff02ff2cffff04ff02ffff04ffff04ff0bffff04ff8217ffff178080ffff04ff5fff8080808080ffff04ffff0101ffff04ffff04ff8205ffffff018080ffff018080808080ffff04ffff04ffff013fffff04ffff0bffff02ff3cffff04ff02ffff04ff05ffff04ff820bffffff04ffff04ff0bffff04ff8217ffff178080ff808080808080ff8217ff80ffff01808080ffff04ffff04ffff013effff04ff8305ffffffff01808080ffff02ffff03ffff22ffff15ff8300bfffff8317ffff80ffff15ff825fffffff05ffff14ffff12ff8300bfffff830bffff80ffff0182271080808080ffff01ff02ffff01ff04ffff04ffff013cffff04ffff02ff38ffff04ff02ffff04ffff04ff822fffffff04ffff0180ffff01808080ff80808080ffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ff8217ff80ffff01808080ffff01808080ff0180ffff01ff02ffff01ff04ffff04ffff013fffff04ffff0bffff02ff2effff04ff02ffff04ffff04ff0bffff04ff8205ffff178080ffff04ff8200bfffff04ff83017fffffff04ff8305ffffffff04ff835fffffffff04ff8317ffffffff04ff830bffffffff04ff8400bfffffffff04ff84017fffffff808080808080808080808080ffff018080ffff01808080ffff018080ff018080ff018080808080ff0180ffff01ff02ffff01ff02ff3effff04ff02ffff04ff8217ffffff04ff82017fffff04ff2fffff04ff8202ffffff04ff8205ffffff04ff820bffffff04ff825fffffff04ff8300bfffffff04ff822fffffff04ff8305ffffffff04ff83017fffffff04ff830bffffffff04ff8317ffffffff04ff8302ffffffff04ffff0180ffff04ffff02ffff03ffff21ff825fffff8300bfff80ffff01ff02ffff01ff0180ff0180ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff3cffff04ff02ffff04ff05ffff04ff820bffffff04ffff04ff0bffff04ff8217ffff178080ff808080808080ffff04ffff0180ffff0180808080ffff02ffff03ffff09ffff02ff38ffff04ff02ffff04ff832fffffff80808080ff822fff80ffff01ff02ffff01ff0180ff0180ffff01ff02ffff01ff0880ff018080ff018080ff018080ff0180ffff04ff8405ffffffffff04ffff0180ff808080808080808080808080808080808080808080ff018080ff0180ff018080ff0180ffff04ffff01ffffffff02ffff03ff05ffff01ff02ffff01ff02ff10ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ffff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff10ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff38ffff04ff02ffff04ffff05ff0580ff80808080ffff02ff38ffff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ffff02ffff03ff0bffff01ff02ffff01ff02ffff03ffff09ff05ffff05ff0b8080ffff01ff02ffff01ff0101ff0180ffff01ff02ffff01ff02ff14ffff04ff02ffff04ff05ffff04ffff06ff0b80ff8080808080ff018080ff0180ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ff28ffff04ff02ffff04ff0bffff04ffff0bffff0101ff0b80ffff04ffff02ff38ffff04ff02ffff04ff05ff80808080ff808080808080ff02ff28ffff04ff02ffff04ff05ffff04ffff02ff38ffff04ff02ffff04ff17ff80808080ffff04ffff0bffff0101ff0b80ff808080808080ffffff02ff28ffff04ff02ffff04ff05ffff04ff17ffff04ffff02ff38ffff04ff02ffff04ff0bff80808080ffff04ffff0bffff0101ff0580ff80808080808080ffff02ff28ffff04ff02ffff04ff05ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ffff0bffff0101ff1780ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff808080808080808080ff02ff28ffff04ff02ffff04ff05ffff04ff17ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff80808080808080ffff02ff28ffff04ff02ffff04ff09ffff04ff0bffff04ffff02ff38ffff04ff02ffff04ff05ff80808080ff808080808080ffff02ff16ffff04ff02ffff04ff05ffff04ffff02ff28ffff04ff02ffff04ff0bffff04ffff0bffff0101ff8205ff80ffff04ffff0bffff0101ff8202ff80ffff04ffff0bffff0101ff82017f80ffff04ffff0bffff0101ff8200bf80ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ff17ffff04ffff0bffff0101ff0b80ff808080808080808080808080ff8080808080ff02ffff03ff820bffffff01ff02ffff01ff02ffff03ffff15ffff05ff8217ff80ffff018080ffff01ff02ffff01ff04ffff04ffff013effff04ffff05ff820bff80ffff01808080ffff04ffff04ffff013fffff04ffff0bffff02ff3affff04ff02ffff04ff17ffff04ff2fffff04ffff02ff12ffff04ff02ffff04ff0bffff04ffff05ff822fff80ffff04ffff05ff825fff80ff808080808080ff808080808080ffff02ff38ffff04ff02ffff04ffff04ff05ffff04ffff05ff8217ff80ffff04ff8300bfffffff04ffff05ff820bff80ffff018080808080ff8080808080ffff01808080ffff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ff8200bfffff04ff82017fffff04ff8202ffffff04ff8205ffffff04ffff06ff820bff80ffff04ffff06ff8217ff80ffff04ffff06ff822fff80ffff04ffff06ff825fff80ffff04ff8300bfffffff04ffff10ffff05ff8217ff80ff83017fff80ffff04ff8302ffffffff04ff8305ffffffff04ffff02ffff03ffff02ff14ffff04ff02ffff04ffff05ff820bff80ffff04ff830bffffff8080808080ffff01ff02ffff01ff0880ff0180ffff01ff02ffff01ff04ffff05ff820bff80ff830bffff80ff018080ff0180ff8080808080808080808080808080808080808080808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff02ff2affff04ff02ffff04ff8200bfffff04ff05ffff04ff8205ffffff04ffff02ffff03ff8300bfffffff01ff02ffff01ff10ff82017fff83017fff80ff0180ffff01ff02ffff0182017fff018080ff0180ffff04ffff10ff8202ffff83017fff80ff8080808080808080ffff04ff8305ffffffff04ffff04ff5fffff018080ffff018080808080ffff04ffff04ffff0149ffff04ff8305ffffffff01808080ffff02ffff03ff8202ffffff01ff02ffff01ff04ffff04ffff0152ffff04ffff0101ffff01808080ff8302ffff80ff0180ffff01ff02ffff018302ffffff018080ff01808080ff018080ff0180ff018080 diff --git a/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp b/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp index 6e62d9bdaf70..4da7df20fcb7 100644 --- a/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp +++ b/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp @@ -20,6 +20,7 @@ (include condition_codes.clib) (include curry-and-treehash.clib) + (include utility_macros.clib) (include *standard-cl-21*) (defun-inline calculate_singleton_puzzle_hash (PROPOSAL_SINGLETON_STRUCT inner_puzzle_hash) @@ -104,6 +105,19 @@ ) ) + (defun dedupe ((@ lst ((@ first (parent amount)) . rest)) ids) + (if lst + (let ((id (sha256 parent amount))) + (if (in id ids) + (dedupe rest ids) + (c first (dedupe rest (c id ids))) + ) + ) + () + ) + ) + + ; for a given asset type, loop through the cat coins and generate the announcements required for each (defun for_each_asset ( TREASURY_SINGLETON_STRUCT @@ -178,7 +192,7 @@ ) P2_SINGLETON_PUZHASH (wrap_in_cat_layer CAT_MOD_HASH (f (f p2_singleton_tailhash_parent_amount_list)) P2_SINGLETON_PUZHASH) ; p2_singleton_puzzle_hash - (f (r (f p2_singleton_tailhash_parent_amount_list))) ; list of ((parent amount) (parent amount)...) + (dedupe (f (r (f p2_singleton_tailhash_parent_amount_list))) 0 0) ; list of ((parent amount) (parent amount)...) 0 ; current total - initialise as 0 (sum_create_coins (f (r (f LIST_OF_TAILHASH_CONDITIONS)))) output ; add new conditions to previous calculated output conditions diff --git a/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex b/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex index 89b65a2d4246..dcf4a905dba0 100644 --- a/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex +++ b/chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex @@ -1 +1 @@ -ff02ffff01ff04ffff04ffff0148ffff04ffff02ff18ffff04ff02ffff04ffff05ff0580ffff04ff8202ffffff04ffff02ff2cffff04ff02ffff04ff05ff80808080ff808080808080ffff01808080ffff04ffff04ffff0133ffff04ff8202ffffff04ffff0101ffff04ffff04ffff05ffff06ff058080ffff018080ffff018080808080ffff02ffff03ff17ffff01ff02ffff01ff02ff3cffff04ff02ffff04ff05ffff04ffff02ff1affff04ff02ffff04ff17ff80808080ffff04ff5fffff04ffff02ffff03ff8200bfffff01ff02ffff01ff02ff14ffff04ff02ffff04ffff05ffff05ff8200bf8080ffff04ff5fffff04ffff05ffff06ffff05ff8200bf808080ff808080808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ffff03ff8200bfffff01ff02ffff01ff06ff8200bf80ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ffff03ff8200bfffff01ff02ffff01ff05ffff06ffff05ff8200bf808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff5fffff04ff2fffff04ff82017fffff04ff17ff808080808080808080ff80808080808080808080ff0180ffff01ff02ffff01ff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff5fffff04ff2fffff04ff82017fffff04ff17ff808080808080808080ff018080ff01808080ffff04ffff01ffffffff02ffff03ff05ffff01ff02ffff01ff02ff10ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff10ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ffff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff2cffff04ff02ffff04ffff05ff0580ff80808080ffff02ff2cffff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ff04ffff04ffff013effff04ffff02ff2cffff04ff02ffff04ffff04ff2fffff04ffff02ff2cffff04ff02ffff01ff80808080ff808080ff80808080ff808080ffff04ffff04ffff013dffff04ffff0bff2fffff012480ff808080ffff02ffff03ff5fffff01ff02ffff01ff02ff3cffff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ffff02ff14ffff04ff02ffff04ffff05ffff05ff5f8080ffff04ff17ffff04ffff05ffff06ffff05ff5f808080ff808080808080ffff04ffff06ff5f80ffff04ffff10ff8200bfffff05ffff06ffff05ff5f80808080ffff04ff82017fff80808080808080808080ff0180ffff01ff02ffff01ff02ffff03ffff15ffff11ff8200bfff0b80ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ff17ffff04ffff11ff8200bfff0b80ffff04ffff04ff17ffff018080ffff018080808080ff82017f80ff0180ffff01ff02ffff0182017fff018080ff0180ff018080ff01808080ffffff04ffff04ffff013effff04ffff02ff2cffff04ff02ffff04ffff04ff05ffff04ff0bff808080ff80808080ff808080ffff04ffff04ffff013dffff04ffff0bff05ffff012480ff808080ff178080ff02ffff03ff05ffff01ff02ffff01ff10ffff02ffff03ffff09ffff05ffff05ff058080ffff013380ffff01ff02ffff01ff02ffff03ffff15ffff05ffff06ffff06ffff05ff0580808080ffff018080ffff01ff02ffff01ff05ffff06ffff06ffff05ff0580808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ff1affff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ff18ffff04ff02ffff04ff05ffff04ff17ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff80808080808080ffff02ffff03ff8200bfffff01ff02ffff01ff02ff12ffff04ff02ffff04ffff02ff14ffff04ff02ffff04ffff05ffff05ff8200bf8080ffff04ff5fffff04ffff05ffff06ffff05ff8200bf808080ff808080808080ffff04ffff02ffff03ffff06ff8200bf80ffff01ff02ffff01ff02ff2cffff04ff02ffff04ffff0180ff80808080ff0180ffff01ff02ffff01ff02ff2cffff04ff02ffff04ffff04ffff0101ffff02ffff03ffff15ffff11ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ff8202ff80ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff05ffff06ffff06ffff06ffff06ff018080808080ffff04ffff11ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ff8202ff80ffff04ffff04ffff05ffff06ffff06ffff06ffff06ff018080808080ffff018080ffff018080808080ffff05ffff06ffff06ffff06ff018080808080ff0180ffff01ff02ffff01ff05ffff06ffff06ffff06ff0180808080ff018080ff018080ff80808080ff018080ff0180ffff04ffff02ff2effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ffff06ff8200bf80ffff04ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ffff04ff8202ffffff04ff8205ffff808080808080808080808080ff808080808080ff0180ffff01ff02ffff018205ffff018080ff0180ff02ffff03ff2fffff01ff02ffff01ff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ffff06ff2f80ffff04ffff06ff5f80ffff04ffff02ff2effff04ff02ffff04ff05ffff04ff0bffff04ffff02ffff03ffff09ffff05ffff05ff2f8080ffff05ffff05ff5f808080ffff01ff02ffff01ff05ffff06ffff05ff2f808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff04ff17ffff04ffff02ff16ffff04ff02ffff04ff0bffff04ffff05ffff05ff5f8080ffff04ff17ff808080808080ffff04ffff05ffff06ffff05ff5f808080ffff04ffff0180ffff04ffff02ff1affff04ff02ffff04ffff05ffff06ffff05ff2f808080ff80808080ffff04ff8200bfff808080808080808080808080ff808080808080808080ff0180ffff01ff02ffff018200bfff018080ff0180ff018080 +ff02ffff01ff04ffff04ffff0148ffff04ffff02ff28ffff04ff02ffff04ffff05ff0580ffff04ff8202ffffff04ffff02ff14ffff04ff02ffff04ff05ff80808080ff808080808080ffff01808080ffff04ffff04ffff0133ffff04ff8202ffffff04ffff0101ffff04ffff04ffff05ffff06ff058080ffff018080ffff018080808080ffff02ffff03ff17ffff01ff02ffff01ff02ff3cffff04ff02ffff04ff05ffff04ffff02ff2affff04ff02ffff04ff17ff80808080ffff04ff5fffff04ffff02ffff03ff8200bfffff01ff02ffff01ff02ff38ffff04ff02ffff04ffff05ffff05ff8200bf8080ffff04ff5fffff04ffff05ffff06ffff05ff8200bf808080ff808080808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ffff03ff8200bfffff01ff02ffff01ff06ff8200bf80ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ffff03ff8200bfffff01ff02ffff01ff05ffff06ffff05ff8200bf808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff04ffff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff5fffff04ff2fffff04ff82017fffff04ff17ff808080808080808080ff80808080808080808080ff0180ffff01ff02ffff01ff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff5fffff04ff2fffff04ff82017fffff04ff17ff808080808080808080ff018080ff01808080ffff04ffff01ffffffff02ffff03ff05ffff01ff02ffff01ff02ff10ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ffff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff10ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff14ffff04ff02ffff04ffff05ff0580ff80808080ffff02ff14ffff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ffff02ffff03ff0bffff01ff02ffff01ff03ffff09ff05ffff05ff0b8080ffff0101ffff02ff2cffff04ff02ffff04ff05ffff04ffff06ff0b80ff808080808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ff04ffff04ffff013effff04ffff02ff14ffff04ff02ffff04ffff04ff2fffff04ffff02ff14ffff04ff02ffff01ff80808080ff808080ff80808080ff808080ffff04ffff04ffff013dffff04ffff0bff2fffff012480ff808080ffff02ffff03ff5fffff01ff02ffff01ff02ff3cffff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ffff02ff38ffff04ff02ffff04ffff05ffff05ff5f8080ffff04ff17ffff04ffff05ffff06ffff05ff5f808080ff808080808080ffff04ffff06ff5f80ffff04ffff10ff8200bfffff05ffff06ffff05ff5f80808080ffff04ff82017fff80808080808080808080ff0180ffff01ff02ffff01ff02ffff03ffff15ffff11ff8200bfff0b80ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ff17ffff04ffff11ff8200bfff0b80ffff04ffff04ff17ffff018080ffff018080808080ff82017f80ff0180ffff01ff02ffff0182017fff018080ff0180ff018080ff01808080ffffff04ffff04ffff013effff04ffff02ff14ffff04ff02ffff04ffff04ff05ffff04ff0bff808080ff80808080ff808080ffff04ffff04ffff013dffff04ffff0bff05ffff012480ff808080ff178080ffff02ffff03ff05ffff01ff02ffff01ff10ffff02ffff03ffff09ffff05ffff05ff058080ffff013380ffff01ff02ffff01ff02ffff03ffff15ffff05ffff06ffff06ffff05ff0580808080ffff018080ffff01ff02ffff01ff05ffff06ffff06ffff05ff0580808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ff2affff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0180ff018080ff0180ff02ff28ffff04ff02ffff04ff05ffff04ff17ffff04ffff0bffff0101ff0b80ffff04ffff0bffff0101ff0580ff80808080808080ffff02ffff03ff05ffff01ff02ffff01ff02ffff03ffff02ff2cffff04ff02ffff04ffff0bff11ff2980ffff04ffff05ffff06ffff06ff01808080ff8080808080ffff01ff02ffff01ff02ff16ffff04ff02ffff04ffff06ffff05ffff06ff01808080ffff04ffff05ffff06ffff06ff01808080ff8080808080ff0180ffff01ff02ffff01ff04ffff05ffff05ffff06ff01808080ffff02ff16ffff04ff02ffff04ffff06ffff05ffff06ff01808080ffff04ffff04ffff0bff11ff2980ffff05ffff06ffff06ff0180808080ff808080808080ff018080ff0180ff0180ffff01ff02ffff01ff0180ff018080ff0180ffff02ffff03ff8200bfffff01ff02ffff01ff02ff12ffff04ff02ffff04ffff02ff38ffff04ff02ffff04ffff05ffff05ff8200bf8080ffff04ff5fffff04ffff05ffff06ffff05ff8200bf808080ff808080808080ffff04ffff02ffff03ffff06ff8200bf80ffff01ff02ffff01ff02ff14ffff04ff02ffff04ffff0180ff80808080ff0180ffff01ff02ffff01ff02ff14ffff04ff02ffff04ffff04ffff0101ffff02ffff03ffff15ffff11ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ff8202ff80ffff018080ffff01ff02ffff01ff04ffff04ffff0133ffff04ffff05ffff06ffff06ffff06ffff06ff018080808080ffff04ffff11ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ff8202ff80ffff04ffff04ffff05ffff06ffff06ffff06ffff06ff018080808080ffff018080ffff018080808080ffff05ffff06ffff06ffff06ff018080808080ff0180ffff01ff02ffff01ff05ffff06ffff06ffff06ff0180808080ff018080ff018080ff80808080ff018080ff0180ffff04ffff02ff2effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ffff06ff8200bf80ffff04ffff10ff82017fffff05ffff06ffff05ff8200bf80808080ffff04ff8202ffffff04ff8205ffff808080808080808080808080ff808080808080ff0180ffff01ff02ffff018205ffff018080ff0180ff02ffff03ff2fffff01ff02ffff01ff02ff3effff04ff02ffff04ff05ffff04ff0bffff04ff17ffff04ffff06ff2f80ffff04ffff06ff5f80ffff04ffff02ff2effff04ff02ffff04ff05ffff04ff0bffff04ffff02ffff03ffff09ffff05ffff05ff2f8080ffff05ffff05ff5f808080ffff01ff02ffff01ff05ffff06ffff05ff2f808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff04ff17ffff04ffff02ff3affff04ff02ffff04ff0bffff04ffff05ffff05ff5f8080ffff04ff17ff808080808080ffff04ffff02ff16ffff04ff02ffff04ffff05ffff06ffff05ff5f808080ffff04ffff0180ffff04ffff0180ff808080808080ffff04ffff0180ffff04ffff02ff2affff04ff02ffff04ffff05ffff06ffff05ff2f808080ff80808080ffff04ff8200bfff808080808080808080808080ff808080808080808080ff0180ffff01ff02ffff018200bfff018080ff0180ff018080 diff --git a/chia/wallet/puzzles/dao_treasury.clsp b/chia/wallet/puzzles/dao_treasury.clsp index 4b95dec4fbc6..00f8489af42f 100644 --- a/chia/wallet/puzzles/dao_treasury.clsp +++ b/chia/wallet/puzzles/dao_treasury.clsp @@ -79,14 +79,17 @@ (c (list ASSERT_COIN_ANNOUNCEMENT (sha256 announcement_source (sha256tree (list delegated_puzzle_hash announcement_args)))) ; announcement source is validated inside the ProposalValidator - (a - PROPOSAL_VALIDATOR - (list - ATTENDANCE_REQUIRED - PASS_MARGIN - proposal_announcement - proposal_validator_solution - (a delegated_puzzle_reveal delegated_solution) + (c + (list ASSERT_HEIGHT_RELATIVE 1) + (a + PROPOSAL_VALIDATOR + (list + ATTENDANCE_REQUIRED + PASS_MARGIN + proposal_announcement + proposal_validator_solution + (a delegated_puzzle_reveal delegated_solution) + ) ) ) ) diff --git a/chia/wallet/puzzles/dao_treasury.clsp.hex b/chia/wallet/puzzles/dao_treasury.clsp.hex index ef5c5c3e409e..3b6bba294d29 100644 --- a/chia/wallet/puzzles/dao_treasury.clsp.hex +++ b/chia/wallet/puzzles/dao_treasury.clsp.hex @@ -1 +1 @@ -ff02ffff01ff04ffff04ffff013effff04ffff0180ffff01808080ffff02ffff03ff8217ffffff01ff02ffff01ff02ffff03ffff09ffff02ff0affff04ff02ffff04ff8217ffff80808080ff8215ff80ffff01ff02ffff01ff04ffff04ffff013dffff04ffff0bff8209ffffff02ff0affff04ff02ffff04ffff04ff8215ffffff04ff822dffffff01808080ff8080808080ffff01808080ffff02ff0bffff04ff5fffff04ff8200bfffff04ff8205ffffff04ff820bffffff04ffff02ff8217ffff822fff80ffff018080808080808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff02ff1effff04ff02ffff04ff8202ffffff04ffff02ff14ffff04ff02ffff04ff05ffff04ffff0bffff0101ff8202ff80ffff04ffff0bffff0101ff82017f80ffff04ffff0bffff0101ff8200bf80ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ffff0bffff0101ff1780ffff04ffff02ff0affff04ff02ffff04ff0bff80808080ffff04ffff0bffff0101ff0580ff808080808080808080808080ffff04ff825fffff808080808080ff018080ff018080ffff04ffff01ffffff02ffff03ff05ffff01ff02ffff01ff02ff08ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ffff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff08ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff0affff04ff02ffff04ffff05ff0580ff80808080ffff02ff0affff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ffff02ff14ffff04ff02ffff04ff09ffff04ff0bffff04ffff02ff0affff04ff02ffff04ff05ff80808080ff808080808080ff04ffff02ffff03ff17ffff01ff02ffff01ff04ffff0146ffff04ffff02ff1cffff04ff02ffff04ffff05ffff06ff178080ffff04ffff02ff16ffff04ff02ffff04ff17ffff04ff0bff8080808080ffff04ffff0101ff808080808080ffff01808080ff0180ffff01ff02ffff01ff04ffff0152ffff04ff05ffff01808080ff018080ff0180ffff04ffff04ffff0133ffff04ff0bffff01ff01808080ff808080ff018080 +ff02ffff01ff04ffff04ffff013effff04ffff0180ffff01808080ffff02ffff03ff8217ffffff01ff02ffff01ff02ffff03ffff09ffff02ff0affff04ff02ffff04ff8217ffff80808080ff8215ff80ffff01ff02ffff01ff04ffff04ffff013dffff04ffff0bff8209ffffff02ff0affff04ff02ffff04ffff04ff8215ffffff04ff822dffffff01808080ff8080808080ffff01808080ffff04ffff04ffff0152ffff04ffff0101ffff01808080ffff02ff0bffff04ff5fffff04ff8200bfffff04ff8205ffffff04ff820bffffff04ffff02ff8217ffff822fff80ffff01808080808080808080ff0180ffff01ff02ffff01ff0880ff018080ff0180ff0180ffff01ff02ffff01ff02ff1effff04ff02ffff04ff8202ffffff04ffff02ff14ffff04ff02ffff04ff05ffff04ffff0bffff0101ff8202ff80ffff04ffff0bffff0101ff82017f80ffff04ffff0bffff0101ff8200bf80ffff04ffff0bffff0101ff5f80ffff04ffff0bffff0101ff2f80ffff04ffff0bffff0101ff1780ffff04ffff02ff0affff04ff02ffff04ff0bff80808080ffff04ffff0bffff0101ff0580ff808080808080808080808080ffff04ff825fffff808080808080ff018080ff018080ffff04ffff01ffffff02ffff03ff05ffff01ff02ffff01ff02ff08ffff04ff02ffff04ffff06ff0580ffff04ffff0bffff0102ffff0bffff0101ffff010480ffff0bffff0102ffff0bffff0102ffff0bffff0101ffff010180ffff05ff058080ffff0bffff0102ff0bffff0bffff0101ffff018080808080ff8080808080ff0180ffff01ff02ffff010bff018080ff0180ffff0bffff0102ffff01a0a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222ffff0bffff0102ffff0bffff0102ffff01a09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b2ff0580ffff0bffff0102ffff02ff08ffff04ff02ffff04ff07ffff01ffa09dcf97a184f32623d11a73124ceb99a5709b083721e878a16d78f596718ba7b280808080ffff01a04bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a808080ff02ffff03ffff22ffff09ffff0dff0580ffff012080ffff09ffff0dff0b80ffff012080ffff15ff17ffff0181ff8080ffff01ff02ffff01ff0bff05ff0bff1780ff0180ffff01ff02ffff01ff0880ff018080ff0180ffff02ffff03ffff07ff0580ffff01ff02ffff01ff0bffff0102ffff02ff0affff04ff02ffff04ffff05ff0580ff80808080ffff02ff0affff04ff02ffff04ffff06ff0580ff8080808080ff0180ffff01ff02ffff01ff0bffff0101ff0580ff018080ff0180ffff02ff14ffff04ff02ffff04ff09ffff04ff0bffff04ffff02ff0affff04ff02ffff04ff05ff80808080ff808080808080ff04ffff02ffff03ff17ffff01ff02ffff01ff04ffff0146ffff04ffff02ff1cffff04ff02ffff04ffff05ffff06ff178080ffff04ffff02ff16ffff04ff02ffff04ff17ffff04ff0bff8080808080ffff04ffff0101ff808080808080ffff01808080ff0180ffff01ff02ffff01ff04ffff0152ffff04ff05ffff01808080ff018080ff0180ffff04ffff04ffff0133ffff04ff0bffff01ff01808080ff808080ff018080 diff --git a/chia/wallet/puzzles/deployed_puzzle_hashes.json b/chia/wallet/puzzles/deployed_puzzle_hashes.json index 080c059108b1..bbdfd4f4a56f 100644 --- a/chia/wallet/puzzles/deployed_puzzle_hashes.json +++ b/chia/wallet/puzzles/deployed_puzzle_hashes.json @@ -11,11 +11,11 @@ "dao_cat_launcher": "a01a838d18d4e031e937c79fa3f80f213fa00a3e64af6c16a1f137770cd3a567", "dao_finished_state": "694c99e1fb07671771bbca3d110880693a9ecc37a6529891ec979d0f3e760eba", "dao_lockup": "d6215f0916715a69fbbf2d1a679f437fde81787adeb90c666642fb9c2deff7ce", - "dao_proposal": "b25dd85e418791aebb7d7486914b1998e117da989a66a40f00259f925b3ddb16", + "dao_proposal": "65bf3abac92f1390684e34d2955daecc5ae1dbb110782bb825ede09a1a77a1d5", "dao_proposal_timer": "1acd912fca662d1474f7a6c762280fc1430875bef518883387086c1125027526", "dao_proposal_validator": "507197e6645e3741efc200de19edc4556be1352c09ce1c9edaad7f1a4fc9d6a1", - "dao_spend_p2_singleton_v2": "e76c813d409e11ab58989a234eff1907b17d295496e6fc125781750d6a530a58", - "dao_treasury": "a80ab006a05f8fa0156c4bec25b747075c61338c6d0c0ffe95fd04ea96c636d7", + "dao_spend_p2_singleton_v2": "7bc8942159e600f56a87e1d9c059c8705307ec2fb996a949503298dedfed00be", + "dao_treasury": "637d78acd395b6bb03211bcfc5f5f2e878cba2d62b2f53871d49a8b928411b19", "dao_update_proposal": "fc032384cfece9b542c3e1ea77ba119fb1013a3d74b622302c0b670447e4343d", "decompress_coin_spend_entry": "9d98ed08770d31be4bd1bde4705dab388db5e7e9c349f5a76fc3c347aa3a0b79", "decompress_coin_spend_entry_with_prefix": "92aa4bc8060a8836355a1884075141b4791ce1b67ae6092bb166b2845954bc89", diff --git a/tests/wallet/dao_wallet/test_dao_clvm.py b/tests/wallet/dao_wallet/test_dao_clvm.py index 279d1c8998ac..5c9e2fec5316 100644 --- a/tests/wallet/dao_wallet/test_dao_clvm.py +++ b/tests/wallet/dao_wallet/test_dao_clvm.py @@ -200,7 +200,7 @@ def test_proposal() -> None: ) conds_repeated = conditions_dict_for_solution(full_proposal, repeat_solution_1, INFINITE_COST) - assert len(conds_repeated) == 4 + assert len(conds_repeated) == 5 # Try to vote using repeated coin ids repeat_solution_2: Program = Program.to( @@ -645,6 +645,16 @@ def test_spend_p2_singleton() -> None: conds = spend_p2_puz.run(spend_p2_sol) assert conds + # test deduplicate cat_parent_amount_list + cat_parent_amt_list = [ + [cat_tail_1, [[b"b" * 32, 100], [b"c" * 32, 400], [b"b" * 32, 100], [b"b" * 32, 100]]], + [cat_tail_2, [[b"e" * 32, 100], [b"f" * 32, 400], [b"f" * 32, 400], [b"e" * 32, 100]]], + ] + + spend_p2_sol = Program.to([xch_parent_amt_list, cat_parent_amt_list, treasury_inner_puzhash]) + dupe_conds = spend_p2_puz.run(spend_p2_sol) + assert dupe_conds == conds + def test_merge_p2_singleton() -> None: """ @@ -831,7 +841,7 @@ def test_treasury() -> None: ] ) conds = treasury_inner.run(solution) - assert len(conds.as_python()) == 9 + len(conditions) + assert len(conds.as_python()) == 10 + len(conditions) def test_lockup() -> None: diff --git a/tests/wallet/dao_wallet/test_dao_wallets.py b/tests/wallet/dao_wallet/test_dao_wallets.py index 2d00b909a3ea..a3d14353520c 100644 --- a/tests/wallet/dao_wallet/test_dao_wallets.py +++ b/tests/wallet/dao_wallet/test_dao_wallets.py @@ -83,10 +83,9 @@ async def rpc_state( ) @pytest.mark.anyio async def test_dao_creation( - self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode + self_hostname: str, two_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 1 - full_nodes, wallets, _ = three_wallet_nodes + full_nodes, wallets, _ = two_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server wallet_node_0, server_0 = wallets[0] @@ -110,14 +109,10 @@ async def test_dao_creation( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -163,8 +158,7 @@ async def test_dao_creation( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check the spend was successful treasury_id = dao_wallet_0.dao_info.treasury_id @@ -271,7 +265,6 @@ async def test_dao_creation( async def test_dao_funding( self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 1 full_nodes, wallets, _ = three_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -304,15 +297,12 @@ async def test_dao_funding( await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -343,8 +333,7 @@ async def test_dao_funding( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # get the cat wallets cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.cat_wallet_id] @@ -385,9 +374,7 @@ async def test_dao_funding( await wallet_0.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) recipient_puzzle_hash = await wallet_2.get_new_puzzlehash() proposal_amount_1 = uint64(10000) @@ -401,8 +388,7 @@ async def test_dao_funding( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # farm blocks to pass proposal for _ in range(5): @@ -413,8 +399,7 @@ async def test_dao_funding( await wallet_0.wallet_state_manager.add_pending_transaction(close_tx_0) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx_0], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Create the other user's wallet from the treasury id dao_wallet_1 = await DAOWallet.create_new_dao_wallet_for_existing_dao( @@ -462,7 +447,6 @@ async def test_dao_proposals( P4 Bad Spend => Force Close """ - num_blocks = 1 full_nodes, wallets, _ = three_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -495,15 +479,11 @@ async def test_dao_proposals( await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -539,8 +519,7 @@ async def test_dao_proposals( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.cat_wallet_id] dao_cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.dao_cat_wallet_id] @@ -601,9 +580,7 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs_1, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) dao_cat_2_bal = await dao_cat_wallet_2.get_votable_balance() txs_2 = await dao_cat_wallet_2.enter_dao_cat_voting_mode(dao_cat_2_bal, DEFAULT_TX_CONFIG) @@ -611,9 +588,7 @@ async def test_dao_proposals( await wallet_2.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs_2, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_2, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await time_out_assert(10, dao_cat_wallet_0.get_confirmed_balance, cat_amt) await time_out_assert(10, dao_cat_wallet_1.get_confirmed_balance, cat_amt) @@ -625,9 +600,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(funding_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[funding_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) # Check that the funding spend is recognized by all wallets await time_out_assert(10, dao_wallet_0.get_balance_by_asset_type, xch_funds) @@ -651,9 +624,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert len(dao_wallet_0.dao_info.proposals_list) == 1 assert dao_wallet_0.dao_info.proposals_list[0].amount_voted == dao_cat_0_bal @@ -675,9 +646,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert len(dao_wallet_0.dao_info.proposals_list) == 2 prop_1 = dao_wallet_0.dao_info.proposals_list[1] @@ -699,9 +668,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert len(dao_wallet_0.dao_info.proposals_list) == 3 prop_2 = dao_wallet_0.dao_info.proposals_list[2] @@ -717,9 +684,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert len(dao_wallet_0.dao_info.proposals_list) == 4 prop_3 = dao_wallet_0.dao_info.proposals_list[3] @@ -732,9 +697,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert len(dao_wallet_0.dao_info.proposals_list) == 5 assert len(dao_wallet_1.dao_info.proposals_list) == 5 @@ -748,9 +711,7 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx_1) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_1], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) vote_tx_2 = await dao_wallet_2.generate_proposal_vote_spend( prop_0.proposal_id, dao_cat_2_bal, False, DEFAULT_TX_CONFIG @@ -758,9 +719,7 @@ async def test_dao_proposals( await wallet_2.wallet_state_manager.add_pending_transaction(vote_tx_2) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_2], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) total_votes = dao_cat_0_bal + dao_cat_1_bal + dao_cat_2_bal assert dao_wallet_0.dao_info.proposals_list[0].amount_voted == total_votes @@ -787,9 +746,7 @@ async def test_dao_proposals( for _ in range(5): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) # Proposal 0: Close close_tx_0 = await dao_wallet_0.create_proposal_close_spend(prop_0.proposal_id, DEFAULT_TX_CONFIG) @@ -799,9 +756,7 @@ async def test_dao_proposals( await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, close_sb_0.name()) await full_node_api.process_spend_bundles(bundles=[close_sb_0]) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await time_out_assert(20, wallet_2.get_confirmed_balance, funds + proposal_amount_1) await time_out_assert( 20, dao_wallet_0.get_balance_by_asset_type, xch_funds - proposal_amount_1 + proposal_min_amt - 1 @@ -818,15 +773,11 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx_1) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_1], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) for _ in range(10): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) prop_1_state = await dao_wallet_0.get_proposal_state(prop_1.proposal_id) assert prop_1_state["passed"] @@ -836,9 +787,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(close_tx_1) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx_1], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await time_out_assert(20, cat_wallet_2.get_confirmed_balance, new_mint_amount) @@ -849,15 +798,11 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx_2) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_2], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) for _ in range(10): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) prop_2_state = await dao_wallet_0.get_proposal_state(prop_2.proposal_id) assert prop_2_state["passed"] @@ -867,9 +812,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(close_tx_2) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx_2], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) assert dao_wallet_0.dao_rules == new_dao_rules assert dao_wallet_1.dao_rules == new_dao_rules @@ -882,15 +825,11 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx_3) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_3], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) for _ in range(10): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) prop_3_state = await dao_wallet_1.get_proposal_state(prop_3.proposal_id) assert not prop_3_state["passed"] @@ -900,9 +839,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(close_tx_3) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx_3], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await time_out_assert(20, wallet_2.get_confirmed_balance, funds + proposal_amount_1) expected_balance = xch_funds - proposal_amount_1 + (3 * proposal_min_amt) - 3 - new_mint_amount @@ -919,15 +856,11 @@ async def test_dao_proposals( await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx_4) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx_4], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) for _ in range(10): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) prop_4_state = await dao_wallet_1.get_proposal_state(prop_4.proposal_id) assert prop_4_state["passed"] @@ -943,9 +876,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(close_tx_4) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx_4], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) # expected balance is unchanged because broken props can't release their amount await time_out_assert(20, dao_wallet_0.get_balance_by_asset_type, expected_balance) @@ -960,9 +891,7 @@ async def test_dao_proposals( await wallet_0.wallet_state_manager.add_pending_transaction(free_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[free_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await dao_wallet_0.clear_finished_proposals_from_memory() await time_out_assert(20, len, 0, dao_wallet_0.dao_info.proposals_list) @@ -975,21 +904,17 @@ async def test_dao_proposals( ) @pytest.mark.anyio async def test_dao_proposal_partial_vote( - self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode + self_hostname: str, two_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 1 - full_nodes, wallets, _ = three_wallet_nodes + full_nodes, wallets, _ = two_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server wallet_node_0, server_0 = wallets[0] wallet_node_1, server_1 = wallets[1] - wallet_node_2, server_2 = wallets[2] - wallet = wallet_node_0.wallet_state_manager.main_wallet + wallet_0 = wallet_node_0.wallet_state_manager.main_wallet wallet_1 = wallet_node_1.wallet_state_manager.main_wallet - wallet_2 = wallet_node_2.wallet_state_manager.main_wallet - ph = await wallet.get_new_puzzlehash() + ph = await wallet_0.get_new_puzzlehash() ph_1 = await wallet_1.get_new_puzzlehash() - ph_2 = await wallet_2.get_new_puzzlehash() if trusted: wallet_node_0.config["trusted_peers"] = { @@ -998,29 +923,20 @@ async def test_dao_proposal_partial_vote( wallet_node_1.config["trusted_peers"] = { full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex() } - wallet_node_2.config["trusted_peers"] = { - full_node_api.full_node.server.node_id.hex(): full_node_api.full_node.server.node_id.hex() - } else: wallet_node_0.config["trusted_peers"] = {} wallet_node_1.config["trusted_peers"] = {} - wallet_node_2.config["trusted_peers"] = {} await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) - await time_out_assert(20, wallet.get_confirmed_balance, funds) + await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) cat_amt = 300000 @@ -1036,7 +952,7 @@ async def test_dao_proposal_partial_vote( dao_wallet_0 = await DAOWallet.create_new_dao_and_wallet( wallet_node_0.wallet_state_manager, - wallet, + wallet_0, uint64(cat_amt), dao_rules, DEFAULT_TX_CONFIG, @@ -1044,11 +960,10 @@ async def test_dao_proposal_partial_vote( assert dao_wallet_0 is not None # Get the full node sim to process the wallet creation spend - tx_queue: List[TransactionRecord] = await wallet_node_0.wallet_state_manager.tx_store.get_not_sent() - tx_record = tx_queue[0] - await full_node_api.process_transaction_records(records=[tx_record]) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) + txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() + await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # get the cat wallets cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.cat_wallet_id] @@ -1059,6 +974,13 @@ async def test_dao_proposal_partial_vote( treasury_id = dao_wallet_0.dao_info.treasury_id + # make sure the next wallet node can find the treasury + assert dao_wallet_0.dao_info.current_treasury_coin is not None + treasury_parent = dao_wallet_0.dao_info.current_treasury_coin.parent_coin_info + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) + await time_out_assert_not_none( + 60, wallet_node_1.fetch_children, treasury_parent, wallet_node_1.get_full_node_peer() + ) # Create the other user's wallet from the treasury id dao_wallet_1 = await DAOWallet.create_new_dao_wallet_for_existing_dao( wallet_node_1.wallet_state_manager, @@ -1074,7 +996,7 @@ async def test_dao_proposal_partial_vote( xch_funds, DEFAULT_TX_CONFIG, ) - await wallet.wallet_state_manager.add_pending_transaction(funding_tx) + await wallet_0.wallet_state_manager.add_pending_transaction(funding_tx) assert isinstance(funding_tx, TransactionRecord) funding_sb = funding_tx.spend_bundle assert isinstance(funding_sb, SpendBundle) @@ -1095,7 +1017,7 @@ async def test_dao_proposal_partial_vote( cat_tx = await cat_wallet_0.generate_signed_transaction([100000], [ph_1], DEFAULT_TX_CONFIG) cat_sb = cat_tx[0].spend_bundle - await wallet.wallet_state_manager.add_pending_transaction(cat_tx[0]) + await wallet_0.wallet_state_manager.add_pending_transaction(cat_tx[0]) await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, cat_sb.name()) await full_node_api.process_transaction_records(records=cat_tx) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) @@ -1106,13 +1028,13 @@ async def test_dao_proposal_partial_vote( dao_cat_0_bal = await dao_cat_wallet_0.get_votable_balance() txs = await dao_cat_wallet_0.enter_dao_cat_voting_mode(dao_cat_0_bal, DEFAULT_TX_CONFIG) for tx in txs: - await wallet.wallet_state_manager.add_pending_transaction(tx) + await wallet_0.wallet_state_manager.add_pending_transaction(tx) dao_cat_sb = txs[0].spend_bundle + assert dao_cat_sb is not None await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, dao_cat_sb.name()) await full_node_api.process_transaction_records(records=txs) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Create a mint proposal recipient_puzzle_hash = await cat_wallet_1.get_new_inner_hash() @@ -1128,15 +1050,14 @@ async def test_dao_proposal_partial_vote( proposal_tx = await dao_wallet_0.generate_new_proposal( mint_proposal_inner, DEFAULT_TX_CONFIG, vote_amount=vote_amount, fee=uint64(1000) ) - await wallet.wallet_state_manager.add_pending_transaction(proposal_tx) + await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) assert isinstance(proposal_tx, TransactionRecord) proposal_sb = proposal_tx.spend_bundle assert isinstance(proposal_sb, SpendBundle) await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, proposal_sb.name()) await full_node_api.process_spend_bundles(bundles=[proposal_sb]) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check the proposal is saved assert len(dao_wallet_0.dao_info.proposals_list) == 1 @@ -1153,11 +1074,11 @@ async def test_dao_proposal_partial_vote( for tx in txs: await wallet_1.wallet_state_manager.add_pending_transaction(tx) dao_cat_sb = txs[0].spend_bundle + assert dao_cat_sb is not None await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, dao_cat_sb.name()) await full_node_api.process_transaction_records(records=txs) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) vote_tx = await dao_wallet_1.generate_proposal_vote_spend( prop.proposal_id, dao_cat_1_bal // 2, True, DEFAULT_TX_CONFIG @@ -1170,8 +1091,7 @@ async def test_dao_proposal_partial_vote( for i in range(1, dao_rules.proposal_timelock + 1): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) total_votes = vote_amount + dao_cat_1_bal // 2 @@ -1182,7 +1102,7 @@ async def test_dao_proposal_partial_vote( try: close_tx = await dao_wallet_0.create_proposal_close_spend(prop.proposal_id, DEFAULT_TX_CONFIG, fee=uint64(100)) - await wallet.wallet_state_manager.add_pending_transaction(close_tx) + await wallet_0.wallet_state_manager.add_pending_transaction(close_tx) close_sb = close_tx.spend_bundle except Exception as e: # pragma: no cover print(e) @@ -1193,8 +1113,7 @@ async def test_dao_proposal_partial_vote( assert close_sb is not None await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, get_proposal_state, (True, True), dao_wallet_0, 0) await time_out_assert(20, get_proposal_state, (True, True), dao_wallet_1, 0) @@ -1209,8 +1128,7 @@ async def test_dao_proposal_partial_vote( await time_out_assert_not_none(5, full_node_api.full_node.mempool_manager.get_spendbundle, cat_sb.name()) await full_node_api.process_transaction_records(records=cat_tx) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, cat_wallet_1.get_spendable_balance, 0) await time_out_assert(20, cat_wallet_0.get_spendable_balance, old_balance + balance + new_mint_amount) @@ -1227,7 +1145,6 @@ async def test_dao_proposal_partial_vote( async def test_dao_rpc_api( self_hostname: str, two_wallet_nodes: Any, trusted: Any, consensus_mode: ConsensusMode ) -> None: - num_blocks = 2 # use 2 here so the test doesn't become flaky if things get slow full_nodes, wallets, _ = two_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -1253,20 +1170,17 @@ async def test_dao_rpc_api( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(1, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) + await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(30, wallet_0.get_unconfirmed_balance, funds) await time_out_assert(30, wallet_0.get_confirmed_balance, funds) - await time_out_assert(30, wallet_node_0.wallet_state_manager.synced, True) + api_0 = WalletRpcApi(wallet_node_0) api_1 = WalletRpcApi(wallet_node_1) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) cat_amt = 300000 fee = 10000 @@ -1391,7 +1305,10 @@ async def test_dao_rpc_api( new_cat_amt - cat_funding_amt, ) - balances = await api_1.dao_get_treasury_balance({"wallet_id": dao_wallet_1_id}) + await rpc_state( + 20, api_0.dao_get_treasury_balance, [{"wallet_id": dao_wallet_0_id}], lambda x: x["balances"]["xch"] + ) + balances = await api_0.dao_get_treasury_balance({"wallet_id": dao_wallet_0_id}) assert balances["balances"]["xch"] == xch_funding_amt assert balances["balances"][cat_id.hex()] == cat_funding_amt @@ -1443,8 +1360,7 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(create_proposal["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: len(x["proposals"]), 1) @@ -1455,10 +1371,6 @@ async def test_dao_rpc_api( assert prop.amount_voted == cat_amt // 2 assert prop.yes_votes == cat_amt // 2 - state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) - assert state["state"]["passed"] - assert not state["state"]["closable"] - # Add votes vote_tx = await api_1.dao_vote_on_proposal( { @@ -1471,18 +1383,17 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(vote_tx["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][0].amount_voted, cat_amt ) # farm blocks until we can close proposal - for _ in range(1, state["state"]["blocks_needed"]): + state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) + for _ in range(state["state"]["blocks_needed"] + 1): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, @@ -1494,10 +1405,14 @@ async def test_dao_rpc_api( proposal_tx = await api_0.dao_close_proposal({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) txs = [TransactionRecord.from_json_dict(proposal_tx["tx"])] - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + try: + await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + except TimeoutError: # pragma: no cover + # try again + await api_0.push_tx({"spend_bundle": txs[0].spend_bundle.stream_to_bytes().hex()}) + await full_node_api.wait_transaction_records_marked_as_in_mempool([txs[0].name], wallet_node_0, 60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][0].closed, True @@ -1535,8 +1450,7 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(mint_proposal["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: len(x["proposals"]), 2) @@ -1547,10 +1461,6 @@ async def test_dao_rpc_api( assert prop.amount_voted == cat_amt // 2 assert prop.yes_votes == cat_amt // 2 - state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) - assert state["state"]["passed"] - assert not state["state"]["closable"] - # Add votes vote_tx = await api_1.dao_vote_on_proposal( { @@ -1563,18 +1473,17 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(vote_tx["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][1].amount_voted, cat_amt ) # farm blocks until we can close proposal - for _ in range(1, state["state"]["blocks_needed"]): + state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) + for _ in range(state["state"]["blocks_needed"] + 1): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, @@ -1586,10 +1495,14 @@ async def test_dao_rpc_api( proposal_tx = await api_0.dao_close_proposal({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) txs = [TransactionRecord.from_json_dict(proposal_tx["tx"])] - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + try: + await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + except TimeoutError: # pragma: no cover + # try again + await api_0.push_tx({"spend_bundle": txs[0].spend_bundle.stream_to_bytes().hex()}) + await full_node_api.wait_transaction_records_marked_as_in_mempool([txs[0].name], wallet_node_0, 60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][1].closed, True @@ -1636,8 +1549,7 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(update_proposal["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: len(x["proposals"]), 3) @@ -1648,10 +1560,6 @@ async def test_dao_rpc_api( assert prop.amount_voted == cat_amt // 2 assert prop.yes_votes == cat_amt // 2 - state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) - assert state["state"]["passed"] - assert not state["state"]["closable"] - # Add votes vote_tx = await api_1.dao_vote_on_proposal( { @@ -1664,18 +1572,17 @@ async def test_dao_rpc_api( txs = [TransactionRecord.from_json_dict(vote_tx["tx"])] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][2].amount_voted, cat_amt ) # farm blocks until we can close proposal - for _ in range(1, state["state"]["blocks_needed"]): + state = await api_0.dao_get_proposal_state({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) + for _ in range(state["state"]["blocks_needed"] + 1): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, @@ -1690,10 +1597,14 @@ async def test_dao_rpc_api( close_tx = await api_0.dao_close_proposal({"wallet_id": dao_wallet_0_id, "proposal_id": prop.proposal_id.hex()}) txs = [TransactionRecord.from_json_dict(close_tx["tx"])] - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + try: + await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + except TimeoutError: # pragma: no cover + # try again + await api_0.push_tx({"spend_bundle": txs[0].spend_bundle.stream_to_bytes().hex()}) + await full_node_api.wait_transaction_records_marked_as_in_mempool([txs[0].name], wallet_node_0, 60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, api_0.dao_get_proposals, [{"wallet_id": dao_wallet_0_id}], lambda x: x["proposals"][1].closed, True @@ -1742,7 +1653,6 @@ async def test_dao_rpc_client( self_hostname: str, consensus_mode: ConsensusMode, ) -> None: - num_blocks = 3 [full_node_service], wallet_services, bt = two_wallet_nodes_services full_node_api = full_node_service._api full_node_server = full_node_api.full_node.server @@ -1765,16 +1675,12 @@ async def test_dao_rpc_client( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(1, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) - initial_funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks)] - ) + initial_funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(15, wallet_0.get_confirmed_balance, initial_funds) await time_out_assert(15, wallet_0.get_unconfirmed_balance, initial_funds) @@ -1829,8 +1735,7 @@ async def test_dao_rpc_client( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, cat_wallet_0.get_confirmed_balance, amount_of_cats) @@ -1843,8 +1748,7 @@ async def test_dao_rpc_client( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # join dao dao_wallet_dict_1 = await client_1.create_new_dao_wallet( @@ -1869,8 +1773,7 @@ async def test_dao_rpc_client( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, client_0.dao_get_treasury_balance, [dao_id_0], lambda x: x["balances"]["xch"], xch_funds) assert isinstance(new_cat_wallet, CATWallet) @@ -1902,8 +1805,7 @@ async def test_dao_rpc_client( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, cat_wallet_0.get_confirmed_balance, cat_amt) await time_out_assert(20, cat_wallet_1.get_confirmed_balance, cat_amt) @@ -1919,8 +1821,7 @@ async def test_dao_rpc_client( await full_node_api.wait_transaction_records_entered_mempool(records=txs_0 + txs_1, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # create a spend proposal additions = [ @@ -1939,8 +1840,7 @@ async def test_dao_rpc_client( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is found by wallet 1 await rpc_state(20, client_1.dao_get_proposals, [dao_id_1], lambda x: x["proposals"][0]["yes_votes"], cat_amt) @@ -1960,8 +1860,7 @@ async def test_dao_rpc_client( txs = await wallet_1.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # create a mint proposal mint_addr = await client_1.get_next_address(wallet_id=wallet_1.id(), new_address=False) @@ -1978,8 +1877,7 @@ async def test_dao_rpc_client( txs = await wallet_1.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # vote spend vote = await client_1.dao_vote_on_proposal( @@ -1994,8 +1892,7 @@ async def test_dao_rpc_client( txs = await wallet_1.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check updated proposal is found by wallet 0 await rpc_state( @@ -2009,8 +1906,7 @@ async def test_dao_rpc_client( for _ in range(0, state["state"]["blocks_needed"]): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) state = await client_0.dao_get_proposal_state(wallet_id=dao_id_0, proposal_id=proposal_id_hex) assert state["success"] @@ -2030,8 +1926,7 @@ async def test_dao_rpc_client( # farm blocks so proposal can close for i in range(1, 10): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # close the proposal close = await client_0.dao_close_proposal( @@ -2040,8 +1935,7 @@ async def test_dao_rpc_client( tx = TransactionRecord.from_json_dict(close["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][0]["closed"], True) @@ -2077,8 +1971,7 @@ async def test_dao_rpc_client( tx = TransactionRecord.from_json_dict(close["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][2]["closed"], True) @@ -2105,8 +1998,7 @@ async def test_dao_rpc_client( tx = TransactionRecord.from_json_dict(close["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][1]["closed"], True) @@ -2126,8 +2018,7 @@ async def test_dao_rpc_client( free_coins_tx = TransactionRecord.from_json_dict(free_coins_res["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[free_coins_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) bal = await client_0.get_wallet_balance(dao_wallet_dict_0["dao_cat_wallet_id"]) assert bal["confirmed_wallet_balance"] == cat_amt @@ -2137,8 +2028,7 @@ async def test_dao_rpc_client( exit_tx = TransactionRecord.from_json_dict(exit["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[exit_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state( 20, @@ -2173,7 +2063,6 @@ async def test_dao_complex_spends( self_hostname: str, consensus_mode: ConsensusMode, ) -> None: - num_blocks = 3 [full_node_service], wallet_services, bt = two_wallet_nodes_services full_node_api = full_node_service._api full_node_server = full_node_api.full_node.server @@ -2196,16 +2085,12 @@ async def test_dao_complex_spends( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(1, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) - initial_funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks)] - ) + initial_funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(15, wallet_0.get_confirmed_balance, initial_funds) await time_out_assert(15, wallet_0.get_unconfirmed_balance, initial_funds) @@ -2258,8 +2143,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, cat_wallet_0.get_confirmed_balance, cat_amt) @@ -2272,8 +2156,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Create a new standard cat for treasury funds new_cat_wallet_dict_2 = await client_0.create_new_cat_and_wallet(new_cat_amt, test=True) @@ -2283,8 +2166,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # join dao dao_wallet_dict_1 = await client_1.create_new_dao_wallet( @@ -2313,8 +2195,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, client_0.dao_get_treasury_balance, [dao_id_0], lambda x: x["balances"]["xch"], xch_funds) assert isinstance(new_cat_wallet, CATWallet) @@ -2347,8 +2228,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Test spend proposal types @@ -2368,8 +2248,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) props = await client_1.dao_get_proposals(dao_id_1) proposal_id_hex = props["proposals"][-1]["proposal_id"] @@ -2381,8 +2260,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][-1]["closed"], True) @@ -2420,8 +2298,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) props = await client_1.dao_get_proposals(dao_id_1) proposal_id_hex = props["proposals"][-1]["proposal_id"] @@ -2433,8 +2310,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][-1]["closed"], True) @@ -2488,8 +2364,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) props = await client_0.dao_get_proposals(dao_id_0) proposal_id_hex = props["proposals"][-1]["proposal_id"] @@ -2504,8 +2379,7 @@ async def test_dao_complex_spends( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][-1]["closed"], True) @@ -2581,7 +2455,6 @@ async def test_dao_complex_spends( async def test_dao_concurrency( self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 3 full_nodes, wallets, _ = three_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -2614,15 +2487,12 @@ async def test_dao_concurrency( await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -2651,8 +2521,7 @@ async def test_dao_concurrency( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # get the cat wallets cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.cat_wallet_id] @@ -2678,8 +2547,7 @@ async def test_dao_concurrency( await wallet_0.wallet_state_manager.add_pending_transaction(funding_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[funding_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check that the funding spend is recognized by both dao wallets await time_out_assert(10, dao_wallet_0.get_balance_by_asset_type, xch_funds) @@ -2708,8 +2576,7 @@ async def test_dao_concurrency( await wallet_0.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=cat_tx, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) cat_wallet_1 = dao_wallet_1.wallet_state_manager.wallets[dao_wallet_1.dao_info.cat_wallet_id] await time_out_assert(10, cat_wallet_1.get_confirmed_balance, 100000) @@ -2725,8 +2592,7 @@ async def test_dao_concurrency( await wallet_0.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Create a proposal for xch spend recipient_puzzle_hash = await wallet_2.get_new_puzzlehash() @@ -2743,8 +2609,7 @@ async def test_dao_concurrency( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check the proposal is saved assert len(dao_wallet_0.dao_info.proposals_list) == 1 @@ -2769,18 +2634,14 @@ async def test_dao_concurrency( await wallet_1.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) txs = await dao_cat_wallet_2.enter_dao_cat_voting_mode(dao_cat_1_bal, DEFAULT_TX_CONFIG) for tx in txs: await wallet_2.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_2, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) vote_tx = await dao_wallet_1.generate_proposal_vote_spend(prop.proposal_id, dao_cat_1_bal, True, DEFAULT_TX_CONFIG) await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx) @@ -2800,9 +2661,7 @@ async def test_dao_concurrency( await time_out_assert(20, int, total_votes, dao_wallet_2.dao_info.proposals_list[0].amount_voted) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_2, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1, wallet_node_2], timeout=30) await time_out_assert(20, int, total_votes * 2, dao_wallet_1.dao_info.proposals_list[0].amount_voted) await time_out_assert(20, int, total_votes * 2, dao_wallet_2.dao_info.proposals_list[0].amount_voted) @@ -2824,7 +2683,6 @@ async def test_dao_cat_exits( self_hostname: str, consensus_mode: ConsensusMode, ) -> None: - num_blocks = 3 # We're using the rpc client, so use 3 blocks to ensure we stay synced [full_node_service], wallet_services, bt = two_wallet_nodes_services full_node_api = full_node_service._api full_node_server = full_node_api.full_node.server @@ -2847,14 +2705,11 @@ async def test_dao_cat_exits( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(1, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - initial_funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks)] - ) + initial_funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(15, wallet_0.get_confirmed_balance, initial_funds) await time_out_assert(15, wallet_0.get_unconfirmed_balance, initial_funds) @@ -2879,7 +2734,6 @@ async def test_dao_cat_exits( try: cat_amt = uint64(150000) - amount_of_cats = cat_amt dao_rules = DAORules( proposal_timelock=uint64(8), soft_close_length=uint64(4), @@ -2893,11 +2747,12 @@ async def test_dao_cat_exits( fee = uint64(10000) # create new dao + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) dao_wallet_dict_0 = await client_0.create_new_dao_wallet( mode="new", tx_config=DEFAULT_TX_CONFIG, dao_rules=dao_rules.to_json_dict(), - amount_of_cats=amount_of_cats, + amount_of_cats=cat_amt, filter_amount=filter_amount, name="DAO WALLET 0", ) @@ -2907,33 +2762,32 @@ async def test_dao_cat_exits( cat_wallet_0 = wallet_node_0.wallet_state_manager.wallets[dao_wallet_dict_0["cat_wallet_id"]] dao_cat_wallet_0 = wallet_node_0.wallet_state_manager.wallets[dao_wallet_dict_0["dao_cat_wallet_id"]] txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) - await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) - - await time_out_assert(60, cat_wallet_0.get_confirmed_balance, amount_of_cats) + for tx in txs: + await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) + await full_node_api.process_transaction_records(records=txs, timeout=60) + await full_node_api.process_all_wallet_transactions(wallet_0, 60) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) + await full_node_api.check_transactions_confirmed(wallet_node_0.wallet_state_manager, txs, 60) + await time_out_assert(60, cat_wallet_0.get_confirmed_balance, cat_amt) # fund treasury xch_funds = uint64(10000000000) funding_tx = await client_0.dao_add_funds_to_treasury(dao_id_0, 1, xch_funds, DEFAULT_TX_CONFIG) assert funding_tx["success"] - txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + tx = TransactionRecord.from_json_dict(funding_tx["tx"]) + await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await rpc_state(20, client_0.dao_get_treasury_balance, [dao_id_0], lambda x: x["balances"]["xch"], xch_funds) # send cats to lockup lockup_0 = await client_0.dao_send_to_lockup(dao_id_0, cat_amt, DEFAULT_TX_CONFIG) assert lockup_0["success"] - txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() + txs = [TransactionRecord.from_json_dict(x) for x in lockup_0["txs"]] await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) assert isinstance(dao_cat_wallet_0, DAOCATWallet) await time_out_assert(60, dao_cat_wallet_0.get_confirmed_balance, cat_amt) @@ -2951,11 +2805,10 @@ async def test_dao_cat_exits( fee=fee, ) assert proposal["success"] - txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + tx = TransactionRecord.from_json_dict(proposal["tx"]) + await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert_not_none(20, client_0.dao_get_proposals, dao_id_0) props = await client_0.dao_get_proposals(dao_id_0) @@ -2966,10 +2819,9 @@ async def test_dao_cat_exits( assert state["success"] assert state["state"]["passed"] - for _ in range(0, state["state"]["blocks_needed"]): + for _ in range(state["state"]["blocks_needed"] + 1): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) state = await client_0.dao_get_proposal_state(wallet_id=dao_id_0, proposal_id=proposal_id_hex) assert state["success"] @@ -2980,11 +2832,10 @@ async def test_dao_cat_exits( wallet_id=dao_id_0, proposal_id=proposal_id_hex, tx_config=DEFAULT_TX_CONFIG, self_destruct=False, fee=fee ) assert close["success"] - txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() - await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) + tx = TransactionRecord.from_json_dict(close["tx"]) + await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # check proposal is closed await rpc_state(20, client_0.dao_get_proposals, [dao_id_0], lambda x: x["proposals"][0]["closed"], True) @@ -2995,8 +2846,7 @@ async def test_dao_cat_exits( tx = TransactionRecord.from_json_dict(res["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) assert isinstance(dao_cat_wallet_0, DAOCATWallet) assert dao_cat_wallet_0.dao_cat_info.locked_coins[0].active_votes == [] @@ -3005,8 +2855,7 @@ async def test_dao_cat_exits( exit_tx = TransactionRecord.from_json_dict(exit["tx"]) await full_node_api.wait_transaction_records_entered_mempool(records=[exit_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, dao_cat_wallet_0.get_confirmed_balance, 0) await time_out_assert(20, cat_wallet_0.get_confirmed_balance, cat_amt) @@ -3027,7 +2876,6 @@ async def test_dao_cat_exits( async def test_dao_reorgs( self_hostname: str, two_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 2 full_nodes, wallets, _ = two_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -3052,14 +2900,11 @@ async def test_dao_reorgs( await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -3088,8 +2933,7 @@ async def test_dao_reorgs( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(60, dao_wallet_0.get_confirmed_balance, uint128(1)) @@ -3131,12 +2975,11 @@ async def test_dao_reorgs( await wallet_0.wallet_state_manager.add_pending_transaction(funding_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[funding_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check that the funding spend is recognized by both dao wallets - await time_out_assert(10, dao_wallet_0.get_balance_by_asset_type, xch_funds) - await time_out_assert(10, dao_wallet_1.get_balance_by_asset_type, xch_funds) + await time_out_assert(20, dao_wallet_0.get_balance_by_asset_type, xch_funds) + await time_out_assert(20, dao_wallet_1.get_balance_by_asset_type, xch_funds) # Reorg funding spend height = full_node_api.full_node.blockchain.get_peak_height() @@ -3145,8 +2988,8 @@ async def test_dao_reorgs( await full_node_api.reorg_from_index_to_new_index( ReorgProtocol(uint32(height - 1), uint32(height + 1), puzzle_hash_0, None) ) - await time_out_assert(10, dao_wallet_0.get_balance_by_asset_type, xch_funds) - await time_out_assert(10, dao_wallet_1.get_balance_by_asset_type, xch_funds) + await time_out_assert(20, dao_wallet_0.get_balance_by_asset_type, xch_funds) + await time_out_assert(20, dao_wallet_1.get_balance_by_asset_type, xch_funds) # Send some dao_cats to wallet_1 # Get the cat wallets for wallet_1 @@ -3164,11 +3007,10 @@ async def test_dao_reorgs( await wallet_0.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=cat_tx, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) cat_wallet_1 = dao_wallet_1.wallet_state_manager.wallets[dao_wallet_1.dao_info.cat_wallet_id] - await time_out_assert(10, cat_wallet_1.get_confirmed_balance, 100000) + await time_out_assert(20, cat_wallet_1.get_confirmed_balance, 100000) # Create dao cats for voting dao_cat_0_bal = await dao_cat_wallet_0.get_votable_balance() @@ -3178,8 +3020,7 @@ async def test_dao_reorgs( await wallet_0.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Create a proposal for xch spend recipient_puzzle_hash = await wallet_0.get_new_puzzlehash() @@ -3196,8 +3037,7 @@ async def test_dao_reorgs( await wallet_0.wallet_state_manager.add_pending_transaction(proposal_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[proposal_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) # Check the proposal is saved assert len(dao_wallet_0.dao_info.proposals_list) == 1 @@ -3233,15 +3073,13 @@ async def test_dao_reorgs( await wallet_1.wallet_state_manager.add_pending_transaction(tx) await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) vote_tx = await dao_wallet_1.generate_proposal_vote_spend(prop.proposal_id, dao_cat_1_bal, True, DEFAULT_TX_CONFIG) await wallet_1.wallet_state_manager.add_pending_transaction(vote_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[vote_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_1, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) assert dao_wallet_0.dao_info.proposals_list[0].amount_voted == dao_cat_0_bal + dao_cat_1_bal assert dao_wallet_0.dao_info.proposals_list[0].yes_votes == dao_cat_0_bal + dao_cat_1_bal @@ -3263,15 +3101,13 @@ async def test_dao_reorgs( # Close proposal for i in range(5): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) close_tx = await dao_wallet_0.create_proposal_close_spend(prop.proposal_id, DEFAULT_TX_CONFIG, fee=uint64(100)) await wallet_0.wallet_state_manager.add_pending_transaction(close_tx) await full_node_api.wait_transaction_records_entered_mempool(records=[close_tx], timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, get_proposal_state, (True, True), *[dao_wallet_0, 0]) await time_out_assert(20, get_proposal_state, (True, True), *[dao_wallet_1, 0]) @@ -3283,8 +3119,7 @@ async def test_dao_reorgs( await full_node_api.reorg_from_index_to_new_index( ReorgProtocol(uint32(height - 1), uint32(height + 1), puzzle_hash_0, None) ) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) await time_out_assert(20, get_proposal_state, (True, True), *[dao_wallet_0, 0]) await time_out_assert(20, get_proposal_state, (True, True), *[dao_wallet_1, 0]) @@ -3298,7 +3133,6 @@ async def test_dao_reorgs( async def test_dao_votes( self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode ) -> None: - num_blocks = 1 full_nodes, wallets, _ = three_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server @@ -3331,15 +3165,12 @@ async def test_dao_votes( await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) await server_2.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None) - for i in range(0, num_blocks): - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) - await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_0)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1)) + await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_2)) await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash_0)) - funds = sum( - [calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i)) for i in range(1, num_blocks + 1)] - ) + funds = calculate_pool_reward(uint32(1)) + calculate_base_farmer_reward(uint32(1)) await time_out_assert(20, wallet_0.get_confirmed_balance, funds) await time_out_assert(20, full_node_api.wallet_is_synced, True, wallet_node_0) @@ -3372,8 +3203,7 @@ async def test_dao_votes( txs = await wallet_0.wallet_state_manager.tx_store.get_all_unconfirmed() await full_node_api.wait_transaction_records_entered_mempool(records=txs, timeout=60) await full_node_api.process_all_wallet_transactions(wallet_0, timeout=60) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_0, timeout=30) - await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30) + await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_0, wallet_node_1], timeout=30) cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.cat_wallet_id] dao_cat_wallet_0 = dao_wallet_0.wallet_state_manager.wallets[dao_wallet_0.dao_info.dao_cat_wallet_id]