Skip to content

Commit

Permalink
set testnet 26 as default
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Oct 19, 2023
1 parent 11e73b7 commit d3344f0
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
4 changes: 3 additions & 1 deletion api/test/robot_tests/cmd/cmd.robot
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Suite Setup Suite Setup
*** Test Cases ***
POST a Smart Contract
${sc}= Get File For Streaming Upload ${CURDIR}/../../testSC/build/main-testSC.wasm
${data}= Create Dictionary walletNickname=${WALLET_NICKNAME}
${data}= Create Dictionary
... walletNickname=${WALLET_NICKNAME}
... coins=3000000000
${file}= Create Dictionary smartContract=${sc}
${response}= POST ${API_URL}/cmd/deploySC data=${data} files=${file} expected_status=any
Log To Console json response: ${response.json()} # Print the response content to the test log for debugging
Expand Down
4 changes: 3 additions & 1 deletion api/test/robot_tests/event_manager/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Suite Setup

Deploy testSC
${sc}= Get File For Streaming Upload ${CURDIR}/../../testSC/build/main-testSC.wasm
${data}= Create Dictionary walletNickname=${WALLET_NICKNAME}
${data}= Create Dictionary
... walletNickname=${WALLET_NICKNAME}
... coins=3000000000
${file}= Create Dictionary smartContract=${sc}
${response}= POST ${API_URL}/cmd/deploySC data=${data} files=${file} expected_status=${STATUS_OK}
Should Contain ${response.json()['firstEvent']['data']} TestSC is deployed at :
Expand Down
6 changes: 3 additions & 3 deletions int/config/config_network.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
testnet:
DNS: AS12MGDGVB3xNDqzGidJM5fcAbjF1ZP5XAecm5ww4RU7sfQd4cMKk
DNS: AS12dCHtafNAiQMDFMoiyPqU1kX1S1Nn4PdAGvW9ffBueDW7JmLMP
URLs:
- https://test.massa.net/api/v2
- http://81.49.155.238:33035
Default: true

buildnet:
DNS: AS1pzpVk79cubdM7Zk9pNdg1JR4qKooVa6usyquiCEQhPeRWD9k7
URLs:
- https://buildnet.massa.net/api/v2
Default: true

labnet:
DNS: AS1PV17jWkbUs7mfXsn8Xfs9AK6tHiJoxuGu7RySFMV8GYdMeUSh
Expand Down
1 change: 1 addition & 0 deletions int/config/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"embed"
"fmt"
"regexp"
"strconv"

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

"strconv" imported and not used

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

"strconv" imported and not used

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / build-release / build and upload artifacts (ubuntu-latest, amd64, windows, x86_64-w64-mingw32-gcc, .exe)

"strconv" imported and not used

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / build-release / build and upload artifacts (ubuntu-20.04, amd64, linux)

"strconv" imported and not used

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / build-release / build and upload artifacts (macos-latest, amd64, darwin)

"strconv" imported and not used

Check failure on line 7 in int/config/network.go

View workflow job for this annotation

GitHub Actions / build-release / build and upload artifacts (macos-latest, arm64, darwin)

"strconv" imported and not used
"sync"

"github.com/massalabs/station/pkg/logger"
Expand Down
3 changes: 2 additions & 1 deletion pkg/node/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ func ListenEvents(
}

return nil,
fmt.Errorf("listening events for: opId %s, caller %s, emitter %s: Timeout", *operationID, *caller, *emitter)
// fmt.Errorf("listening events for: opId %s, caller %s, emitter %s: Timeout", *operationID, *caller, *emitter)
fmt.Errorf("timeout while listening events")
}
Binary file added pkg/onchain/website/sc/websiteDeployer_v26.wasm
Binary file not shown.
Binary file added pkg/onchain/website/sc/websiteStorer_v26.wasm
Binary file not shown.
22 changes: 19 additions & 3 deletions pkg/onchain/website/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,31 @@ func PrepareForUpload(

basePath := "sc/"

websiteDeployer, err := content.ReadFile(basePath + "websiteDeployer.wasm")
var scSuffix string = ".wasm"
versionFloat, err := strconv.ParseFloat(network.Version, 64)
if err != nil {
return "", "", fmt.Errorf("failed to parse nodeversion %s: %w", network.Version, err)
}

//nolint:gomnd
if versionFloat >= 26 {
// current version is higher than 26.0
scSuffix = "_v26.wasm"
}

websiteDeployer, err := content.ReadFile(basePath + "websiteDeployer" + scSuffix)
if err != nil {
return "", "", fmt.Errorf("websiteDeployer contract not found: %w", err)
}

websiteStorer, err := content.ReadFile(basePath + "websiteStorer.wasm")
websiteStorer, err := content.ReadFile(basePath + "websiteStorer" + scSuffix)
if err != nil {
return "", "", fmt.Errorf("websiteStorer contract not found: %w", err)
}

// webSiteInitCost correspond to the cost of owner initialization
//nolint:lll,gomnd
webSiteInitCost, err := sendOperation.StorageCostForEntry(network.Version, len([]byte(ownerKey)), 53 /*owner Addr max byteLenght*/)
webSiteInitCost, err := sendOperation.StorageCostForEntry(network.Version /*len([]byte(ownerKey))*/, 100, 10*53 /*owner Addr max byteLenght*/)
if err != nil {
return "", "", fmt.Errorf("unable to compute storage cost for website init: %w", err)
}
Expand All @@ -63,6 +75,10 @@ func PrepareForUpload(
return "", "", fmt.Errorf("unable to compute storage cost for account creation: %w", err)
}

logger.Debug("deployCost: ", deployCost)
logger.Debug("webSiteInitCost: ", webSiteInitCost)
logger.Debug("accountCreationCost: ", accountCreationCost)

totalStorageCost := webSiteInitCost + deployCost + accountCreationCost

logger.Debug("Website deployment cost estimation: ", totalStorageCost)
Expand Down

0 comments on commit d3344f0

Please sign in to comment.