Skip to content

Commit

Permalink
rename NULL_TREEHASH -> NIL_TREEHASH
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed May 9, 2024
1 parent 28115ba commit 463f12f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions chia/rpc/wallet_rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
from chia.wallet.util.address_type import AddressType, is_valid_address
from chia.wallet.util.compute_hints import compute_spend_hints_and_additions
from chia.wallet.util.compute_memos import compute_memos
from chia.wallet.util.curry_and_treehash import NULL_TREEHASH
from chia.wallet.util.curry_and_treehash import NIL_TREEHASH
from chia.wallet.util.query_filter import HashFilter, TransactionTypeFilter
from chia.wallet.util.transaction_type import CLAWBACK_INCOMING_TRANSACTION_TYPES, TransactionType
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, CoinSelectionConfig, CoinSelectionConfigLoader, TXConfig
Expand Down Expand Up @@ -2333,7 +2333,7 @@ async def did_find_lost_did(self, request: Dict[str, Any]) -> EndpointResult:
)
full_puzzle = create_singleton_puzzle(did_puzzle, launcher_id)
did_puzzle_empty_recovery = DID_INNERPUZ_MOD.curry(
our_inner_puzzle, NULL_TREEHASH, uint64(0), singleton_struct, metadata
our_inner_puzzle, NIL_TREEHASH, uint64(0), singleton_struct, metadata
)
# Check if we have the DID wallet
did_wallet: Optional[DIDWallet] = None
Expand Down Expand Up @@ -2423,7 +2423,7 @@ async def did_find_lost_did(self, request: Dict[str, Any]) -> EndpointResult:
inner_solution: Program = full_solution.rest().rest().first()
recovery_list: List[bytes32] = []
backup_required: int = num_verification.as_int()
if recovery_list_hash != NULL_TREEHASH:
if recovery_list_hash != NIL_TREEHASH:
try:
for did in inner_solution.rest().rest().rest().rest().rest().as_python():
recovery_list.append(did[0])
Expand Down
6 changes: 3 additions & 3 deletions chia/wallet/did_wallet/did_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from chia.wallet.transaction_record import TransactionRecord
from chia.wallet.uncurried_puzzle import uncurry_puzzle
from chia.wallet.util.compute_memos import compute_memos
from chia.wallet.util.curry_and_treehash import NULL_TREEHASH, shatree_int, shatree_pair
from chia.wallet.util.curry_and_treehash import NIL_TREEHASH, shatree_int, shatree_pair
from chia.wallet.util.transaction_type import TransactionType
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, CoinSelectionConfig, TXConfig
from chia.wallet.util.wallet_sync_utils import fetch_coin_spend, fetch_coin_spend_for_coin_state
Expand Down Expand Up @@ -228,7 +228,7 @@ async def create_new_did_wallet_from_coin_spend(
inner_solution: Program = full_solution.rest().rest().first()
recovery_list: List[bytes32] = []
backup_required: int = num_verification.as_int()
if recovery_list_hash != NULL_TREEHASH:
if recovery_list_hash != NIL_TREEHASH:
try:
for did in inner_solution.rest().rest().rest().rest().rest().as_python():
recovery_list.append(bytes32(did[0]))
Expand Down Expand Up @@ -531,7 +531,7 @@ def puzzle_hash_for_pk(self, pubkey: G1Element) -> bytes32:
if self.did_info.origin_coin is None:
# TODO: this seem dumb. Why bother with this case? Is it ever used?
# inner puzzle: (8 . 0)
innerpuz_hash = shatree_pair(shatree_int(8), NULL_TREEHASH)
innerpuz_hash = shatree_pair(shatree_int(8), NIL_TREEHASH)
return create_singleton_puzzle_hash(innerpuz_hash, bytes32([0] * 32))
origin_coin_name = self.did_info.origin_coin.name()
innerpuz_hash = did_wallet_puzzles.get_inner_puzhash_by_p2(
Expand Down
8 changes: 4 additions & 4 deletions chia/wallet/util/curry_and_treehash.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def shatree_pair(left_hash: bytes32, right_hash: bytes32) -> bytes32:
A_KW_TREEHASH = shatree_atom(A_KW)
C_KW_TREEHASH = shatree_atom(C_KW)
ONE_TREEHASH = shatree_atom(ONE)
NULL_TREEHASH = shatree_atom(NULL)
NIL_TREEHASH = shatree_atom(NULL)


def shatree_atom_list(li: Sequence[bytes]) -> bytes32:
ret = NULL_TREEHASH
ret = NIL_TREEHASH
for item in reversed(li):
ret = shatree_pair(shatree_atom(item), ret)
return ret
Expand All @@ -64,7 +64,7 @@ def curried_values_tree_hash(arguments: List[bytes32]) -> bytes32:
C_KW_TREEHASH,
shatree_pair(
shatree_pair(Q_KW_TREEHASH, arguments[0]),
shatree_pair(curried_values_tree_hash(arguments[1:]), NULL_TREEHASH),
shatree_pair(curried_values_tree_hash(arguments[1:]), NIL_TREEHASH),
),
)

Expand All @@ -82,7 +82,7 @@ def curry_and_treehash(hash_of_quoted_mod_hash: bytes32, *hashed_arguments: byte
curried_values = curried_values_tree_hash(list(hashed_arguments))
return shatree_pair(
A_KW_TREEHASH,
shatree_pair(hash_of_quoted_mod_hash, shatree_pair(curried_values, NULL_TREEHASH)),
shatree_pair(hash_of_quoted_mod_hash, shatree_pair(curried_values, NIL_TREEHASH)),
)


Expand Down
4 changes: 2 additions & 2 deletions chia/wallet/wallet_state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
from chia.wallet.util.address_type import AddressType
from chia.wallet.util.compute_hints import compute_spend_hints_and_additions
from chia.wallet.util.compute_memos import compute_memos
from chia.wallet.util.curry_and_treehash import NULL_TREEHASH
from chia.wallet.util.curry_and_treehash import NIL_TREEHASH
from chia.wallet.util.puzzle_decorator import PuzzleDecoratorManager
from chia.wallet.util.query_filter import HashFilter
from chia.wallet.util.transaction_type import CLAWBACK_INCOMING_TRANSACTION_TYPES, TransactionType
Expand Down Expand Up @@ -1255,7 +1255,7 @@ async def handle_did(
full_puzzle = create_singleton_puzzle(did_puzzle, launch_id)
did_puzzle_empty_recovery = DID_INNERPUZ_MOD.curry(
our_inner_puzzle,
NULL_TREEHASH,
NIL_TREEHASH,
uint64(0),
parent_data.singleton_struct,
parent_data.metadata,
Expand Down

0 comments on commit 463f12f

Please sign in to comment.