swanchain / go-computing-provider

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

Upgrade to CP V0.5.0 #89

Open Normalnoise opened 3 months ago

Normalnoise commented 3 months ago

Steps to Upgrade to CP Version 0.5.0:

As an ECP:

  1. Export and back up your private key:

    export CP_PATH="<YOUR_CP_PATH>"
    computing-provider wallet export <YOUR_WALLET_ADDRESS> 
  2. Back up the config.toml file in the $CP_PATH directory as config.toml.bak.

    mv config.toml config.toml.bak
  3. Follow the Deployment DOC to start.


As an FCP:

  1. Withdraw your previous staked Swan-ETH:

    computing-provider collateral withdraw <YOUR_WALLET_ADDRESS> <AMOUNT>
  2. Back up and export the private key:

    export CP_PATH="<YOUR_CP_PATH>"
    computing-provider wallet export <YOUR_WALLET_ADDRESS>
  3. Modify the config.toml file in the $CP_PATH directory:

    [CONTRACT]
    SWAN_CONTRACT = "0x91B25A65b295F0405552A4bbB77879ab5e38166c"              # Swan token's contract address
    SWAN_COLLATERAL_CONTRACT = "0xC7980d5a69e8AA9797934aCf18e483EB4C986e01"   # Swan's collateral address
    REGISTER_CP_CONTRACT = "0x6EDf891B53ba2c6Fade6Ae373682ED48dEa5AF48"       # The CP registration contract address
    ZK_COLLATERAL_CONTRACT = "0x1d2557C9d14882D9eE291BB66eaC6c1C4a587054"     # The ZK task's collateral contract address
  4. Follow the Deployment DOC to start.

Note: If you found too many resource are used, you can release your CP resources by running

kubectl get namespaces | awk '/^ns-/{print $1}' | xargs kubectl delete namespace
  1. Check your CP version the minimal CP version should be v0.5.0
    computing-provider -v
stefdeblessed commented 3 months ago

LFG best project ever

hilmanraz commented 3 months ago

good to be here

ThomasBlock commented 3 months ago

Thank you for the docs. Here a summary for ECP:

  1. backup computing-provider wallet export 0xA
  2. update computing-provider:
  3. Modify config.toml
    SWAN_COLLATERAL_CONTRACT
    REGISTER_CP_CONTRACT
    ZK_COLLATERAL_CONTRACT
  4. run
    restart
    computing-provider wallet import 0xA
    computing-provider wallet list
    computing-provider init --multi-address="..." --port 1234 --node-name="..."
    computing-provider account create --ownerAddress 0xB --workerAddress 0xA --beneficiaryAddress 0xB --task-types 1,2,4
    computing-provider collateral add --ecp --from 0xA --account 0xC 1
    computing-provider info
    restart

result:

computing-provider info
CP Account Info:                                                                                                                                               
   CP Account Address(2.0): 0xC                                                                                         
   Name:                    Test123                                                                                                                 
   Owner:                   0xB                                                                                         
   Node ID:                 04d03fcd36b...
   Domain:                  <YOUR CP Domain>                                                                                                                    
   Multi-Address:           /ip4/1.2.3.4/tcp/3456                                                                                                       
   Worker Address:          0xA                                                                                         
   Beneficiary Address:     0xB                                                                                         

Capabilities:               
   Task Types:              Fil-C2-512M,Aleo,Fil-C2-32G                                                                                                         
   Applications:            0                                                                                                                                   

Owner Balance(sETH):        0.728                                                                                                                               
Worker Balance(sETH):       0.728                                                                                                                               

ECP Balance(sETH):          
   Collateral:              1.000                                                                                                                               
   Escrow:                  0.000                                                                                                                               
FCP Balance(sETH):          
   Collateral:              0.000                                                                                                                               
   Escrow:                  0.000                    

For FCP it's quite the same. just change:

computing-provider account create --ownerAddress 0xB --workerAddress 0xA --beneficiaryAddress 0xB --task-types 3
computing-provider collateral add --fcp --from 0xA --account 0xC 1
computing-provider info
...
Capabilities:               
   Task Types:              AI                                                                                                                                  
   Applications:            31                                                                                                                                  

Owner Balance(sETH):        0.698                                                                                                                               
Worker Balance(sETH):       0.698                                                                                                                               

ECP Balance(sETH):          
   Collateral:              0.000                                                                                                                               
   Escrow:                  0.000                                                                                                                               
FCP Balance(sETH):          
   Collateral:              0.500                                                                                                                               
   Escrow:                  0.000