Skip to content

Commit

Permalink
Merge branch 'long_lived/datalayer_merkle_blob' into add_rs_merkle_blob
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Dec 20, 2024
2 parents a29fd8e + 3d4ce9d commit 0437c9f
Show file tree
Hide file tree
Showing 93 changed files with 3,902 additions and 2,127 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/conflict-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: 🩹 Conflict Check
on:
# So that PRs touching the same files as the push are updated
push:
branches-ignore:
- "tmp/**"
# So that the `dirtyLabel` is removed if conflicts are resolve
# We recommend `pull_request_target` so that github secrets are available.
# In `pull_request` we wouldn't be able to change labels of fork PRs
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ repos:
language: system
require_serial: true
types_or: [python, pyi]
- repo: local
hooks:
- id: ruff
name: Ruff
entry: ./activated.py ruff check --fix
language: system
types: [python]
- repo: local
hooks:
- id: poetry
Expand Down Expand Up @@ -71,13 +78,6 @@ repos:
entry: ./activated.py python chia/util/virtual_project_analysis.py print_cycles --directory chia --config virtual_project.yaml
language: system
pass_filenames: false
- repo: local
hooks:
- id: ruff
name: Ruff
entry: ./activated.py ruff check --fix
language: system
types: [python]
- repo: local
hooks:
- id: build mypy.ini
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project does not yet adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
for setuptools_scm/PEP 440 reasons.

## 2.5.0 Chia blockchain 2024-12-12

## What's Changed

### Added

- Implemented CHIP-36: Introduced new soft-fork with CLVM `keccak256` operator

### Changed

- Bump `chia_rs` to `0.16.0`

### Removed

- Python 3.8 support has been removed

## 2.4.4 Chia blockchain 2024-10-15

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion chia-blockchain-gui
18 changes: 9 additions & 9 deletions chia/_tests/blockchain/test_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async def test_long_chain(self, empty_blockchain: Blockchain, default_1000_block
block_bad = recursive_replace(
block, "finished_sub_slots", [new_finished_ss] + block.finished_sub_slots[1:]
)
header_block_bad = get_block_header(block_bad, [], [])
header_block_bad = get_block_header(block_bad)
# TODO: Inspect these block values as they are currently None
expected_difficulty = block.finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand All @@ -195,7 +195,7 @@ async def test_long_chain(self, empty_blockchain: Blockchain, default_1000_block
block, "finished_sub_slots", [new_finished_ss_2] + block.finished_sub_slots[1:]
)

header_block_bad_2 = get_block_header(block_bad_2, [], [])
header_block_bad_2 = get_block_header(block_bad_2)
# TODO: Inspect these block values as they are currently None
expected_difficulty = block.finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand Down Expand Up @@ -225,7 +225,7 @@ async def test_long_chain(self, empty_blockchain: Blockchain, default_1000_block
log.warning(f"Number of slots: {len(block.finished_sub_slots)}")
block_bad_3 = recursive_replace(block, "finished_sub_slots", [new_finished_ss_3])

header_block_bad_3 = get_block_header(block_bad_3, [], [])
header_block_bad_3 = get_block_header(block_bad_3)
# TODO: Inspect these block values as they are currently None
expected_difficulty = block.finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand Down Expand Up @@ -254,7 +254,7 @@ async def test_long_chain(self, empty_blockchain: Blockchain, default_1000_block
)
block_bad_4 = recursive_replace(block, "finished_sub_slots", [new_finished_ss_4])

header_block_bad_4 = get_block_header(block_bad_4, [], [])
header_block_bad_4 = get_block_header(block_bad_4)
# TODO: Inspect these block values as they are currently None
expected_difficulty = block.finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand Down Expand Up @@ -510,7 +510,7 @@ async def test_invalid_sub_slot_challenge_hash_genesis(self, empty_blockchain: B
blocks[0], "finished_sub_slots", [new_finished_ss] + blocks[0].finished_sub_slots[1:]
)

header_block_bad = get_block_header(block_0_bad, [], [])
header_block_bad = get_block_header(block_0_bad)
expected_vs = ValidationState(
empty_blockchain.constants.SUB_SLOT_ITERS_STARTING, empty_blockchain.constants.DIFFICULTY_STARTING, None
)
Expand Down Expand Up @@ -539,7 +539,7 @@ async def test_invalid_sub_slot_challenge_hash_non_genesis(
)

await _validate_and_add_block(empty_blockchain, blocks[0])
header_block_bad = get_block_header(block_1_bad, [], [])
header_block_bad = get_block_header(block_1_bad)
# TODO: Inspect these block values as they are currently None
expected_difficulty = blocks[1].finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = blocks[1].finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand All @@ -566,7 +566,7 @@ async def test_invalid_sub_slot_challenge_hash_empty_ss(self, empty_blockchain:
)
await _validate_and_add_block(empty_blockchain, blocks[0])

header_block_bad = get_block_header(block_1_bad, [], [])
header_block_bad = get_block_header(block_1_bad)
# TODO: Inspect these block values as they are currently None
expected_difficulty = blocks[1].finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = blocks[1].finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand Down Expand Up @@ -721,7 +721,7 @@ async def test_invalid_icc_into_cc(self, empty_blockchain: Blockchain, bt: Block
block, "finished_sub_slots", block.finished_sub_slots[:-1] + [new_finished_ss]
)

header_block_bad = get_block_header(block_bad, [], [])
header_block_bad = get_block_header(block_bad)
# TODO: Inspect these block values as they are currently None
expected_difficulty = block.finished_sub_slots[0].challenge_chain.new_difficulty or uint64(0)
expected_sub_slot_iters = block.finished_sub_slots[0].challenge_chain.new_sub_slot_iters or uint64(0)
Expand Down Expand Up @@ -792,7 +792,7 @@ async def test_empty_slot_no_ses(self, empty_blockchain: Blockchain, bt: BlockTo
blocks[-1], "finished_sub_slots", blocks[-1].finished_sub_slots[:-1] + [new_finished_ss]
)

header_block_bad = get_block_header(block_bad, [], [])
header_block_bad = get_block_header(block_bad)
expected_vs = ValidationState(
empty_blockchain.constants.SUB_SLOT_ITERS_STARTING, empty_blockchain.constants.DIFFICULTY_STARTING, None
)
Expand Down
6 changes: 3 additions & 3 deletions chia/_tests/cmds/cmd_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ def create_service_and_wallet_client_generators(test_rpc_clients: TestRpcClients
@asynccontextmanager
async def test_get_any_service_client(
client_type: type[_T_RpcClient],
root_path: Path,
rpc_port: Optional[int] = None,
root_path: Optional[Path] = None,
consume_errors: bool = True,
use_ssl: bool = True,
) -> AsyncIterator[tuple[_T_RpcClient, dict[str, Any]]]:
Expand All @@ -409,11 +409,11 @@ async def test_get_any_service_client(

@asynccontextmanager
async def test_get_wallet_client(
root_path: Path = default_root,
wallet_rpc_port: Optional[int] = None,
fingerprint: Optional[int] = None,
root_path: Path = default_root,
) -> AsyncIterator[tuple[WalletRpcClient, int, dict[str, Any]]]:
async with test_get_any_service_client(WalletRpcClient, wallet_rpc_port, root_path) as (wallet_client, config):
async with test_get_any_service_client(WalletRpcClient, root_path, wallet_rpc_port) as (wallet_client, config):
wallet_client.fingerprint = fingerprint # type: ignore
assert fingerprint is not None
yield wallet_client, fingerprint, config
Expand Down
28 changes: 17 additions & 11 deletions chia/_tests/cmds/test_click_types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

from dataclasses import dataclass, field
from decimal import Decimal
from pathlib import Path
from typing import Any, cast

import click
import pytest
from click import BadParameter, Context
from click import BadParameter

from chia.cmds.cmd_classes import ChiaCliContext
from chia.cmds.param_types import (
AddressParamType,
AmountParamType,
Expand Down Expand Up @@ -38,9 +38,9 @@
overflow_decimal = Decimal(overflow_decimal_str)


@dataclass
class FakeContext:
obj: dict[Any, Any] = field(default_factory=dict)
@click.command()
def a_command_for_testing() -> None:
pass # pragma: no cover


def test_click_tx_fee_type() -> None:
Expand Down Expand Up @@ -114,7 +114,11 @@ def test_click_amount_type() -> None:


def test_click_address_type() -> None:
context = cast(Context, FakeContext(obj={"expected_prefix": "xch"})) # this makes us not have to use a config file
context = click.Context(command=a_command_for_testing)
chia_context = ChiaCliContext.set_default(context)
# this makes us not have to use a config file
chia_context.expected_prefix = "xch"

std_cli_address = CliAddress(burn_ph, burn_address, AddressType.XCH)
nft_cli_address = CliAddress(burn_ph, burn_nft_addr, AddressType.DID)
# Test CliAddress (Generally is not used)
Expand All @@ -132,7 +136,7 @@ def test_click_address_type() -> None:
# check error handling
with pytest.raises(BadParameter):
AddressParamType().convert("test", None, None)
with pytest.raises(AttributeError): # attribute error because the context does not have a real error handler
with pytest.raises(click.BadParameter):
AddressParamType().convert(burn_address_txch, None, context)
with pytest.raises(BadParameter):
AddressParamType().convert(burn_bad_prefix, None, None)
Expand All @@ -148,13 +152,15 @@ def test_click_address_type() -> None:


def test_click_address_type_config(root_path_populated_with_config: Path) -> None:
context = click.Context(command=a_command_for_testing)
chia_context = ChiaCliContext.set_default(context)
# set a root path in context.
context = cast(Context, FakeContext(obj={"root_path": root_path_populated_with_config}))
chia_context.root_path = root_path_populated_with_config
# run test that should pass
assert AddressParamType().convert(burn_address, None, context) == CliAddress(burn_ph, burn_address, AddressType.XCH)
assert context.obj["expected_prefix"] == "xch" # validate that the prefix was set correctly
assert ChiaCliContext.set_default(context).expected_prefix == "xch" # validate that the prefix was set correctly
# use txch address
with pytest.raises(AttributeError): # attribute error because the context does not have a real error handler
with pytest.raises(click.BadParameter):
AddressParamType().convert(burn_address_txch, None, context)


Expand Down
Loading

0 comments on commit 0437c9f

Please sign in to comment.