Skip to content

Commit 9abbcb6

Browse files
authored
catchup: into long_lived/datalayer_merkle_blob from main @ 73cb547 (#20070)
Source hash: 73cb547 Remaining commits: 0
2 parents 0d7a723 + 5f5ab60 commit 9abbcb6

30 files changed

+824
-704
lines changed

.github/workflows/build-linux-installer-deb.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ jobs:
9292
env:
9393
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9494

95+
- name: Setup Node per .nvmrc in GUI
96+
uses: actions/setup-node@v5
97+
with:
98+
node-version-file: chia-blockchain-gui/.nvmrc
99+
95100
- name: Get latest madmax plotter
96101
env:
97102
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-linux-installer-rpm.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ jobs:
8282
env:
8383
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8484

85+
- name: Setup Node per .nvmrc in GUI
86+
uses: actions/setup-node@v5
87+
with:
88+
node-version-file: chia-blockchain-gui/.nvmrc
89+
8590
- name: Get latest madmax plotter
8691
env:
8792
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-macos-installers.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ jobs:
176176

177177
- uses: chia-network/actions/activate-venv@main
178178

179-
- name: Setup Node 20.x
180-
uses: actions/setup-node@v4
179+
- name: Setup Node per .nvmrc in GUI
180+
uses: actions/setup-node@v5
181181
with:
182-
node-version: "20.x"
182+
node-version-file: chia-blockchain-gui/.nvmrc
183183

184184
- name: Prepare GUI cache
185185
id: gui-ref

.github/workflows/build-windows-installer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ jobs:
9595
with:
9696
python-version: ${{ matrix.python-version }}
9797

98-
- name: Setup Node 20.x
99-
uses: actions/setup-node@v4
98+
- name: Setup Node per .nvmrc in GUI
99+
uses: actions/setup-node@v5
100100
with:
101-
node-version: "20.x"
101+
node-version-file: chia-blockchain-gui/.nvmrc
102102

103103
- name: Test for secrets access
104104
id: check_secrets

.github/workflows/test.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ on:
4040
default: 1
4141
required: false
4242
type: number
43-
run-linux:
44-
description: "run Linux tests"
43+
run-linux-intel:
44+
description: "run Linux-intel tests"
45+
default: true
46+
required: false
47+
type: boolean
48+
run-linux-arm:
49+
description: "run Linux-arm tests"
4550
default: true
4651
required: false
4752
type: boolean
@@ -151,22 +156,38 @@ jobs:
151156
arch: arm
152157
arch-emoji: 💪
153158
collect-junit: false
154-
ubuntu:
155-
if: github.event_name != 'workflow_dispatch' || inputs.run-linux
159+
ubuntu-intel:
160+
if: github.event_name != 'workflow_dispatch' || inputs.run-linux-intel
156161
uses: ./.github/workflows/test-single.yml
157162
needs: configure
158163
with:
159164
os-emoji: 🐧
160165
matrix: ubuntu
161166
name: Ubuntu
162-
file_name: ubuntu
163-
concurrency-name: ubuntu
167+
file_name: ubuntu-intel
168+
concurrency-name: ubuntu-intel
164169
configuration: ${{ needs.configure.outputs.configuration }}
165170
matrix_mode: ${{ needs.configure.outputs.matrix_mode }}
166171
runs-on: ubuntu-latest
167172
arch: intel
168173
arch-emoji: 🌀
169174
collect-junit: false
175+
ubuntu-arm:
176+
if: github.event_name != 'workflow_dispatch' || inputs.run-linux-arm
177+
uses: ./.github/workflows/test-single.yml
178+
needs: configure
179+
with:
180+
os-emoji: 🐧
181+
matrix: ubuntu
182+
name: Ubuntu
183+
file_name: ubuntu-arm
184+
concurrency-name: ubuntu-arm
185+
configuration: ${{ needs.configure.outputs.configuration }}
186+
matrix_mode: ${{ needs.configure.outputs.matrix_mode }}
187+
runs-on: ubuntu-24.04-arm
188+
arch: arm
189+
arch-emoji: 💪
190+
collect-junit: false
170191
windows:
171192
if: github.event_name != 'workflow_dispatch' || inputs.run-windows
172193
uses: ./.github/workflows/test-single.yml
@@ -192,7 +213,8 @@ jobs:
192213
- configure
193214
- macos-intel
194215
- macos-arm
195-
- ubuntu
216+
- ubuntu-intel
217+
- ubuntu-arm
196218
- windows
197219
strategy:
198220
fail-fast: false

build_scripts/build_linux_deb-2-installer.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,9 @@ jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json >temp.json &
8686
echo "Building Linux(deb) Electron app"
8787
PRODUCT_NAME="chia"
8888
if [ "$PLATFORM" = "arm64" ]; then
89-
# electron-builder does not work for arm64 as of Aug 16, 2022.
90-
# This is a temporary fix.
9189
# https://github.com/jordansissel/fpm/issues/1801#issuecomment-919877499
92-
# @TODO Consolidates the process to amd64 if the issue of electron-builder is resolved
93-
sudo apt-get -y install ruby ruby-dev
94-
sudo gem install fpm
90+
# workaround for above now implemented in the image build at
91+
# https://github.com/Chia-Network/build-images/blob/7c74d2f20739543c486c2522032cf09d96396d24/ubuntu-22.04/Dockerfile#L48-L61
9592
echo USE_SYSTEM_FPM=true "${NPM_PATH}/electron-builder" build --linux deb --arm64 \
9693
--config.extraMetadata.name=chia-blockchain \
9794
--config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Chia Blockchain" \

chia-blockchain-gui

Submodule chia-blockchain-gui updated 131 files

chia/_tests/cmds/cmd_test_utils.py

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from chia.full_node.full_node_rpc_client import FullNodeRpcClient
2323
from chia.rpc.rpc_client import RpcClient
2424
from chia.simulator.simulator_full_node_rpc_client import SimulatorFullNodeRpcClient
25-
from chia.types.coin_record import CoinRecord
2625
from chia.types.signing_mode import SigningMode
2726
from chia.util.bech32m import encode_puzzle_hash
2827
from chia.util.config import load_config
@@ -31,7 +30,7 @@
3130
from chia.wallet.nft_wallet.nft_wallet import NFTWallet
3231
from chia.wallet.transaction_record import TransactionRecord
3332
from chia.wallet.util.transaction_type import TransactionType
34-
from chia.wallet.util.tx_config import CoinSelectionConfig, TXConfig
33+
from chia.wallet.util.tx_config import TXConfig
3534
from chia.wallet.util.wallet_types import WalletType
3635
from chia.wallet.wallet_request_types import (
3736
GetSyncStatusResponse,
@@ -232,46 +231,6 @@ async def nft_calculate_royalties(
232231
)
233232
)
234233

235-
async def get_spendable_coins(
236-
self,
237-
wallet_id: int,
238-
coin_selection_config: CoinSelectionConfig,
239-
) -> tuple[list[CoinRecord], list[CoinRecord], list[Coin]]:
240-
"""
241-
We return a tuple containing: (confirmed records, unconfirmed removals, unconfirmed additions)
242-
"""
243-
self.add_to_log(
244-
"get_spendable_coins",
245-
(wallet_id, coin_selection_config),
246-
)
247-
confirmed_records = [
248-
CoinRecord(
249-
Coin(bytes32([1] * 32), bytes32([2] * 32), uint64(1234560000)),
250-
uint32(123456),
251-
uint32(0),
252-
False,
253-
uint64(0),
254-
),
255-
CoinRecord(
256-
Coin(bytes32([3] * 32), bytes32([4] * 32), uint64(1234560000)),
257-
uint32(123456),
258-
uint32(0),
259-
False,
260-
uint64(0),
261-
),
262-
]
263-
unconfirmed_removals = [
264-
CoinRecord(
265-
Coin(bytes32([5] * 32), bytes32([6] * 32), uint64(1234570000)),
266-
uint32(123457),
267-
uint32(0),
268-
True,
269-
uint64(0),
270-
)
271-
]
272-
unconfirmed_additions = [Coin(bytes32([7] * 32), bytes32([8] * 32), uint64(1234580000))]
273-
return confirmed_records, unconfirmed_removals, unconfirmed_additions
274-
275234
async def send_transaction_multi(
276235
self,
277236
wallet_id: int,

chia/_tests/core/full_node/test_full_node.py

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,10 @@ async def suppress_value_error(coro: Coroutine[Any, Any, None]) -> None:
919919

920920

921921
@pytest.mark.anyio
922+
@pytest.mark.limit_consensus_modes(
923+
allowed=[ConsensusMode.HARD_FORK_2_0, ConsensusMode.HARD_FORK_3_0],
924+
reason="We can no longer (reliably) farm blocks from before the hard fork",
925+
)
922926
async def test_new_transaction_and_mempool(
923927
wallet_nodes: tuple[
924928
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
@@ -946,8 +950,10 @@ async def test_new_transaction_and_mempool(
946950

947951
# Makes a bunch of coins
948952
conditions_dict: dict[ConditionOpcode, list[ConditionWithArgs]] = {ConditionOpcode.CREATE_COIN: []}
949-
# This should fit in one transaction
950-
for _ in range(100):
953+
# This should fit in one transaction. The test constants have a max block cost of 400,000,000
954+
# and the default max *transaction* cost is half that, so 200,000,000. CREATE_COIN has a cost of
955+
# 1,800,000, we create 80 coins
956+
for _ in range(80):
951957
receiver_puzzlehash = wallet_receiver.get_new_puzzlehash()
952958
puzzle_hashes.append(receiver_puzzlehash)
953959
output = ConditionWithArgs(ConditionOpcode.CREATE_COIN, [receiver_puzzlehash, int_to_bytes(10000000000)])
@@ -1046,8 +1052,8 @@ async def test_new_transaction_and_mempool(
10461052
# these numbers reflect the capacity of the mempool. In these
10471053
# tests MEMPOOL_BLOCK_BUFFER is 1. The other factors are COST_PER_BYTE
10481054
# and MAX_BLOCK_COST_CLVM
1049-
assert included_tx == 23
1050-
assert not_included_tx == 10
1055+
assert included_tx == 20
1056+
assert not_included_tx == 7
10511057
assert seen_bigger_transaction_has_high_fee
10521058

10531059
# Mempool is full
@@ -1882,7 +1888,9 @@ async def test_new_signage_point_caching(
18821888
) -> None:
18831889
full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
18841890
blocks = await full_node_1.get_all_full_blocks()
1885-
1891+
assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
1892+
bytes32.zeros, full_node_1.full_node.constants.GENESIS_CHALLENGE, uint8(0)
1893+
) == SignagePoint(None, None, None, None)
18861894
peer = await connect_and_get_peer(server_1, server_2, self_hostname)
18871895
blocks = bt.get_consecutive_blocks(3, block_list_input=blocks, skip_slots=2)
18881896
await full_node_1.full_node.add_block(blocks[-3])
@@ -1951,10 +1959,6 @@ async def test_new_signage_point_caching(
19511959
is not None
19521960
)
19531961

1954-
assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_output(
1955-
full_node_1.full_node.constants.GENESIS_CHALLENGE, bytes32.zeros, uint8(0)
1956-
) == SignagePoint(None, None, None, None)
1957-
19581962

19591963
@pytest.mark.anyio
19601964
async def test_slot_catch_up_genesis(
@@ -3294,3 +3298,62 @@ def compare_unfinished_blocks(block1: UnfinishedBlock, block2: UnfinishedBlock)
32943298
# Final assertion to check the entire block
32953299
assert block1 == block2, "The entire block objects are not identical"
32963300
return True
3301+
3302+
3303+
@pytest.mark.anyio
3304+
@pytest.mark.parametrize(
3305+
"condition, error",
3306+
[
3307+
(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, "ASSERT_HEIGHT_RELATIVE_FAILED"),
3308+
(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, "ASSERT_HEIGHT_ABSOLUTE_FAILED"),
3309+
],
3310+
)
3311+
async def test_pending_tx_cache_retry_on_new_peak(
3312+
condition: ConditionOpcode, error: str, blockchain_constants: ConsensusConstants, caplog: pytest.LogCaptureFixture
3313+
) -> None:
3314+
"""
3315+
Covers PendingTXCache items that are placed there due to unmet relative or
3316+
absolute height conditions, to make sure those items get retried at peak
3317+
post processing when those conditions are met.
3318+
"""
3319+
async with setup_simulators_and_wallets(1, 0, blockchain_constants) as new:
3320+
full_node_api = new.simulators[0].peer_api
3321+
bt = new.bt
3322+
wallet = WalletTool(test_constants)
3323+
ph = wallet.get_new_puzzlehash()
3324+
blocks = bt.get_consecutive_blocks(
3325+
3, guarantee_transaction_block=True, farmer_reward_puzzle_hash=ph, pool_reward_puzzle_hash=ph
3326+
)
3327+
for block in blocks:
3328+
await full_node_api.full_node.add_block(block)
3329+
peak = full_node_api.full_node.blockchain.get_peak()
3330+
assert peak is not None
3331+
current_height = peak.height
3332+
# Create a transaction with a height condition that makes it pending
3333+
coin = blocks[-1].get_included_reward_coins()[0]
3334+
if condition == ConditionOpcode.ASSERT_HEIGHT_RELATIVE:
3335+
condition_height = 1
3336+
else:
3337+
condition_height = current_height + 1
3338+
condition_dic = {condition: [ConditionWithArgs(condition, [int_to_bytes(condition_height)])]}
3339+
sb = wallet.generate_signed_transaction(uint64(42), ph, coin, condition_dic)
3340+
sb_name = sb.name()
3341+
# Send the transaction
3342+
res = await full_node_api.send_transaction(SendTransaction(sb))
3343+
assert res is not None
3344+
assert ProtocolMessageTypes(res.type) == ProtocolMessageTypes.transaction_ack
3345+
transaction_ack = TransactionAck.from_bytes(res.data)
3346+
assert transaction_ack.status == MempoolInclusionStatus.PENDING.value
3347+
assert transaction_ack.error == error
3348+
# Make sure it ends up in the pending cache, not the mempool
3349+
assert full_node_api.full_node.mempool_manager.get_mempool_item(sb_name, include_pending=False) is None
3350+
assert full_node_api.full_node.mempool_manager.get_mempool_item(sb_name, include_pending=True) is not None
3351+
# Advance peak to meet the asserted height condition
3352+
with caplog.at_level(logging.DEBUG):
3353+
blocks = bt.get_consecutive_blocks(2, block_list_input=blocks, guarantee_transaction_block=True)
3354+
for block in blocks:
3355+
await full_node_api.full_node.add_block(block)
3356+
# This should trigger peak post processing with the added transaction
3357+
assert f"Added transaction to mempool: {sb_name}\n" in caplog.text
3358+
# Make sure the transaction was retried and got added to the mempool
3359+
assert full_node_api.full_node.mempool_manager.get_mempool_item(sb_name, include_pending=False) is not None

chia/_tests/core/mempool/test_mempool.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
7373
from chia.types.mempool_item import MempoolItem, UnspentLineageInfo
7474
from chia.util.casts import int_to_bytes
75-
from chia.util.errors import Err
75+
from chia.util.errors import Err, ValidationError
7676
from chia.util.hash import std_hash
7777
from chia.util.recursive_replace import recursive_replace
7878
from chia.wallet.conditions import AssertCoinAnnouncement, AssertPuzzleAnnouncement
@@ -361,7 +361,10 @@ async def respond_transaction(
361361
self.full_node.full_node_store.pending_tx_request.pop(spend_name)
362362
if spend_name in self.full_node.full_node_store.peers_with_tx:
363363
self.full_node.full_node_store.peers_with_tx.pop(spend_name)
364-
ret = await self.full_node.add_transaction(tx.transaction, spend_name, peer, test)
364+
try:
365+
ret = await self.full_node.add_transaction(tx.transaction, spend_name, peer, test)
366+
except ValidationError as e:
367+
ret = (MempoolInclusionStatus.FAILED, e.code)
365368
invariant_check_mempool(self.full_node.mempool_manager.mempool)
366369
return ret
367370

@@ -2865,8 +2868,9 @@ async def test_invalid_coin_spend_coin(
28652868
coin_spend_0 = make_spend(coin_0, cs.puzzle_reveal, cs.solution)
28662869
new_bundle = recursive_replace(spend_bundle, "coin_spends", [coin_spend_0, *spend_bundle.coin_spends[1:]])
28672870
assert spend_bundle is not None
2868-
res = await full_node_1.full_node.add_transaction(new_bundle, new_bundle.name(), test=True)
2869-
assert res == (MempoolInclusionStatus.FAILED, Err.WRONG_PUZZLE_HASH)
2871+
with pytest.raises(ValidationError) as e:
2872+
await full_node_1.full_node.add_transaction(new_bundle, new_bundle.name(), test=True)
2873+
assert e.value.code == Err.WRONG_PUZZLE_HASH
28702874

28712875

28722876
coins = make_test_coins()

0 commit comments

Comments
 (0)