Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.83k stars 2.02k forks source link

[Bug] Various farm summary items do not work when using a remote node #9615

Open Ealrann opened 2 years ago

Ealrann commented 2 years ago

What happened?

Setup

Long story short: my internet is slow, running a full node at home is too heavy to do it properly. Monitoring the network usage shows this bandwidth consumption:

Full node <-> others full node  : 100-300 kBps
Farmer <-> Full node            : 4  kBps
Harvesters <-> Farmer           : 50 kBps

So to optimize my setup, I moved the Full node only to a VPS, but I keep the Farmer at home:

           Home                 Internet              VPS
Harvesters <-> Farmer         <----------->        Full node

I just configure the full node address in the Farmer configuration, and it works.

This is my best setup so far (months of testing/monitoring). I win blocks, and the private key stays at home with the farmer (the full node on VPS doesn't need keys).

The issue

The only issue with this setup so far is the chia farm summary output :

$ chia farm summary
Connection error. Check if full node is running at 8555
Farming status: Not available
[...]
Estimated network space: Unknown
Expected time to win: Unknown

It properly shows the plot count and the harvesters (I hided this info here for privacy). But the Farming status: Not available doesn't works even if:

  1. The farmer is connected to a full node (but no RPC).
  2. The farmer regularly receive challenges from the full node.

Less important, the Expected time to win: Unknown and Estimated network space are broken too.

Version

1.2.11

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

No response

JsBlueCat commented 2 years ago

https://github.com/Chia-Network/chia-blockchain/issues/9635#issue-1085315363

emlowe commented 2 years ago

In various places in the farmer, the code specifically only looks for the node at the current self_hostname setting in config.yaml and for some reason ignores the setting for the node in the farmer section. See eg. get_blockchain_state in farm_funcs.py. This and others should get changed to use the farmer:full_node_peer settings

Ealrann commented 2 years ago

Oups, sorry for the title edit, I didn't see you changed it. Thank you for your attention on this issue :pray::pray: !

emlowe commented 2 years ago

It's not a common deployment model, so priority obviously hasn't been that high.

Ealrann commented 2 years ago

I understand, and the problem is really minor. If I can help with testing, let me know. (btw, hurray for python 3.10 :star2: )

wiryonolau commented 1 year ago

In my case this no longer appear in 2.0.0, prior version appear and works normally

$ chia farm summary
Connection error. Check if full node is running at 8555
Farming status: Not available
[...]
Estimated network space: Unknown
Expected time to win: Unknown

It become this

$ chia farm summary
Error: Connection error: ClientConnectorError: Cannot connect to host 127.0.0.1:8555 ssl:<ssl.SSLContext object at 0x7f6a078b8340> [Connect call failed ('127.0.0.1', 8555)]
Check if full node rpc is running at 8555
This is normal if full node is still starting up

my setup is

harvester --- vpn----> farmer-only -----> node

There is only minimal overhead using vpn connection farmer-only to node is using public ip.

wiryonolau commented 1 year ago

In various places in the farmer, the code specifically only looks for the node at the current self_hostname setting in config.yaml and for some reason ignores the setting for the node in the farmer section. See eg. get_blockchain_state in farm_funcs.py. This and others should get changed to use the farmer:full_node_peer settings

I've been searching for the change in the source code, diff between 1.8.0 and 2.0.0 but haven't found the change that cause this.

Doesn't see any related change in farm_funcs.py, this two file also no change chia/rpc/farmer_rpc_client.py and chia/rpc/rpc_client.py . Not sure where to looks , most of the change for farmer are typing related and code clean up.

I cannot update my node, so if there is open full node v2.0.0, I can help test by creating new farmer-only and redirect some of my harvester there.

When updating to 2.0.0 did you have a new config created for each device and also run the chia init [directory] command on each harvester?

Ah regarding this, I forget to mention if I change farmer-only to farmer ( farmer and full node ) on same config.yml and setup. It works directly

wiryonolau commented 1 year ago

Hi @emlowe is this the problem in chia/cmds/farm_funcs.py ?

async def get_blockchain_state(
    rpc_port: Optional[int], root_path: Path = DEFAULT_ROOT_PATH
) -> Optional[Dict[str, Any]]:
    config = load_config(root_path, "config.yaml")                                                                                       
    async with FullNodeRpcClient.create(config["farmer"]["full_node_peer"]["host"], config["farmer"]["full_node_peer"]["port"], path, config) as (client, _):
        return await client.get_blockchain_state()

Should we create additional FarmerFullNodeRpcClient in /cmds/cmds_util.py that load from farmer config instead of localhost

Or we can add in the full_node config.yaml to mark it as remote and use the ip instead of localhost ?

full_node:
  remote: someip / localhost

Can you point me which file that might cause the problem, I have trouble finding the function in the source code. This issue appear to be closed also, I got a lot of harvester and currently cannot move the node to the same server as farmer due to resource limit.

BrandtH22 commented 1 year ago

Hi @emlowe is this the problem in chia/cmds/farm_funcs.py ?

async def get_blockchain_state(
    rpc_port: Optional[int], root_path: Path = DEFAULT_ROOT_PATH
) -> Optional[Dict[str, Any]]:
    config = load_config(root_path, "config.yaml")                                                                                       
    async with FullNodeRpcClient.create(config["farmer"]["full_node_peer"]["host"], config["farmer"]["full_node_peer"]["port"], path, config) as (client, _):
        return await client.get_blockchain_state()

Should we create additional FarmerFullNodeRpcClient in /cmds/cmds_util.py that load from farmer config instead of localhost

Or we can add in the full_node config.yaml to mark it as remote and use the ip instead of localhost ?

full_node:
  remote: someip / localhost

Can you point me which file that might cause the problem, I have trouble finding the function in the source code. This issue appear to be closed also, I got a lot of harvester and currently cannot move the node to the same server as farmer due to resource limit.

Hey @wiryonolau , I have seen you respond to a number of very old discussion messages with support questions but am not entirely sure what the issue or question is that you are facing. Would you be able to create a new support discussion ticket and consolidate your questions and other data there for us to better assist? Note - we generally can provide more immediate and thorough support in our discord server: https://discord.gg/chia

(link to open a support discussion - https://github.com/Chia-Network/chia-blockchain/discussions/new?category=support)

wiryonolau commented 1 year ago

Hi @emlowe is this the problem in chia/cmds/farm_funcs.py ?

async def get_blockchain_state(
    rpc_port: Optional[int], root_path: Path = DEFAULT_ROOT_PATH
) -> Optional[Dict[str, Any]]:
    config = load_config(root_path, "config.yaml")                                                                                       
    async with FullNodeRpcClient.create(config["farmer"]["full_node_peer"]["host"], config["farmer"]["full_node_peer"]["port"], path, config) as (client, _):
        return await client.get_blockchain_state()

Should we create additional FarmerFullNodeRpcClient in /cmds/cmds_util.py that load from farmer config instead of localhost

Or we can add in the full_node config.yaml to mark it as remote and use the ip instead of localhost ?

full_node:
  remote: someip / localhost

Can you point me which file that might cause the problem, I have trouble finding the function in the source code. This issue appear to be closed also, I got a lot of harvester and currently cannot move the node to the same server as farmer due to resource limit.

Hey @wiryonolau , I have seen you respond to a number of very old discussion messages with support questions but am not entirely sure what the issue or question is that you are facing. Would you be able to create a new support discussion ticket and consolidate your questions and other data there for us to better assist? Note - we generally can provide more immediate and thorough support in our discord server: https://discord.gg/chia

(link to open a support discussion - https://github.com/Chia-Network/chia-blockchain/discussions/new?category=support)

My issue is closed #16164 due to similar to this one

I explain the general problem there. It's ok since version 1.3 to 1.8.1, 1.8.2 has other problem. break on 2.0.0

wiryonolau commented 10 months ago

Hi just migrate today, seems there is no longer any error in 2.1.1 for remote farm. Thanks @xchdata1