Skip to content

Commit a49bdf9

Browse files
committed
Merge remote-tracking branch 'origin/main' into fine_william___fine
2 parents fcce75f + c2fcd1e commit a49bdf9

File tree

23 files changed

+323
-201
lines changed

23 files changed

+323
-201
lines changed

.github/workflows/test-install-scripts.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ jobs:
241241
run: |
242242
yum install --assumeyes git
243243
244+
- name: Set rocky8 repo
245+
if: ${{ matrix.distribution.name == 'rockylinux:8' }}
246+
run: |
247+
sed -i -e 's|^mirrorlist=|#mirrorlist=|' -e 's|^#baseurl=http://dl\.rockylinux\.org/|baseurl=https://dl.rockylinux.org/|' /etc/yum.repos.d/Rocky-*.repo
248+
249+
- name: Set rocky9 repo
250+
if: ${{ matrix.distribution.name == 'rockylinux:9' }}
251+
run: |
252+
sed -i -e 's|^mirrorlist=|#mirrorlist=|' -e 's|^#baseurl=http://dl\.rockylinux\.org/|baseurl=https://dl.rockylinux.org/|' /etc/yum.repos.d/rocky-*.repo
253+
244254
- name: Prepare Rocky
245255
if: ${{ matrix.distribution.type == 'rocky' }}
246256
run: |

chia/_tests/cmds/wallet/test_wallet.py

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from chia.types.signing_mode import SigningMode
3030
from chia.util.bech32m import encode_puzzle_hash
3131
from chia.wallet.conditions import Condition, ConditionValidTimes
32+
from chia.wallet.puzzle_drivers import PuzzleInfo
3233
from chia.wallet.trade_record import TradeRecord
3334
from chia.wallet.trading.offer import Offer
3435
from chia.wallet.trading.trade_status import TradeStatus
@@ -49,6 +50,7 @@
4950
CATSpend,
5051
CATSpendResponse,
5152
ClawbackPuzzleDecoratorOverride,
53+
CreateOfferForIDs,
5254
CreateOfferForIDsResponse,
5355
DeleteUnconfirmedTransactions,
5456
ExtendDerivationIndex,
@@ -79,6 +81,29 @@
7981
)
8082
from chia.wallet.wallet_spend_bundle import WalletSpendBundle
8183

84+
TEMP = PuzzleInfo(
85+
{
86+
"type": "singleton",
87+
"launcher_id": "0x0101010101010101010101010101010101010101010101010101010101010101",
88+
"launcher_ph": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9",
89+
"also": {
90+
"type": "metadata",
91+
"metadata": "",
92+
"updater_hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
93+
"also": {
94+
"type": "ownership",
95+
"owner": "()",
96+
"transfer_program": {
97+
"type": "royalty transfer program",
98+
"launcher_id": "0x0101010101010101010101010101010101010101010101010101010101010101",
99+
"royalty_address": "0x0303030303030303030303030303030303030303030303030303030303030303",
100+
"royalty_percentage": "1000",
101+
},
102+
},
103+
},
104+
}
105+
)
106+
82107
test_offer_file_path = importlib_resources.files(__name__.rpartition(".")[0]).joinpath("test_offer.toffer")
83108
test_offer_file_bech32 = test_offer_file_path.read_text(encoding="utf-8")
84109
test_offer_id: str = "0xdfb7e8643376820ec995b0bcdb3fc1f764c16b814df5e074631263fcf1e00839"
@@ -763,17 +788,22 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
763788
class MakeOfferRpcClient(TestWalletRpcClient):
764789
async def create_offer_for_ids(
765790
self,
766-
offer_dict: dict[uint32, int],
791+
request: CreateOfferForIDs,
767792
tx_config: TXConfig,
768-
driver_dict: Optional[dict[str, Any]] = None,
769-
solver: Optional[dict[str, Any]] = None,
770-
fee: uint64 = uint64(0),
771-
validate_only: bool = False,
793+
extra_conditions: tuple[Condition, ...] = tuple(),
772794
timelock_info: ConditionValidTimes = ConditionValidTimes(),
773795
) -> CreateOfferForIDsResponse:
774796
self.add_to_log(
775797
"create_offer_for_ids",
776-
(offer_dict, tx_config, driver_dict, solver, fee, validate_only, timelock_info),
798+
(
799+
request.offer,
800+
tx_config,
801+
request.driver_dict,
802+
request.solver,
803+
request.fee,
804+
request.validate_only,
805+
timelock_info,
806+
),
777807
)
778808

779809
created_offer = Offer({}, WalletSpendBundle([], G2Element()), {})
@@ -866,35 +896,39 @@ async def create_offer_for_ids(
866896
"create_offer_for_ids": [
867897
(
868898
{
869-
1: -10000000000000,
870-
3: -100000,
871-
"0404040404040404040404040404040404040404040404040404040404040404": -100000,
872-
"0202020202020202020202020202020202020202020202020202020202020202": 10000,
873-
"0101010101010101010101010101010101010101010101010101010101010101": 1,
899+
"1": "-10000000000000",
900+
"3": "-100000",
901+
"0404040404040404040404040404040404040404040404040404040404040404": "-100000",
902+
"0202020202020202020202020202020202020202020202020202020202020202": "10000",
903+
"0101010101010101010101010101010101010101010101010101010101010101": "1",
874904
},
875905
DEFAULT_TX_CONFIG.override(reuse_puzhash=True),
876906
{
877-
"0101010101010101010101010101010101010101010101010101010101010101": {
878-
"type": "singleton",
879-
"launcher_id": "0x0101010101010101010101010101010101010101010101010101010101010101",
880-
"launcher_ph": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9",
881-
"also": {
882-
"type": "metadata",
883-
"metadata": "",
884-
"updater_hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
907+
bytes32([1] * 32): PuzzleInfo(
908+
{
909+
"type": "singleton",
910+
"launcher_id": "0x0101010101010101010101010101010101010101010101010101010101010101",
911+
"launcher_ph": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9",
885912
"also": {
886-
"type": "ownership",
887-
"owner": "()",
888-
"transfer_program": {
889-
"type": "royalty transfer program",
890-
"launcher_id": "0x0101010101010101010101010101010101010101010101010101010101010101",
891-
"royalty_address": "0x0303030303030303030303030303030303030303030"
892-
"303030303030303030303",
893-
"royalty_percentage": "1000",
913+
"type": "metadata",
914+
"metadata": "",
915+
"updater_hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
916+
"also": {
917+
"type": "ownership",
918+
"owner": "()",
919+
"transfer_program": {
920+
"type": "royalty transfer program",
921+
"launcher_id": (
922+
"0x0101010101010101010101010101010101010101010101010101010101010101"
923+
),
924+
"royalty_address": "0x0303030303030303030303030303030303030303030"
925+
"303030303030303030303",
926+
"royalty_percentage": "1000",
927+
},
894928
},
895929
},
896-
},
897-
}
930+
}
931+
)
898932
},
899933
None,
900934
500000000000,

chia/_tests/core/custom_types/test_proof_of_space.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ def b32(key: str) -> bytes32:
6666
plot_size=PlotSize.make_v1(31),
6767
plot_public_key=G1Element(),
6868
pool_public_key=G1Element(),
69-
expected_error="Plot size is lower than the minimum",
69+
expected_error="Plot size (31) is lower than the minimum (32)",
7070
),
7171
ProofOfSpaceCase(
7272
id="Higher than maximum plot size",
7373
pos_challenge=bytes32(b"1" * 32),
7474
plot_size=PlotSize.make_v1(51),
7575
plot_public_key=G1Element(),
7676
pool_public_key=G1Element(),
77-
expected_error="Plot size is higher than the maximum",
77+
expected_error="Plot size (51) is higher than the maximum (50)",
7878
),
7979
ProofOfSpaceCase(
8080
id="Different challenge",
@@ -115,15 +115,15 @@ def b32(key: str) -> bytes32:
115115
plot_size=PlotSize.make_v2(0),
116116
plot_public_key=G1Element(),
117117
pool_public_key=G1Element(),
118-
expected_error="Plot size is lower than the minimum",
118+
expected_error="Plot size (0) is lower than the minimum (28)",
119119
),
120120
ProofOfSpaceCase(
121121
id="v2 plot size 34",
122122
pos_challenge=bytes32(b"1" * 32),
123123
plot_size=PlotSize.make_v2(34),
124124
plot_public_key=G1Element(),
125125
pool_public_key=G1Element(),
126-
expected_error="Plot size is higher than the maximum",
126+
expected_error="Plot size (34) is higher than the maximum (32)",
127127
),
128128
ProofOfSpaceCase(
129129
id="Not passing the plot filter v2",

chia/_tests/core/full_node/test_full_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2713,7 +2713,7 @@ def check_nodes_in_sync() -> bool:
27132713
p2 = full_node_1.full_node.blockchain.get_peak()
27142714
return p1 == p2
27152715

2716-
await time_out_assert(300, check_nodes_in_sync)
2716+
await time_out_assert(600, check_nodes_in_sync)
27172717
peak = full_node_2.full_node.blockchain.get_peak()
27182718
assert peak is not None
27192719
print(f"peak: {str(peak.header_hash)[:6]}")

chia/_tests/util/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from __future__ import annotations
22

3-
job_timeout = 60
3+
job_timeout = 90

chia/_tests/util/test_full_block_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ def get_full_blocks() -> Iterator[FullBlock]:
255255

256256

257257
@pytest.mark.anyio
258+
@pytest.mark.skip(
259+
"Very slow test with limited usefulness: was used to ensure the cheap parser for FullBlock matched the regular one"
260+
)
258261
async def test_parser():
259262
# loop over every combination of Optionals being set and not set
260263
# along with random values for the FullBlock fields. Ensure

chia/_tests/wallet/rpc/test_wallet_rpc.py

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened
8282
from chia.wallet.did_wallet.did_wallet import DIDWallet
8383
from chia.wallet.nft_wallet.nft_wallet import NFTWallet
84+
from chia.wallet.puzzle_drivers import PuzzleInfo
8485
from chia.wallet.puzzles.clawback.metadata import AutoClaimSettings
8586
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk
8687
from chia.wallet.signer_protocol import UnsignedTransaction
@@ -101,7 +102,7 @@
101102
from chia.wallet.wallet import Wallet
102103
from chia.wallet.wallet_coin_record import WalletCoinRecord
103104
from chia.wallet.wallet_coin_store import GetCoinRecords
104-
from chia.wallet.wallet_node import WalletNode
105+
from chia.wallet.wallet_node import WalletNode, get_wallet_db_path
105106
from chia.wallet.wallet_protocol import WalletProtocol
106107
from chia.wallet.wallet_request_types import (
107108
AddKey,
@@ -114,6 +115,7 @@
114115
CheckOfferValidity,
115116
ClawbackPuzzleDecoratorOverride,
116117
CombineCoins,
118+
CreateOfferForIDs,
117119
DefaultCAT,
118120
DeleteKey,
119121
DeleteNotifications,
@@ -1586,28 +1588,29 @@ async def test_offer_endpoints(wallet_environments: WalletTestFramework, wallet_
15861588
)
15871589
# Create an offer of 5 chia for one CAT
15881590
await env_1.rpc_client.create_offer_for_ids(
1589-
{uint32(1): -5, cat_asset_id.hex(): 1}, wallet_environments.tx_config, validate_only=True
1591+
CreateOfferForIDs(offer={str(1): "-5", cat_asset_id.hex(): "1"}, validate_only=True),
1592+
tx_config=wallet_environments.tx_config,
15901593
)
15911594
all_offers = await env_1.rpc_client.get_all_offers()
15921595
assert len(all_offers) == 0
15931596

1594-
driver_dict: dict[str, Any] = {
1595-
cat_asset_id.hex(): {
1596-
"type": "CAT",
1597-
"tail": "0x" + cat_asset_id.hex(),
1598-
**(
1599-
{}
1600-
if wallet_type is CATWallet
1601-
else {"also": {"type": "revocation layer", "hidden_puzzle_hash": "0x" + bytes32.zeros.hex()}}
1602-
),
1603-
}
1597+
driver_dict = {
1598+
cat_asset_id: PuzzleInfo(
1599+
{
1600+
"type": "CAT",
1601+
"tail": "0x" + cat_asset_id.hex(),
1602+
**(
1603+
{}
1604+
if wallet_type is CATWallet
1605+
else {"also": {"type": "revocation layer", "hidden_puzzle_hash": "0x" + bytes32.zeros.hex()}}
1606+
),
1607+
}
1608+
)
16041609
}
16051610

16061611
create_res = await env_1.rpc_client.create_offer_for_ids(
1607-
{uint32(1): -5, cat_asset_id.hex(): 1},
1608-
wallet_environments.tx_config,
1609-
driver_dict=driver_dict,
1610-
fee=uint64(1),
1612+
CreateOfferForIDs(offer={str(1): "-5", cat_asset_id.hex(): "1"}, driver_dict=driver_dict, fee=uint64(1)),
1613+
tx_config=wallet_environments.tx_config,
16111614
)
16121615
offer = create_res.offer
16131616

@@ -1618,7 +1621,7 @@ async def test_offer_endpoints(wallet_environments: WalletTestFramework, wallet_
16181621
assert summary == {
16191622
"offered": {"xch": 5},
16201623
"requested": {cat_asset_id.hex(): 1},
1621-
"infos": driver_dict,
1624+
"infos": {key.hex(): info.info for key, info in driver_dict.items()},
16221625
"fees": 1,
16231626
"additions": [c.name().hex() for c in offer.additions()],
16241627
"removals": [c.name().hex() for c in offer.removals()],
@@ -1662,7 +1665,8 @@ async def test_offer_endpoints(wallet_environments: WalletTestFramework, wallet_
16621665
assert TradeStatus(trade_record.status) == TradeStatus.PENDING_CANCEL
16631666

16641667
create_res = await env_1.rpc_client.create_offer_for_ids(
1665-
{uint32(1): -5, cat_wallet_id: 1}, wallet_environments.tx_config, fee=uint64(1)
1668+
CreateOfferForIDs(offer={str(1): "-5", str(cat_wallet_id): "1"}, fee=uint64(1)),
1669+
tx_config=wallet_environments.tx_config,
16661670
)
16671671
all_offers = await env_1.rpc_client.get_all_offers()
16681672
assert len(all_offers) == 2
@@ -1776,9 +1780,8 @@ def only_ids(trades: list[TradeRecord]) -> list[bytes32]:
17761780
assert len(all_offers) == 2
17771781

17781782
await env_1.rpc_client.create_offer_for_ids(
1779-
{uint32(1): -5, cat_asset_id.hex(): 1},
1780-
wallet_environments.tx_config,
1781-
driver_dict=driver_dict,
1783+
CreateOfferForIDs(offer={str(1): "-5", cat_asset_id.hex(): "1"}, driver_dict=driver_dict),
1784+
tx_config=wallet_environments.tx_config,
17821785
)
17831786
assert (
17841787
len([o for o in await env_1.rpc_client.get_all_offers() if o.status == TradeStatus.PENDING_ACCEPT.value]) == 2
@@ -1814,14 +1817,12 @@ def only_ids(trades: list[TradeRecord]) -> list[bytes32]:
18141817
)
18151818

18161819
await env_1.rpc_client.create_offer_for_ids(
1817-
{uint32(1): -5, cat_asset_id.hex(): 1},
1818-
wallet_environments.tx_config,
1819-
driver_dict=driver_dict,
1820+
CreateOfferForIDs(offer={str(1): "-5", cat_asset_id.hex(): "1"}, driver_dict=driver_dict),
1821+
tx_config=wallet_environments.tx_config,
18201822
)
18211823
await env_1.rpc_client.create_offer_for_ids(
1822-
{uint32(1): 5, cat_asset_id.hex(): -1},
1823-
wallet_environments.tx_config,
1824-
driver_dict=driver_dict,
1824+
CreateOfferForIDs(offer={str(1): "5", cat_asset_id.hex(): "-1"}, driver_dict=driver_dict),
1825+
tx_config=wallet_environments.tx_config,
18251826
)
18261827
assert (
18271828
len([o for o in await env_1.rpc_client.get_all_offers() if o.status == TradeStatus.PENDING_ACCEPT.value]) == 2
@@ -1868,9 +1869,8 @@ def only_ids(trades: list[TradeRecord]) -> list[bytes32]:
18681869
)
18691870

18701871
await env_1.rpc_client.create_offer_for_ids(
1871-
{uint32(1): 5, cat_asset_id.hex(): -1},
1872-
wallet_environments.tx_config,
1873-
driver_dict=driver_dict,
1872+
CreateOfferForIDs(offer={str(1): "5", cat_asset_id.hex(): "-1"}, driver_dict=driver_dict),
1873+
tx_config=wallet_environments.tx_config,
18741874
)
18751875
assert (
18761876
len([o for o in await env_1.rpc_client.get_all_offers() if o.status == TradeStatus.PENDING_ACCEPT.value]) == 1
@@ -1886,9 +1886,11 @@ def only_ids(trades: list[TradeRecord]) -> list[bytes32]:
18861886

18871887
with pytest.raises(ValueError, match="not currently supported"):
18881888
await env_1.rpc_client.create_offer_for_ids(
1889-
{uint32(1): -5, cat_asset_id.hex(): 1},
1889+
CreateOfferForIDs(
1890+
offer={str(1): "-5", cat_asset_id.hex(): "1"},
1891+
driver_dict=driver_dict,
1892+
),
18901893
wallet_environments.tx_config,
1891-
driver_dict=driver_dict,
18921894
timelock_info=ConditionValidTimes(min_secs_since_created=uint64(1)),
18931895
)
18941896

@@ -2340,7 +2342,9 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
23402342
assert delete_key_resp.used_for_farmer_rewards is False
23412343
assert delete_key_resp.used_for_pool_rewards is False
23422344

2345+
assert get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(pks[0])).exists()
23432346
await client.delete_key(DeleteKey(pks[0]))
2347+
assert not get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(pks[0])).exists()
23442348
await client.log_in(LogIn(uint32(pks[1])))
23452349
assert len((await client.get_public_keys()).pk_fingerprints) == 1
23462350

@@ -2357,7 +2361,13 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
23572361
)
23582362

23592363
# Delete all keys
2364+
resp = await client.generate_mnemonic()
2365+
add_key_resp = await client.add_key(AddKey(resp.mnemonic))
2366+
assert get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(pks[1])).exists()
2367+
assert get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(add_key_resp.fingerprint)).exists()
23602368
await client.delete_all_keys()
2369+
assert not get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(pks[1])).exists()
2370+
assert not get_wallet_db_path(wallet_node.root_path, wallet_node.config, str(add_key_resp.fingerprint)).exists()
23612371
assert len((await client.get_public_keys()).pk_fingerprints) == 0
23622372

23632373

chia/_tests/weight_proof/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from __future__ import annotations
22

33
checkout_blocks_and_plots = True
4+
job_timeout = 45

chia/cmds/peer_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async def add_node_connection(rpc_client: RpcClient, add_connection: str) -> Non
2020
except Exception:
2121
print(f"Failed to connect to {host}:{port}")
2222
except ValueError:
23-
print("Enter a valid IP and port in the following format: 10.5.4.3:8000")
23+
print("Enter a valid IP and port in the following format: 10.5.4.3:8444 or [2606:f6c0:80:5::a]:8444")
2424

2525

2626
async def remove_node_connection(rpc_client: RpcClient, remove_connection: str) -> None:

0 commit comments

Comments
 (0)