Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the coin amount from state layer solution #18500

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading