internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: Chia-Network/chia-blockchain

Issue:
[BUG] Need to check pool contract address on existing plot
**Describe the bug**
You can see the public farmer key of a plot but not the pool contract address when using chia plots check

**To Reproduce**
Chia plots check, pool address is blank, no area for contract address

**Expected behavior**
Show pool contract address


Discussion:

Resolving patch:
diff --git a/chia/plotting/check_plots.py b/chia/plotting/check_plots.py
--- a/chia/plotting/check_plots.py
+++ b/chia/plotting/check_plots.py
@@ -16,6 +16,7 @@
     find_duplicate_plot_IDs,
     parse_plot_info,
 )
+from chia.util.bech32m import encode_puzzle_hash
 from chia.util.config import load_config
 from chia.util.hash import std_hash
 from chia.util.keychain import Keychain
@@ -30,6 +31,7 @@ def plot_refresh_callback(event: PlotRefreshEvents, refresh_result: PlotRefreshR
 
 def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):
     config = load_config(root_path, "config.yaml")
+    address_prefix = config["network_overrides"]["config"][config["selected_network"]]["address_prefix"]
     plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)
     plot_manager: PlotManager = PlotManager(
         root_path,
@@ -102,7 +104,11 @@ def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, d
         for plot_path, plot_info in plot_manager.plots.items():
             pr = plot_info.prover
             log.info(f"Testing plot {plot_path} k={pr.get_size()}")
-            log.info(f"\tPool public key: {plot_info.pool_public_key}")
+            if plot_info.pool_public_key is not None:
+                log.info(f"\t{'Pool public key:':<23} {plot_info.pool_public_key}")
+            if plot_info.pool_contract_puzzle_hash is not None:
+                pca: str = encode_puzzle_hash(plot_info.pool_contract_puzzle_hash, address_prefix)
+                log.info(f"\t{'Pool contract address:':<23} {pca}")
 
             # Look up local_sk from plot to save locked memory
             (
@@ -111,8 +117,8 @@ def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, d
                 local_master_sk,
             ) = parse_plot_info(pr.get_memo())
             local_sk = master_sk_to_local_sk(local_master_sk)
-            log.info(f"\tFarmer public key: {farmer_public_key}")
-            log.info(f"\tLocal sk: {local_sk}")
+            log.info(f"\t{'Farmer public key:' :<23} {farmer_public_key}")
+            log.info(f"\t{'Local sk:' :<23} {local_sk}")
             total_proofs = 0
             caught_exception: bool = False
             for i in range(num_start, num_end):


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
[Bug] Light Wallet beta shows previous wallets info on Cats tab (ie. SBX) until synced.
### What happened?

When I switch wallets in the light wallet beta, the Spacebucks (SBX) info tab shows the previous wallets info until the current wallet finishes syncing.  This includes balance and transactions.

### Version

1.2.11.dev265

### What platform are you using?

Linux

### What ui mode are you using?

GUI

### Relevant log output

_No response_


Discussion:

Resolving patch:
diff --git a/chia/rpc/wallet_rpc_api.py b/chia/rpc/wallet_rpc_api.py
--- a/chia/rpc/wallet_rpc_api.py
+++ b/chia/rpc/wallet_rpc_api.py
@@ -161,6 +161,7 @@ async def log_in(self, request):
             return {"fingerprint": fingerprint}
 
         await self._stop_wallet()
+        self.balance_cache = {}
         started = await self.service._start(fingerprint)
         if started is True:
             return {"fingerprint": fingerprint}


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
Finalize default amount for CLI when adding a mirror (chia data add_mirror)



Discussion:
Will set default for CLI to be 0 and users won't be required to specify the amount with `chia data add_mirror`

Resolving patch:
diff --git a/chia/cmds/data.py b/chia/cmds/data.py
--- a/chia/cmds/data.py
+++ b/chia/cmds/data.py
@@ -292,7 +292,9 @@ def add_missing_files(ids: Optional[str], overwrite: bool, foldername: Optional[
 
 @data_cmd.command("add_mirror", short_help="Publish mirror urls on chain")
 @click.option("-i", "--id", help="Store id", type=str, required=True)
-@click.option("-a", "--amount", help="Amount to spend for this mirror, in mojos", type=int, required=True)
+@click.option(
+    "-a", "--amount", help="Amount to spend for this mirror, in mojos", type=int, default=0, show_default=True
+)
 @click.option(
     "-u",
     "--url",


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
Remove or Set to 0 DataLayer default fee



Discussion:
We will remove the DataLayer default fee currently in place. The decision on whether to simply set to 0 or remove the setting completely is TBD but will be decided today.

Resolving patch:
diff --git a/chia/rpc/data_layer_rpc_api.py b/chia/rpc/data_layer_rpc_api.py
--- a/chia/rpc/data_layer_rpc_api.py
+++ b/chia/rpc/data_layer_rpc_api.py
@@ -69,8 +69,7 @@ def process_change(change: Dict[str, Any]) -> Dict[str, Any]:
 def get_fee(config: Dict[str, Any], request: Dict[str, Any]) -> uint64:
     fee = request.get("fee")
     if fee is None:
-        config_fee = config.get("fee", 0)
-        return uint64(config_fee)
+        fee = 0  # DL no longer reads the fee from the config
     return uint64(fee)
 
 


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
[Bug] 'chia wallet get_transactions' isn't working in git-main
### What happened?

````
$ chia wallet get_transactions
Exception from 'wallet' 'str' object has no attribute 'name'
````

### Version

chia-blockchain-1.6.1b4.dev16

### What platform are you using?

Linux

### What ui mode are you using?

CLI

### Relevant log output

_No response_


Discussion:
I have reproduced this - interestingly there is no stack trace or other output shown in the log.

Resolving patch:
diff --git a/chia/cmds/wallet.py b/chia/cmds/wallet.py
--- a/chia/cmds/wallet.py
+++ b/chia/cmds/wallet.py
@@ -74,12 +74,14 @@ def get_transaction_cmd(wallet_rpc_port: Optional[int], fingerprint: int, id: in
     "--sort-by-height",
     "sort_key",
     flag_value=SortKey.CONFIRMED_AT_HEIGHT,
+    type=SortKey,
     help="Sort transactions by height",
 )
 @click.option(
     "--sort-by-relevance",
     "sort_key",
     flag_value=SortKey.RELEVANCE,
+    type=SortKey,
     default=True,
     help="Sort transactions by {confirmed, height, time}",
 )


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
Sending a CAT with a fee in the Windows CLI is not producing the same effect as sending a CAT with a fee in the Windows GUI (this might be true on other systems)
CAT sent with a fee from the GUI:
![Image](https://user-images.githubusercontent.com/8990544/207227164-62993da6-bbcd-431c-a695-ff076acbeb0d.png)

CAT sent with a fee from the CLI:
![Image](https://user-images.githubusercontent.com/8990544/207227232-36dc8979-a9fe-4c30-a04e-b5d105481eda.png)





Discussion:

Resolving patch:
diff --git a/chia/cmds/wallet_funcs.py b/chia/cmds/wallet_funcs.py
--- a/chia/cmds/wallet_funcs.py
+++ b/chia/cmds/wallet_funcs.py
@@ -219,7 +219,7 @@ async def send(args: dict, wallet_client: WalletRpcClient, fingerprint: int) ->
         print(f"Wallet id: {wallet_id} not found.")
         return
 
-    final_fee = uint64(int(fee * mojo_per_unit))
+    final_fee: uint64 = uint64(int(fee * units["chia"]))  # fees are always in XCH mojos
     final_amount: uint64 = uint64(int(amount * mojo_per_unit))
     final_min_coin_amount: uint64 = uint64(int(min_coin_amount * mojo_per_unit))
     final_max_coin_amount: uint64 = uint64(int(max_coin_amount * mojo_per_unit))


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
Confusing docstring line
_Originally posted by @arvidn in https://github.com/Chia-Network/chia-blockchain/pull/13976#discussion_r1029192732_

        I can't parse this sentence. is it supposed to say "inside one *of* the mempools"?
        But we only have one mempool, so I still wouldn't know what that means really.
        Presumably "it" refers to the `bundle_hash` we pass in here, right?

https://github.com/Chia-Network/chia-blockchain/blob/ca536d7002f9fd87f612ec7ee622e032582b63fa/chia/full_node/mempool_manager.py#L556-L557


Discussion:

Resolving patch:
diff --git a/chia/full_node/mempool_manager.py b/chia/full_node/mempool_manager.py
--- a/chia/full_node/mempool_manager.py
+++ b/chia/full_node/mempool_manager.py
@@ -544,7 +544,8 @@ def get_spendbundle(self, bundle_hash: bytes32) -> Optional[SpendBundle]:
 
     def get_mempool_item(self, bundle_hash: bytes32, include_pending: bool = False) -> Optional[MempoolItem]:
         """
-        Returns a MempoolItem if it's inside one the mempools.
+        Returns the MempoolItem in the mempool that matches the provided spend bundle hash (id)
+        or None if not found.
 
         If include_pending is specified, also check the PENDING cache.
         """


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
[Bug] Windows CLI waits for passphrase input but no longer prompts for it in 1.7.1
### What happened?

When using the CLI to start the wallet (or indeed any service) - the prompt `(Unlock Keyring) Passphrase:` is no longer shown until *after* the passphrase is entered.

The daemon will display `Starting daemon` and then wait there for the passphrase input. Once the passphrase is entered, the following is shown `(Unlock Keyring) Passphrase: Unlocking daemon keyring`

This is a regression in 1.7.1 as it works as expected in 1.7.0

Tested in both cmd and powershell 7.3.2

### Version

1.7.1

### What platform are you using?

Windows

### What ui mode are you using?

CLI

### Relevant log output

```shell
N/A
```



Discussion:

Resolving patch:
diff --git a/chia/cmds/passphrase_funcs.py b/chia/cmds/passphrase_funcs.py
--- a/chia/cmds/passphrase_funcs.py
+++ b/chia/cmds/passphrase_funcs.py
@@ -91,7 +91,7 @@ def verify_passphrase_meets_requirements(
 
 def prompt_for_passphrase(prompt: str) -> str:
     if sys.platform == "win32" or sys.platform == "cygwin":
-        print(prompt, end="")
+        print(prompt, end="", flush=True)
         prompt = ""
     return getpass(prompt)
 


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
CLI nft listing doesn't support pagination
When listing NFTs on the CLI, the number of returned NFTs is capped at 50 due to the RPC hardcoding a default `num` value. Since the CLI doesn't expose `--start-index` and `--num` options, there's no way to get a complete listing for collections > 50 NFTs.

Should be a simple change to expose those flags and pass them through to the `nft_get_nfts` RPC.


Discussion:

Resolving patch:
diff --git a/chia/cmds/wallet.py b/chia/cmds/wallet.py
--- a/chia/cmds/wallet.py
+++ b/chia/cmds/wallet.py
@@ -1164,10 +1164,12 @@ def nft_transfer_cmd(
 )
 @click.option("-f", "--fingerprint", help="Set the fingerprint to specify which key to use", type=int)
 @click.option("-i", "--id", help="Id of the NFT wallet to use", type=int, required=True)
-def nft_list_cmd(wallet_rpc_port: Optional[int], fingerprint: int, id: int) -> None:
+@click.option("--num", help="Number of NFTs to return", type=int, default=50)
+@click.option("--start-index", help="Which starting index to start listing NFTs from", type=int, default=0)
+def nft_list_cmd(wallet_rpc_port: Optional[int], fingerprint: int, id: int, num: int, start_index: int) -> None:
     from .wallet_funcs import list_nfts
 
-    asyncio.run(list_nfts(wallet_rpc_port, fingerprint, id))
+    asyncio.run(list_nfts(wallet_rpc_port, fingerprint, id, num, start_index))
 
 
 @nft_cmd.command("set_did", help="Set a DID on an NFT")
diff --git a/chia/cmds/wallet_funcs.py b/chia/cmds/wallet_funcs.py
--- a/chia/cmds/wallet_funcs.py
+++ b/chia/cmds/wallet_funcs.py
@@ -1175,10 +1175,12 @@ def print_nft_info(nft: NFTInfo, *, config: Dict[str, Any]) -> None:
         print(f"{indent}{license_uri}")
 
 
-async def list_nfts(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int) -> None:
+async def list_nfts(
+    wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int, num: int, start_index: int
+) -> None:
     async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config):
         try:
-            response = await wallet_client.list_nfts(wallet_id)
+            response = await wallet_client.list_nfts(wallet_id, num, start_index)
             nft_list = response["nft_list"]
             if len(nft_list) > 0:
                 for n in nft_list:
diff --git a/chia/rpc/wallet_rpc_client.py b/chia/rpc/wallet_rpc_client.py
--- a/chia/rpc/wallet_rpc_client.py
+++ b/chia/rpc/wallet_rpc_client.py
@@ -1007,8 +1007,8 @@ async def count_nfts(self, wallet_id: Optional[int]):
         response = await self.fetch("nft_count_nfts", request)
         return response
 
-    async def list_nfts(self, wallet_id) -> dict[str, Any]:
-        request: Dict[str, Any] = {"wallet_id": wallet_id, "num": 100_000}
+    async def list_nfts(self, wallet_id, num: int = 50, start_index: int = 0):
+        request: Dict[str, Any] = {"wallet_id": wallet_id, "num": num, "start_index": start_index}
         response = await self.fetch("nft_get_nfts", request)
         return response
 


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
[Bug] Module `chia.wallet.puzzles.clawback` not found
### What happened?

When installing `1.8.2-rc3` or `master` via `pip`, the module `chia.wallet.puzzles.clawback` is missing. The files are not included because the packages are not listed in `setup.py`. This is also true of the `prefarm` sibling package.

### Version

1.8.2-rc3

### What platform are you using?

Linux

### What ui mode are you using?

CLI

### Relevant log output

```shell
$ pip install git+https://github.com/chia-network/chia-blockchain
Collecting git+https://github.com/chia-network/chia-blockchain
  Cloning https://github.com/chia-network/chia-blockchain to /tmp/pip-req-build-m26feywu
  Running command git clone --filter=blob:none --quiet https://github.com/chia-network/chia-blockchain /tmp/pip-req-build-m26feywu
  Resolved https://github.com/chia-network/chia-blockchain to commit 49140b2b3c0c128f2464c0b4e50c496e7029939d
  Running command git submodule update --init --recursive -q
[snip]
$ python3
>>> import chia.wallet.wallet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/site-packages/chia/wallet/wallet.py", line 23, in <module>
    from chia.wallet.coin_selection import select_coins
  File "/usr/local/lib/python3.11/site-packages/chia/wallet/coin_selection.py", line 10, in <module>
    from chia.wallet.wallet_coin_record import WalletCoinRecord
  File "/usr/local/lib/python3.11/site-packages/chia/wallet/wallet_coin_record.py", line 11, in <module>
    from chia.wallet.puzzles.clawback.metadata import ClawbackMetadata, ClawbackVersion
ModuleNotFoundError: No module named 'chia.wallet.puzzles.clawback'
```



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -118,6 +118,8 @@
         "chia.wallet",
         "chia.wallet.db_wallet",
         "chia.wallet.puzzles",
+        "chia.wallet.puzzles.clawback",
+        "chia.wallet.puzzles.prefarm",
         "chia.wallet.cat_wallet",
         "chia.wallet.did_wallet",
         "chia.wallet.nft_wallet",


Test patch:
Repository: Chia-Network/chia-blockchain

Issue:
[Bug] Chia Plots Check fails on 2.0.0-rc5 when Parallel Decompressor Count set to 0
### What happened?
reported by Ultrajones (https://discord.com/channels/1034523881404370984/1099818017908592660/1141527857462530068) and nanofarmer (https://discord.com/channels/1034523881404370984/1034870571864948777/1141775874878873712) in discord

Chia plots check fails with error of "[17792] Failed to execute script 'chia' due to unhandled exception!" when the Parallel Decompressor Count in the config.yaml is set to 0. NOTE - I have tested this on windows and on linux

Steps to reproduce:
1. Install 2.0.0-rc5
2. Run `chia init`
3. Run `chia plots check`

Workaround:
1. Stop the chia client
2. Change "Parallel Decompressor Count" to 1
3. Run `chia plots check`


Image description: First attempt is with the default config settings, second attempt is with Parallel Decompressor Count set to 1.
![Screenshot from 2023-08-17 14-42-32](https://github.com/Chia-Network/chia-blockchain/assets/48610606/7587bb2a-0995-4d3c-93cc-b00e67d17525)

### Version

2.0.0-RC5

### What platform are you using?

Linux

### What ui mode are you using?

CLI

### Relevant log output

_No response_


Discussion:

Resolving patch:
diff --git a/chia/plotting/check_plots.py b/chia/plotting/check_plots.py
--- a/chia/plotting/check_plots.py
+++ b/chia/plotting/check_plots.py
@@ -240,7 +240,7 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
                 )
                 bad_plots_list.append(plot_path)
 
-        with concurrent.futures.ThreadPoolExecutor(max_workers=context_count) as executor:
+        with concurrent.futures.ThreadPoolExecutor(max_workers=max(1, context_count)) as executor:
             logger_lock = Lock()
             futures = []
             for plot_path, plot_info in plot_manager.plots.items():


Test patch:
Repository: gwastro/pycbc

Issue:
pycbc_average_psd should be able to output in xml format as used by sbank
The program pycbc_calculate_psd currently outputs the PSD in ascii with no metadata. This ascii file has to be run through gstlal_psd_xml_from_asd_txt to turn it into an XML file for use by sbank. The pycbc_calculate_psd should be able to directly output in XML format.



Discussion:
@spxiwh, @titodalcanton mentioned that you might already have code in frequency series to do this. If so, please can you take a look? If not, please assign this to @lppekows.

It's actually pycbc_average_psd that should support this, as pycbc_calculate_psd outputs a sequence of PSDs in HDF5.

Can someone supply a working command line for pycbc_average_psd including input files I can copy so that I can add this functionality

Don't worry, I think I've got this working in the bank placement examples. Path to follow shortly once I'm done testing.


Resolving patch:
diff --git a/pycbc/types/frequencyseries.py b/pycbc/types/frequencyseries.py
--- a/pycbc/types/frequencyseries.py
+++ b/pycbc/types/frequencyseries.py
@@ -301,7 +301,7 @@ def lal(self):
 
         return lal_data
 
-    def save(self, path, group=None):
+    def save(self, path, group=None, ifo='P1'):
         """
         Save frequency series to a Numpy .npy, hdf, or text file. The first column
         contains the sample frequencies, the second contains the values.
@@ -338,6 +338,21 @@ def save(self, path, group=None):
                                         self.numpy().real,
                                         self.numpy().imag)).T
             _numpy.savetxt(path, output)
+        elif ext == '.xml' or path.endswith('.xml.gz'):
+            from pylal import series as lalseries
+            from glue.ligolw import utils
+            assert(self.kind == 'real')
+            output = self.lal()
+            # When writing in this format we must *not* have the 0 values at
+            # frequencies less than flow. To resolve this we set the first
+            # non-zero value < flow.
+            data_lal = output.data.data
+            first_idx = _numpy.argmax(data_lal>0)
+            if not first_idx == 0:
+                data_lal[:first_idx] = data_lal[first_idx]
+            psddict = {ifo: output}
+            utils.write_filename(lalseries.make_psd_xmldoc(psddict), path,
+                                 gz=path.endswith(".gz"))
         elif ext =='.hdf':
             key = 'data' if group is None else group
             d = h5py.File(path)


Test patch:
Repository: gwastro/pycbc

Issue:
Corner module not automatically installed
pycbc_inference_plot_posterior uses a corner module that one has to install manually to get plot_posterior to work. This module should be added to PyCBC.



Discussion:
@cmbiwer is this fixed?


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -67,6 +67,7 @@
                       'pycbc-glue>=0.9.8',
                       'kombine',
                       'emcee>=2.2.0',
+                      'corner>=2.0.1',
                       #'scikit-learn>=0.17.0',  # travis does not like scikit-learn
                       ]
 links = ['https://github.com/ligo-cbc/mpld3/tarball/master#egg=mpld3-0.3git']


Test patch:
Repository: gwastro/pycbc

Issue:
Error in PyCBC documentation build
The process of building the documentation causes the code to actually *make* a plot that is displayed on my X server. The doc build pauses until the plot is closed and then continues (see attached screenshot).

<img width="1636" alt="screen shot 2017-01-17 at 3 54 41 pm" src="https://cloud.githubusercontent.com/assets/11262902/22039483/8cecdafa-dccd-11e6-985e-250d0b2c2158.png">



Discussion:

Resolving patch:
diff --git a/pycbc/results/followup.py b/pycbc/results/followup.py
--- a/pycbc/results/followup.py
+++ b/pycbc/results/followup.py
@@ -25,7 +25,14 @@
 time series.
 """ 
 import h5py, numpy, matplotlib
-matplotlib.use('Agg')
+# Only if a backend is not already set ... This should really *not* be done
+# here, but in the executables you should set matplotlib.use()
+# This matches the check that matplotlib does internally, but this *may* be
+# version dependenant. If this is a problem then remove this and control from
+# the executables directly.
+import sys
+if not 'matplotlib.backends' in sys.modules:
+    matplotlib.use('agg')
 import pylab, mpld3, mpld3.plugins
 from glue.segments import segment
 
diff --git a/pycbc/results/legacy_grb.py b/pycbc/results/legacy_grb.py
--- a/pycbc/results/legacy_grb.py
+++ b/pycbc/results/legacy_grb.py
@@ -25,7 +25,15 @@
 import re
 import os
 from argparse import ArgumentParser
-import matplotlib; matplotlib.use("Agg")
+import matplotlib
+# Only if a backend is not already set ... This should really *not* be done
+# here, but in the executables you should set matplotlib.use()
+# This matches the check that matplotlib does internally, but this *may* be
+# version dependenant. If this is a problem then remove this and control from
+# the executables directly.
+import sys
+if not 'matplotlib.backends' in sys.modules:
+    matplotlib.use('agg')
 import matplotlib.pyplot as plt
 from glue import markup, segments
 from lal.gpstime import gps_to_utc, LIGOTimeGPS
diff --git a/pycbc/results/scatter_histograms.py b/pycbc/results/scatter_histograms.py
--- a/pycbc/results/scatter_histograms.py
+++ b/pycbc/results/scatter_histograms.py
@@ -30,7 +30,14 @@
 import scipy.stats
 import itertools
 import matplotlib
-matplotlib.use('agg')
+# Only if a backend is not already set ... This should really *not* be done
+# here, but in the executables you should set matplotlib.use()
+# This matches the check that matplotlib does internally, but this *may* be
+# version dependenant. If this is a problem then remove this and control from
+# the executables directly.
+import sys
+if not 'matplotlib.backends' in sys.modules:
+    matplotlib.use('agg')
 from matplotlib import pyplot
 import matplotlib.gridspec as gridspec
 from pycbc.results import str_utils


Test patch: