Skip to content

Commit

Permalink
testnet26 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Oct 19, 2023
1 parent 50a28e7 commit 47b1f37
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
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
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")
}
3 changes: 2 additions & 1 deletion pkg/node/sendoperation/sendoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
DefaultFee = 0
accountCreationStorageCost = 1_000_000
StorageCostPerByte = 100_000
StorageEntryBaseBytes = 4
OneMassa = 1_000_000_000
)

Expand Down Expand Up @@ -234,7 +235,7 @@ func StorageCostForEntry(nodeVersion string, keyByteLengh, valueByteLenght int)
return (valueByteLenght + 10) * lecagyStorageCost, nil
}

return (valueByteLenght + keyByteLengh) * StorageCostPerByte, nil
return (valueByteLenght + keyByteLengh + StorageEntryBaseBytes) * StorageCostPerByte, nil
}

func AccountCreationStorageCost(nodeVersion string) (int, error) {
Expand Down
Binary file modified pkg/onchain/website/sc/websiteDeployer_v26.wasm
Binary file not shown.
16 changes: 12 additions & 4 deletions pkg/onchain/website/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ func PrepareForUpload(
) (string, string, error) {
client := node.NewClient(network.NodeURL)

basePath := "sc/"

scSuffix := ".wasm"

versionFloat, err := strconv.ParseFloat(network.Version, 64)
if err != nil {
return "", "", fmt.Errorf("failed to parse nodeversion %s: %w", network.Version, err)
}

scSuffix := ".wasm"

//nolint:gomnd
if versionFloat >= 26 {
// current version is higher than 26.0
scSuffix = "_v26.wasm"
logger.Info("USING TESTNET 26 contract!: ")

}
logger.Info("TESTNET 26 scSuffix: ", scSuffix)
logger.Info("TESTNET 26 len([]byte(ownerKey): ", len([]byte(ownerKey)))

basePath := "sc/"

websiteDeployer, err := content.ReadFile(basePath + "websiteDeployer" + scSuffix)
if err != nil {
Expand Down Expand Up @@ -76,6 +80,10 @@ func PrepareForUpload(
return "", "", fmt.Errorf("unable to compute storage cost for account creation: %w", err)
}

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

totalStorageCost := webSiteInitCost + deployCost + accountCreationCost

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

0 comments on commit 47b1f37

Please sign in to comment.