Skip to content

Commit

Permalink
feat: migrate kras and dar to mainnet and testnet (#1038)
Browse files Browse the repository at this point in the history
* feat: migrate kras and dar to mainnet and testnet

* Apply automatic changes

* migrate fluence.yaml

* support dar and kras flags and args under the hood

* migrate env config, add deprecation warning

* Update README.md

Co-authored-by: folex <[email protected]>

---------

Co-authored-by: shamsartem <[email protected]>
Co-authored-by: folex <[email protected]>
  • Loading branch information
3 people authored Sep 16, 2024
1 parent ce3fb07 commit fa332a3
Show file tree
Hide file tree
Showing 23 changed files with 1,969 additions and 1,269 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ curl -qsL https://raw.githubusercontent.com/fluencelabs/cli/main/install.sh | ba

### Update

To select `fluence` version compatible with certain network (`dar`, `stage`,
`kras`) run:
To select `fluence` version compatible with certain network (`stage`, `testnet`, `mainnet`) run:

```shell
fluence update <network>
Expand Down
877 changes: 447 additions & 430 deletions cli/docs/commands/README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions cli/docs/configs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Defines user project preferences

## Properties

| Property | Type | Required | Description |
|--------------|---------|----------|---------------------------------------------------------------------------------------------------|
| `version` | integer | **Yes** | |
| `fluenceEnv` | string | No | Fluence environment to connect to Possible values are: `dar`, `kras`, `stage`, `local`, `custom`. |
| Property | Type | Required | Description |
|--------------|---------|----------|----------------------------------------------------------------------------------------------------------|
| `version` | integer | **Yes** | |
| `fluenceEnv` | string | No | Fluence environment to connect to Possible values are: `testnet`, `mainnet`, `stage`, `local`, `custom`. |

8 changes: 4 additions & 4 deletions cli/docs/configs/fluence.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ Custom Fluence environment to use when connecting to Fluence network

### Properties

| Property | Type | Required | Description |
|----------------|----------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `contractsEnv` | string | **Yes** | Contracts environment to use for this fluence network to sign contracts on the blockchain Possible values are: `dar`, `kras`, `stage`, `local`. |
| `relays` | string[] | **Yes** | List of custom relay multiaddresses to use when connecting to Fluence network |
| Property | Type | Required | Description |
|----------------|----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `contractsEnv` | string | **Yes** | Contracts environment to use for this fluence network to sign contracts on the blockchain Possible values are: `testnet`, `mainnet`, `stage`, `local`. |
| `relays` | string[] | **Yes** | List of custom relay multiaddresses to use when connecting to Fluence network |

## deployments

Expand Down
22 changes: 11 additions & 11 deletions cli/docs/configs/provider-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Created offers

### Properties

| Property | Type | Required | Description |
|----------|-------------------|----------|----------------|
| `custom` | [object](#custom) | No | Created offers |
| `dar` | [object](#dar) | No | Created offers |
| `kras` | [object](#kras) | No | Created offers |
| `local` | [object](#local) | No | Created offers |
| `stage` | [object](#stage) | No | Created offers |
| Property | Type | Required | Description |
|-----------|--------------------|----------|----------------|
| `custom` | [object](#custom) | No | Created offers |
| `local` | [object](#local) | No | Created offers |
| `mainnet` | [object](#mainnet) | No | Created offers |
| `stage` | [object](#stage) | No | Created offers |
| `testnet` | [object](#testnet) | No | Created offers |

### custom

Expand All @@ -42,7 +42,7 @@ Created offers
| `id` | string | **Yes** | Offer id |
| `providerAddress` | string | **Yes** | Provider address |

### dar
### local

Created offers

Expand All @@ -61,7 +61,7 @@ Created offers
| `id` | string | **Yes** | Offer id |
| `providerAddress` | string | **Yes** | Provider address |

### kras
### mainnet

Created offers

Expand All @@ -80,7 +80,7 @@ Created offers
| `id` | string | **Yes** | Offer id |
| `providerAddress` | string | **Yes** | Provider address |

### local
### stage

Created offers

Expand All @@ -99,7 +99,7 @@ Created offers
| `id` | string | **Yes** | Offer id |
| `providerAddress` | string | **Yes** | Provider address |

### stage
### testnet

Created offers

Expand Down
4 changes: 2 additions & 2 deletions cli/docs/configs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Logs configuration

| Property | Type | Required | Description |
|------------------|---------|----------|---------------------------------|
| `logLevel` | string | No | Log level. Default: info |
| `logLevel` | string | No | Log level. Default: debug |
| `reportHashrate` | boolean | No | Report hashrate. Default: false |

### prometheusEndpoint
Expand Down Expand Up @@ -138,7 +138,7 @@ Logs configuration

| Property | Type | Required | Description |
|------------------|---------|----------|---------------------------------|
| `logLevel` | string | No | Log level. Default: info |
| `logLevel` | string | No | Log level. Default: debug |
| `reportHashrate` | boolean | No | Report hashrate. Default: false |

##### prometheusEndpoint
Expand Down
54 changes: 27 additions & 27 deletions cli/docs/configs/workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Info about deals created when deploying workers that is stored by environment th

### Properties

| Property | Type | Required | Description |
|----------|-------------------|----------|------------------------|
| `custom` | [object](#custom) | No | A map of created deals |
| `dar` | [object](#dar) | No | A map of created deals |
| `kras` | [object](#kras) | No | A map of created deals |
| `local` | [object](#local) | No | A map of created deals |
| `stage` | [object](#stage) | No | A map of created deals |
| Property | Type | Required | Description |
|-----------|--------------------|----------|------------------------|
| `custom` | [object](#custom) | No | A map of created deals |
| `local` | [object](#local) | No | A map of created deals |
| `mainnet` | [object](#mainnet) | No | A map of created deals |
| `stage` | [object](#stage) | No | A map of created deals |
| `testnet` | [object](#testnet) | No | A map of created deals |

### custom

Expand All @@ -47,10 +47,10 @@ Contains data related to your deployment, including, most importantly, deal id,
| `dealId` | string | **Yes** | Lowercased version of dealIdOriginal without 0x prefix. Currently unused. Was previously used to resolve workers in aqua |
| `definition` | string | **Yes** | CID of uploaded to IPFS App Definition, which contains the data about everything that you are trying to deploy, including spells, service and module configs and CIDs for service wasms |
| `timestamp` | string | **Yes** | ISO timestamp of the time when the worker was deployed |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `dar`, `kras`, `stage`, `local`. |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `kras`, `dar`, `stage`, `local`. |
| `matched` | boolean | No | Is deal matched |

### dar
### local

A map of created deals

Expand All @@ -73,10 +73,10 @@ Contains data related to your deployment, including, most importantly, deal id,
| `dealId` | string | **Yes** | Lowercased version of dealIdOriginal without 0x prefix. Currently unused. Was previously used to resolve workers in aqua |
| `definition` | string | **Yes** | CID of uploaded to IPFS App Definition, which contains the data about everything that you are trying to deploy, including spells, service and module configs and CIDs for service wasms |
| `timestamp` | string | **Yes** | ISO timestamp of the time when the worker was deployed |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `dar`, `kras`, `stage`, `local`. |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `kras`, `dar`, `stage`, `local`. |
| `matched` | boolean | No | Is deal matched |

### kras
### mainnet

A map of created deals

Expand All @@ -99,10 +99,10 @@ Contains data related to your deployment, including, most importantly, deal id,
| `dealId` | string | **Yes** | Lowercased version of dealIdOriginal without 0x prefix. Currently unused. Was previously used to resolve workers in aqua |
| `definition` | string | **Yes** | CID of uploaded to IPFS App Definition, which contains the data about everything that you are trying to deploy, including spells, service and module configs and CIDs for service wasms |
| `timestamp` | string | **Yes** | ISO timestamp of the time when the worker was deployed |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `dar`, `kras`, `stage`, `local`. |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `kras`, `dar`, `stage`, `local`. |
| `matched` | boolean | No | Is deal matched |

### local
### stage

A map of created deals

Expand All @@ -125,10 +125,10 @@ Contains data related to your deployment, including, most importantly, deal id,
| `dealId` | string | **Yes** | Lowercased version of dealIdOriginal without 0x prefix. Currently unused. Was previously used to resolve workers in aqua |
| `definition` | string | **Yes** | CID of uploaded to IPFS App Definition, which contains the data about everything that you are trying to deploy, including spells, service and module configs and CIDs for service wasms |
| `timestamp` | string | **Yes** | ISO timestamp of the time when the worker was deployed |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `dar`, `kras`, `stage`, `local`. |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `kras`, `dar`, `stage`, `local`. |
| `matched` | boolean | No | Is deal matched |

### stage
### testnet

A map of created deals

Expand All @@ -151,7 +151,7 @@ Contains data related to your deployment, including, most importantly, deal id,
| `dealId` | string | **Yes** | Lowercased version of dealIdOriginal without 0x prefix. Currently unused. Was previously used to resolve workers in aqua |
| `definition` | string | **Yes** | CID of uploaded to IPFS App Definition, which contains the data about everything that you are trying to deploy, including spells, service and module configs and CIDs for service wasms |
| `timestamp` | string | **Yes** | ISO timestamp of the time when the worker was deployed |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `dar`, `kras`, `stage`, `local`. |
| `chainNetwork` | string | No | DEPRECATED. Blockchain network name that was used when deploying workers Possible values are: `kras`, `dar`, `stage`, `local`. |
| `matched` | boolean | No | Is deal matched |

## hosts
Expand All @@ -160,13 +160,13 @@ Info about directly deployed workers that is stored by environment that you depl

### Properties

| Property | Type | Required | Description |
|----------|-------------------|----------|------------------------------------|
| `custom` | [object](#custom) | No | A map of directly deployed workers |
| `dar` | [object](#dar) | No | A map of directly deployed workers |
| `kras` | [object](#kras) | No | A map of directly deployed workers |
| `local` | [object](#local) | No | A map of directly deployed workers |
| `stage` | [object](#stage) | No | A map of directly deployed workers |
| Property | Type | Required | Description |
|-----------|--------------------|----------|------------------------------------|
| `custom` | [object](#custom) | No | A map of directly deployed workers |
| `local` | [object](#local) | No | A map of directly deployed workers |
| `mainnet` | [object](#mainnet) | No | A map of directly deployed workers |
| `stage` | [object](#stage) | No | A map of directly deployed workers |
| `testnet` | [object](#testnet) | No | A map of directly deployed workers |

### custom

Expand Down Expand Up @@ -202,7 +202,7 @@ Contains data related to your direct deployment. Most importantly, it contains i
| `spell_id` | string | **Yes** | id of the installation spell, can be used to e.g. print spell logs |
| `worker_id` | string | **Yes** | Can be used to access worker in aqua: `on s.workerId via s.hostId` |

### dar
### local

A map of directly deployed workers

Expand Down Expand Up @@ -236,7 +236,7 @@ Contains data related to your direct deployment. Most importantly, it contains i
| `spell_id` | string | **Yes** | id of the installation spell, can be used to e.g. print spell logs |
| `worker_id` | string | **Yes** | Can be used to access worker in aqua: `on s.workerId via s.hostId` |

### kras
### mainnet

A map of directly deployed workers

Expand Down Expand Up @@ -270,7 +270,7 @@ Contains data related to your direct deployment. Most importantly, it contains i
| `spell_id` | string | **Yes** | id of the installation spell, can be used to e.g. print spell logs |
| `worker_id` | string | **Yes** | Can be used to access worker in aqua: `on s.workerId via s.hostId` |

### local
### stage

A map of directly deployed workers

Expand Down Expand Up @@ -304,7 +304,7 @@ Contains data related to your direct deployment. Most importantly, it contains i
| `spell_id` | string | **Yes** | id of the installation spell, can be used to e.g. print spell logs |
| `worker_id` | string | **Yes** | Can be used to access worker in aqua: `on s.workerId via s.hostId` |

### stage
### testnet

A map of directly deployed workers

Expand Down
2 changes: 1 addition & 1 deletion cli/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Remove colors from CLI output
# FORCE_COLOR=0

# Fluence network to use for tests. Can be 'stage', 'dar', 'kras' or 'local'
# Fluence network to use for tests. Can be 'testnet', 'stage', 'mainnet' or 'local'
# 'local' multiaddresses are currently hardcoded at `src/lib/multiaddres.ts`
# FLUENCE_ENV="local"

Expand Down
16 changes: 15 additions & 1 deletion cli/src/lib/chainFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { commandObj } from "./commandObj.js";
import { ENV_FLAG_NAME, PRIV_KEY_FLAG_NAME } from "./const.js";

export type ChainFlags = {
Expand All @@ -25,5 +26,18 @@ export type ChainFlags = {
export let chainFlags: ChainFlags = {};

export function setChainFlags(flags: ChainFlags) {
chainFlags = flags;
let env = flags[ENV_FLAG_NAME];

if (env === "kras") {
commandObj.warn(`'kras' is deprecated, use 'mainnet' instead`);
env = "mainnet";
} else if (env === "dar") {
commandObj.warn(`'dar' is deprecated, use 'testnet' instead`);
env = "testnet";
}

chainFlags = {
...flags,
...(env === undefined ? {} : { [ENV_FLAG_NAME]: env }),
};
}
Loading

0 comments on commit fa332a3

Please sign in to comment.