Skip to content

Commit

Permalink
Remove the coin amount from state layer solution (#18500)
Browse files Browse the repository at this point in the history
* Remove the coin amount from state layer solution

* Remove unused imports
  • Loading branch information
Rigidity authored Sep 4, 2024
1 parent c1d9a05 commit 2fd02d5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions chia/wallet/nft_wallet/metadata_outer_puzzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
from dataclasses import dataclass
from typing import Callable, List, Optional, Tuple

from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint64
from chia.wallet.puzzle_drivers import PuzzleInfo, Solver
from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile
from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle
Expand All @@ -27,8 +25,8 @@ def puzzle_for_metadata_layer(metadata: Program, updater_hash: bytes32, inner_pu
return NFT_STATE_LAYER_MOD.curry(NFT_STATE_LAYER_MOD_HASH, metadata, updater_hash, inner_puzzle)


def solution_for_metadata_layer(amount: uint64, inner_solution: Program) -> Program:
return Program.to([inner_solution, amount])
def solution_for_metadata_layer(inner_solution: Program) -> Program:
return Program.to([inner_solution])


@dataclass(frozen=True)
Expand Down Expand Up @@ -88,12 +86,7 @@ def get_inner_solution(self, constructor: PuzzleInfo, solution: Program) -> Opti
return my_inner_solution

def solve(self, constructor: PuzzleInfo, solver: Solver, inner_puzzle: Program, inner_solution: Program) -> Program:
coin_bytes: bytes = solver["coin"]
coin: Coin = Coin(bytes32(coin_bytes[0:32]), bytes32(coin_bytes[32:64]), uint64.from_bytes(coin_bytes[64:72]))
also = constructor.also()
if also is not None:
inner_solution = self._solve(also, solver, inner_puzzle, inner_solution)
return solution_for_metadata_layer(
uint64(coin.amount),
inner_solution,
)
return solution_for_metadata_layer(inner_solution)

0 comments on commit 2fd02d5

Please sign in to comment.