swanchain / go-computing-provider

A golang implementation of computing provider
MIT License
22 stars 22 forks source link

Address and Reward History on Orchestrator Hub #12

Closed ThomasBlock closed 7 months ago

ThomasBlock commented 8 months ago

Hi. I just wanted to ask if the rewards are working as intended. Since over 48 hours i am successfully receiving tasks. Thexy appear, run and disappear as intended.. other users can also start gpu tasks ans pay like 21 swan per hour,

computing-provider task list
TASK UUID       TASK TYPE   WALLET ADDRESS  SPACE UUID      SPACE NAME      STATUS  
...e6c8e75c4e   CPU         0x0A0...b2AB7   ...0b3e53ae80   063823012024    Running 
...eec5f5dd84   CPU         0x335...662e5   ...4af1f7a1b7   Mario           Running 
...4a99df0f37   CPU         0x3aa...1e8ED   ...f2f8e732a3   catty0481       Running 
...2411c46948   CPU         0x45B...97502   ...3e9a141683   kropes          Running 
...53a72280db   CPU         0x276...d6c82   ...5011a524b6   traidatngoc     Running 
...4175204b63   CPU         0x273...e40F3   ...7e1249bd88   Finder          Running 
...74c456b3a2   CPU         0x027...6C234   ...280dcb8cd3   minezweeperApp  Running 
...781ee34cb9   CPU         0x217...020DA   ...8a078a5621   Jupyter-Labs    Running 
...66bd5b18f7   CPU         0x204...02eb7   ...287f69434c   traidatngoc46   Running 
...23701c90be   CPU         0xDBa...ad3a1   ...3c8a4307dc   GBanSKUY        Running 
...cc13b550ed   CPU         0x5C6...c7C1A   ...2aa2ca8ed3   Narkoboy        Running 
...566d8fb305   CPU         0xAe0...87304   ...32e4795f43   GameSwan        Running 
...648b6424e7   CPU         0x82D...b6e4a   ...ef3ba726f7   mihrahmine      Running 
...63ddfe3f1b   CPU         0x05E...d3C31   ...9435a5f8c7   SvoRa           Running 
...3036ca4a22   CPU         0x027...6C234   ...dce030b411   Newspace        Running 
...4a2949c60b   CPU         0x1Bf...8139b   ...a500e8256d   MusicGen        Running 

but i don't get any onchain rewards. The Collateral(SWAN-ETH) is shrinking and shrinking. I see a "history" here https://orchestrator.swanchain.io/payment-history . but how does this tranform to an income?

Bildschirmfoto vom 2024-01-31 09-03-37

So i wanted to make sure that i understand the HUB correcntly. Is it correct that every provider has to fill out the google form first, and then can connect? I did this, but it looks like maybe there was an address error: I have submitted two wallet addessses: 0xfe0...4981 is the hot wallet, computing-provider has the private key 0x269E...22A9 is a cold wallet ( more to collect mainnet rewards at the end )

What i am doing is at the moment, is to set in the config

[HUB]
WalletAddress = `0x269E...22A9`
AccessToken = 'XXX"

So i can collect uptime stats, receive tasks and even receuve ubi tasks ( with problems ). But its strange, as compute-provider cannot sign anything or deposit collateral, as he does not have acces to the private key. So might this be a problem for collecting rewards?

What i can also do, is

[HUB]
WalletAddress = `0xfe0...4981` 
AccessToken = 'YYY"

but then the compute-provider can not access the hub and tells me this error: level=warning msg="resp status: %d, retrying to connect to the Swan Hub server 404" func=sendHeartbeat file="initializer.go:41"

last question regarding this: I did computing-provider initonly with --ownerAddress 0xfe0...4981 and not --beneficiaryAddress 0x269E...22A9. Or should i do that?

maybe it would be the easiest way, if everything just runs on 0xfe0...4981 ?

Normalnoise commented 8 months ago

@ThomasBlock thanks for your issues, we have noticed it. firstly, in the config.toml

[HUB]
AccessToken = ""                                    # The Orchestrator's access token, Acquired from "https://orchestrator.swanchain.io" 
WalletAddress = ""                                  # The cp‘s wallet address

AccessToken should be acquired from "https://orchestrator.swanchain.io" > "show API-key", it will be used to connect to Orchestrator. it is not a wallet address

WalletAddress is the CP's wallet that will be used to add collateral snd receive the space reward

Normalnoise commented 8 months ago

The Collateral(SWAN-ETH) is shrinking and shrinking

we have fixed this bug, in the testnet, the Escrow balance will be auto transferred to Collateral balance and reused as a collateral to deploy a space. in the next CP version and Orchestrator, it will be solved

Normalnoise commented 8 months ago

last question regarding this: I did computing-provider init only with --ownerAddress 0xfe0...4981 and not --beneficiaryAddress 0x269E...22A9. Or should i do that?

maybe it would be the easiest way, if everything just runs on 0xfe0...4981 ?

the beneficiaryAddress is a cold address for get reward. when you init the CP, you do not set the --beneficiaryAddress, the beneficiary address will be same with ownerAddress

Andrew09if commented 8 months ago

I have the same problem. I set "Benefeciary address" to my cold wallet. When I log in to Orchestrator dashboard wih my benefeciary wallet I see nothing in rewards history and UBI reward history tabs. When I log in to Orchestrator dashboard wih my owner hot wallet I see many pending rewards in reward history tab and no rewards in UBI history tab

1

ThomasBlock commented 8 months ago

@ThomasBlock thanks for your issues, we have noticed it. firstly, in the config.toml

[HUB]
AccessToken = ""                                    # The Orchestrator's access token, Acquired from "https://orchestrator.swanchain.io" 
WalletAddress = ""                                  # The cp‘s wallet address

AccessToken should be acquired from "https://orchestrator.swanchain.io" > "show API-key", it will be used to connect to Orchestrator. it is not a wallet address

WalletAddress is the CP's wallet that will be used to add collateral snd receive the space reward

Thank you for the feedback. Yes that is how i also understood these two variables. You did not reply the other qeuestions: a) is it okay to log in with a offline wallet? b) why cant i login with the online wallet?

Here is how i tried it with the online wallet: computing-provider wallet new computing-provider wallet export 0xfe0... take the private key and import it in metamask send SWAN-ETH to the address go to https://orchestrator.swanchain.io/ , login, deposit collateral, create api enter WalletAddress and AccessToken in config.toml see error 404

Andrew09if commented 8 months ago

The private key import scheme worked well for me. I can login to dashboard and no errors with API key in computing-provider.

Normalnoise commented 8 months ago

a) is it okay to log in with a offline wallet?

You must log in the dashboard using WalletAddress in config.toml, to get the AccessToken(named API-key in dashboard), the wallet address and AccessToken must match, otherwise it will return 404. But the CP do not need the WalletAddress privateKey, you just config the wallet address in the config file

b) why cann't i login with the online wallet?

the online wallet and AccessToken must config in the config, if you see the 404, maybe you have another issue

Andrew09if commented 8 months ago

Are you sure that CP do not require private key for WalletAddress? How can you add collateral?

Normalnoise commented 8 months ago

Are you sure that CP do not require private key for WalletAddress? How can you add collateral?

@Andrew09if you can add collateral in the https://orchestrator.swanchain.io/

Normalnoise commented 8 months ago

I have the same problem. I set "Benefeciary address" to my cold wallet. When I log in to Orchestrator dashboard wih my benefeciary wallet I see nothing in rewards history and UBI reward history tabs. When I log in to Orchestrator dashboard wih my owner hot wallet I see many pending rewards in reward history tab and no rewards in UBI history tab

1

@Andrew09if I have not see a success Ubi-task, after the Ubi-task become success, the reward will be sent two hours later.

you should check your ubi config, and test the process by this guideline: https://docs.swanchain.io/orchestrator/as-a-computing-provider/computing-provider-setup/faq#q-how-can-i-verify-if-my-computing-provider-is-set-up-to-receive-ubi-tasks

ThomasBlock commented 8 months ago

a) is it okay to log in with a offline wallet?

You must log in the dashboard using WalletAddress in config.toml, to get the AccessToken(named API-key in dashboard), the wallet address and AccessToken must match, otherwise it will return 404. But the CP do not need the WalletAddress privateKey, you just config the wallet address in the config file

b) why cann't i login with the online wallet?

the online wallet and AccessToken must config in the config, if you see the 404, maybe you have another issue

Okay, i summarize that it is okay to have two separate wallets. And ubi rewards appear 2 hours later. But what about "normal" rewards, for tasks? when and on which address do they appear? ( on cp wallet or on HUB wallet ? )

Normalnoise commented 8 months ago

a) is it okay to log in with a offline wallet?

You must log in the dashboard using WalletAddress in config.toml, to get the AccessToken(named API-key in dashboard), the wallet address and AccessToken must match, otherwise it will return 404. But the CP do not need the WalletAddress privateKey, you just config the wallet address in the config file

b) why cann't i login with the online wallet?

the online wallet and AccessToken must config in the config, if you see the 404, maybe you have another issue

Okay, i summarize that it is okay to have two separate wallets. And ubi rewards appear 2 hours later. But what about "normal" rewards, for tasks? when and on which address do they appear? ( on cp wallet or on HUB wallet ? )

It will be sent to beneficiary address

ThomasBlock commented 8 months ago

Any updates on all the bugs? @Normalnoise

when connecting with right wallet and right api key i see:

time="2024-02-03 10:15:09.901" level=warning msg="resp status: %d, retrying to connect to the Swan Hub server 404" func=sendHeartbeat file="initializer.go:41"

and when i change the api key to an arbitrary wrong one, i see:

time="2024-02-03 10:19:52.201" level=error msg="report cluster node resources failed, status code: 403" func=reportClusterResource file="task_service.go:235"
time="2024-02-03 10:19:57.063" level=warning msg="resp status: %d, retrying to connect to the Swan Hub server 500" func=sendHeartbeat file="initializer.go:41"

i also clrealy see in my logs that the private key is needed:

time="2024-02-03 08:57:07.223" level=info msg="task_id: 14, C2 proof out received: {TaskId:14 TaskType:1 Proof:tBK+ehg/ryLH4LfUpd46C2fWoirG69CnDt67vjdkbAKIgD/Q9kkpfysTsx7shbGbjj20ay7fhXINgg6PZNZz55RAeFr1wT+kLSpVGII+tQuSY5c3GoinrVDv0SiELvopFCa/n3jLTEqXMceimV6+Rdf0LmEPJncweO/PMM4ZVvzXXCXJzgLTvp82IyLFd+hmo2XlK7twh8IxzZN6F0w71GEywSaGxLOez3Hq0piHUe7kb/GRFIVSwD3p5yiFRK4V ZkType:fil-c2-512M NameSpace:ubi-task-14}" func=ReceiveUbiProof file="cp_service.go:855"
time="2024-02-03 08:57:07.248" level=error msg="the address: 0x269E..., private key key info not found," func=ReceiveUbiProof file="cp_service.go:871"

and here we can see that i can solve and publish ubi task with the other address:

time="2024-02-03 10:07:15.716" level=info msg="receive ubi task received: {ID:20 Name:test-ubi Type:1 ZkType:fil-c2-32G InputParam:https://286cb2c989.acl.multichain.storage/ipfs/QmYg4CfA5E2zR4ktb5B3PafAeCWyEEXiKUVS4g2UE9occ5 Signature:0x93fe1c63d0ec24a13ba7a0f3537aeffc317ec0532e4f56a86cf78f0c4fee9b373ef4637cfc14c38a8d5ac70712df3bea6b958854f73a2743b7e7c1eee0b9a43701 Resource:0xc00044ac40}" func=DoUbiTask file="cp_service.go:547"
time="2024-02-03 10:07:15.716" level=info msg="ubi task sign verifing, task_id: 20, type: fil-c2-32G, verify: true" func=DoUbiTask file="cp_service.go:587"
time="2024-02-03 10:07:15.746" level=info msg="checkResourceAvailableForUbi: needCpu: 2, needMemory: 5.00, needStorage: 1.00" func=checkResourceAvailableForUbi file="cp_service.go:1244"
time="2024-02-03 10:07:15.746" level=info msg="checkResourceAvailableForUbi: remainingCpu: 0, remainingMemory: 14.00, remainingStorage: 318.00" func=checkResourceAvailableForUbi file="cp_service.go:1245"
time="2024-02-03 10:07:15.746" level=info msg="checkResourceAvailableForUbi: needCpu: 2, needMemory: 5.00, needStorage: 1.00" func=checkResourceAvailableForUbi file="cp_service.go:1244"
time="2024-02-03 10:07:15.746" level=info msg="checkResourceAvailableForUbi: remainingCpu: 13, remainingMemory: 55.00, remainingStorage: 1573.00" func=checkResourceAvailableForUbi file="cp_service.go:1245"
time="2024-02-03 10:07:15.746" level=info msg="gpuName: NVIDIA-A4000, nodeGpu: map[:0 kubernetes.io/os:0], nodeGpuSummary: map[swan2:map[NVIDIA-A4000:1] swan3:map[NVIDIA-4060-Ti:1]]" func=checkResourceAvailableForUbi file="cp_service.go:1256"
[GIN] 2024/02/03 - 10:07:15 | 200 |    30.16935ms | 212.102.118.102 | POST     "/api/v1/computing/cp/ubi"
time="2024-02-03 10:07:18.244" level=warning msg="resp status: %d, retrying to connect to the Swan Hub server 500" func=sendHeartbeat file="initializer.go:41"
time="2024-02-03 10:07:18.552" level=error msg="report cluster node resources failed, status code: 403" func=reportClusterResource file="task_service.go:235"
time="2024-02-03 10:07:24.853" level=info msg="task_id: 20, C2 proof out received: {TaskId:20 TaskType:1 Proof:p0dLNBqZQXLcWcQkVi0+Ch71Ifc82sMAobg4+YydlkEfUSDbfI4dfPKXVS9yCdl9iLVIpdhW9AiiQGHN2lx2SDZUWtH3QW0EOY6lVUzqF9VWYY+DXZIjjrMKPStKFF0UCh/5hB3FOZBSQtgldxtYE/xpWhvlo3uFA9hKFdzodXYRzNtrozOLhaqcCUqAoOa3r2fdOiE9dlOxxNRo6ajaxKKumlW6tmkcBkAHSYUqUZc48AOVQTBcy/PqIQLhkAN3 ZkType:fil-c2-32G NameSpace:ubi-task-20}" func=ReceiveUbiProof file="cp_service.go:855"
submitUBIProofTx: 0x2a5daec512c02e773aacc63cb7adc3a6703c45eea7904fa6fa81da90549780b5[GIN] 2024/02/03 - 10:07:25 | 200 |  917.455837ms |  192.168.128.72 | POST     "/api/v1/computing/cp/receive/ubi"

so can you again point out: is there any manual whitelisting involved in the hub? could you please allow my second wallet address ?

sonic-chain commented 8 months ago
  1. Delete [HUB].AccessToken in config.toml, use [HUB].WalletAddress to regenerate AccessToken on the HUB website, and then reconfigure it
sonic-chain commented 8 months ago
  1. If the first solution does not work, you can delete private_key under CP_PATH, repeat the operation of the first solution to start cp, and then execute the computing-provider init command
ThomasBlock commented 7 months ago

fixed in newest version