Skip to content

Commit

Permalink
Merge pull request #197 from Concordium/fix-deploy-module-cost
Browse files Browse the repository at this point in the history
Fix deploy module cost
  • Loading branch information
shjortConcordium authored May 25, 2023
2 parents 3cd61f2 + 37fc285 commit f413f64
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
6 changes: 6 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 7.0.1 2023-05-25

### Fixed

- Cost calculation for `deployModule` transaction.

## 7.0.0 2023-05-15

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/common-sdk",
"version": "7.0.0",
"version": "7.0.1",
"license": "Apache-2.0",
"engines": {
"node": ">=14.16.0"
Expand Down
7 changes: 6 additions & 1 deletion packages/common/src/accountTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ export class DeployModuleHandler
implements AccountTransactionHandler<DeployModulePayload>
{
getBaseEnergyCost(payload: DeployModulePayload): bigint {
const cost: number = Math.round(payload.source.length / 10);
let length = payload.source.length;
if (payload.version === undefined) {
// Remove the 8 bytes from the embedded version and length.
length -= 8;
}
const cost = Math.floor(length / 10);
return BigInt(cost);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"build-dev": "tsc"
},
"dependencies": {
"@concordium/common-sdk": "7.0.0",
"@concordium/common-sdk": "7.0.1",
"@grpc/grpc-js": "^1.3.4",
"@protobuf-ts/grpc-transport": "^2.8.2",
"buffer": "^6.0.3",
Expand Down
6 changes: 6 additions & 0 deletions packages/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 4.0.1 2023-05-25

### Changed

- Bumped @concordium/common-sdk to 7.0.1. (Fixes `deployModule` cost)

## 4.0.0 2023-05-15

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/web-sdk",
"version": "4.0.0",
"version": "4.0.1",
"license": "Apache-2.0",
"browser": "lib/concordium.min.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -48,7 +48,7 @@
"webpack-cli": "^4.9.2"
},
"dependencies": {
"@concordium/common-sdk": "7.0.0",
"@concordium/common-sdk": "7.0.1",
"@concordium/rust-bindings": "0.12.0",
"@grpc/grpc-js": "^1.3.4",
"@protobuf-ts/grpcweb-transport": "^2.8.2",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ __metadata:
languageName: node
linkType: hard

"@concordium/[email protected].0, @concordium/common-sdk@workspace:packages/common":
"@concordium/[email protected].1, @concordium/common-sdk@workspace:packages/common":
version: 0.0.0-use.local
resolution: "@concordium/common-sdk@workspace:packages/common"
dependencies:
Expand Down Expand Up @@ -1375,7 +1375,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@concordium/node-sdk@workspace:packages/nodejs"
dependencies:
"@concordium/common-sdk": 7.0.0
"@concordium/common-sdk": 7.0.1
"@grpc/grpc-js": ^1.3.4
"@noble/ed25519": ^1.7.1
"@protobuf-ts/grpc-transport": ^2.8.2
Expand Down Expand Up @@ -1414,7 +1414,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@concordium/web-sdk@workspace:packages/web"
dependencies:
"@concordium/common-sdk": 7.0.0
"@concordium/common-sdk": 7.0.1
"@concordium/rust-bindings": 0.12.0
"@grpc/grpc-js": ^1.3.4
"@protobuf-ts/grpcweb-transport": ^2.8.2
Expand Down

0 comments on commit f413f64

Please sign in to comment.