Skip to content

Commit

Permalink
Mainnet config (#1306)
Browse files Browse the repository at this point in the history
* add mainnet in config

* small various improvement

* update list of networks

* add robot tests

* fix space indentation
  • Loading branch information
Thykof authored Jan 8, 2024
1 parent 533545a commit 10b8154
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 7 deletions.
6 changes: 3 additions & 3 deletions api/swagger/server/restapi/resource/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ paths:
- in: path
name: network
type: string
enum: ["testnet", "buildnet", "labnet"]
enum: ["mainnet", "buildnet"]
required: true
description: The network to switch to (e.g., testnet, buildnet, labnet, mynet).
description: The network to switch to.
responses:
"200":
description: Network successfully switched.
Expand Down Expand Up @@ -1046,7 +1046,7 @@ definitions:
description: Massa node infos.
properties:
network:
enum: ["testnet", "labnet", "localhost", "buildnet"]
enum: ["mainnet", "buildnet"]
url:
type: string
dns:
Expand Down
1 change: 1 addition & 0 deletions api/test/robot_tests/cmd/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ${WALLET_PLUGIN_VERSION} v0.3.0
*** Keywords ***
Suite Setup
Basic Suite Setup
Switch To Buildnet
Init SC build environment
${GITHUB_ACTIONS} Get Environment Variable GITHUB_ACTIONS false
IF "${GITHUB_ACTIONS}" == "true"
Expand Down
6 changes: 6 additions & 0 deletions api/test/robot_tests/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ Get SC address
${words}= Split String ${string} :
${sc_address}= Get From List ${words} 1
RETURN ${sc_address}

Switch To Buildnet
${response}= POST
... ${API_URL}/network/buildnet
... expected_status=${STATUS_OK}
Should Be Equal ${response.json()['currentNetwork']} buildnet
26 changes: 26 additions & 0 deletions api/test/robot_tests/network/network.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*** Settings ***
Library RequestsLibrary
Resource ../keywords.resource
Resource ../variables.resource

*** Test Cases ***
GET /network
${response}= GET
... ${API_URL}/network
... expected_status=${STATUS_OK}
Should Be Equal ${response.json()['currentNetwork']} buildnet

GET /massa/node
${response}= GET
... ${API_URL}/massa/node
... expected_status=${STATUS_OK}
Should Be Equal ${response.json()['network']} buildnet

POST /network/mainnet
${response}= POST
... ${API_URL}/network/mainnet
... expected_status=${STATUS_OK}
Should Be Equal ${response.json()['currentNetwork']} mainnet

# Switch back to buildnet for other tests
Switch to buildnet
2 changes: 2 additions & 0 deletions api/test/robot_tests/web_on_chain/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Suite Setup
Set Suite Variables

Zip Test Website
Pass Execution Web On Chain is disabled temporary
[Documentation] Zip the test website in ./test_website and save it to the "${TEST_ZIP_FILE}" file
Log To Console Zipping test website
Expand All @@ -22,6 +23,7 @@ Zip Test Website
Archive Should Contain File ${CURDIR}/${TEST_ZIP_FILE} index.html

Set Suite Variables
Pass Execution Web On Chain is disabled temporary
${random_string}= Generate Random String 8 [LOWER][NUMBERS]
${website_url}= Set Variable test${random_string}
${website_description}= Set Variable description${random_string}
Expand Down
2 changes: 1 addition & 1 deletion int/api/pluginstore/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (l *list) Handle(_ operations.GetPluginStoreParams) middleware.Responder {
//nolint:varnamelen
pluginURL, os, checksum, err := plugin.GetDLChecksumAndOs()
if err != nil {
return operations.NewPluginManagerListInternalServerError().WithPayload(
return operations.NewGetPluginStoreInternalServerError().WithPayload(
&models.Error{Code: errorCodeFetchStore, Message: fmt.Sprintf("Error getting OS info: %s", err.Error())})
}

Expand Down
7 changes: 5 additions & 2 deletions int/config/config_network.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mainnet:
URLs:
- https://mainnet.massa.net/api/v2
ChainID: 77658377
Default: true
buildnet:
DNS: AS1pzpVk79cubdM7Zk9pNdg1JR4qKooVa6usyquiCEQhPeRWD9k7
URLs:
- https://buildnet.massa.net/api/v2
ChainID: 77658366
Default: true
4 changes: 4 additions & 0 deletions web/massastation/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class I18n {
// we are using pick in order to make life easier when the day for plurals and copy with params arrives
const result = dot.pick(key, copy);

if (!result) {
console.warn(`I18n::t:: No translation found for key ${key}`);
}

return interpolations
? this._interpolateKeys(result, interpolations)
: result ?? key;
Expand Down
2 changes: 1 addition & 1 deletion web/massastation/src/mirage/factories/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NetworkModel } from '../../models/NetworkModel';

export const networkFactory = Factory.extend<NetworkModel>({
availableNetworks() {
return ['testnet', 'buildnet', 'labnet'];
return ['mainnet', 'buildnet'];
},
currentNetwork() {
return 'buildnet';
Expand Down

0 comments on commit 10b8154

Please sign in to comment.