mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-09-28 01:56:38 -04:00
Enable Keccak for 2.5.4 (#19563)
* Backport enabling Keccak by default for wallet * Keep ENABLE_KECCAK when not using mempool_mode
This commit is contained in:
@@ -19,7 +19,6 @@ from typing import Any, Callable, Optional
|
||||
import anyio
|
||||
from chia_puzzles_py.programs import CHIALISP_DESERIALISATION, ROM_BOOTSTRAP_GENERATOR
|
||||
from chia_rs import (
|
||||
MEMPOOL_MODE,
|
||||
AugSchemeMPL,
|
||||
ConsensusConstants,
|
||||
G1Element,
|
||||
@@ -75,7 +74,7 @@ from chia.simulator.wallet_tools import WalletTool
|
||||
from chia.ssl.create_ssl import create_all_ssl
|
||||
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
||||
from chia.types.blockchain_format.coin import Coin
|
||||
from chia.types.blockchain_format.program import INFINITE_COST, Program
|
||||
from chia.types.blockchain_format.program import DEFAULT_FLAGS, INFINITE_COST, Program
|
||||
from chia.types.blockchain_format.proof_of_space import (
|
||||
ProofOfSpace,
|
||||
calculate_pos_challenge,
|
||||
@@ -1951,7 +1950,7 @@ def compute_cost_test(generator: BlockGenerator, constants: ConsensusConstants,
|
||||
|
||||
if height >= constants.HARD_FORK_HEIGHT:
|
||||
blocks = generator.generator_refs
|
||||
cost, result = generator.program._run(INFINITE_COST, MEMPOOL_MODE, [DESERIALIZE_MOD, blocks])
|
||||
cost, result = generator.program._run(INFINITE_COST, DEFAULT_FLAGS, [DESERIALIZE_MOD, blocks])
|
||||
clvm_cost += cost
|
||||
|
||||
for spend in result.first().as_iter():
|
||||
@@ -1960,13 +1959,13 @@ def compute_cost_test(generator: BlockGenerator, constants: ConsensusConstants,
|
||||
puzzle = spend.at("rf")
|
||||
solution = spend.at("rrrf")
|
||||
|
||||
cost, result = puzzle._run(INFINITE_COST, MEMPOOL_MODE, solution)
|
||||
cost, result = puzzle._run(INFINITE_COST, DEFAULT_FLAGS, solution)
|
||||
clvm_cost += cost
|
||||
condition_cost += conditions_cost(result)
|
||||
|
||||
else:
|
||||
block_program_args = SerializedProgram.to([generator.generator_refs])
|
||||
clvm_cost, result = GENERATOR_MOD._run(INFINITE_COST, MEMPOOL_MODE, [generator.program, block_program_args])
|
||||
clvm_cost, result = GENERATOR_MOD._run(INFINITE_COST, DEFAULT_FLAGS, [generator.program, block_program_args])
|
||||
|
||||
for res in result.first().as_iter():
|
||||
# each condition item is:
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import io
|
||||
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar
|
||||
|
||||
from chia_rs import MEMPOOL_MODE, run_chia_program, tree_hash
|
||||
from chia_rs import ENABLE_KECCAK, MEMPOOL_MODE, run_chia_program, tree_hash
|
||||
from chia_rs.sized_bytes import bytes32
|
||||
from clvm.casts import int_from_bytes
|
||||
from clvm.CLVMObject import CLVMStorage
|
||||
@@ -17,7 +17,7 @@ from chia.util.hash import std_hash
|
||||
|
||||
INFINITE_COST = 11000000000
|
||||
|
||||
DEFAULT_FLAGS = MEMPOOL_MODE
|
||||
DEFAULT_FLAGS = MEMPOOL_MODE | ENABLE_KECCAK
|
||||
|
||||
T_CLVMStorage = TypeVar("T_CLVMStorage", bound=CLVMStorage)
|
||||
T_Program = TypeVar("T_Program", bound="Program")
|
||||
|
||||
Reference in New Issue
Block a user