-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JSS-101] Estimate smart-contract update energy costs #362
base: main
Are you sure you want to change the base?
[JSS-101] Estimate smart-contract update energy costs #362
Conversation
Added new method getContractUpdateEnergyCost Get contract update energy cost Estimated by calculateEnergyCost, where transactionSpecificCost received from invokeContract used energy Updated README.md for node-sdk examples
fix markdown-lint
examples/nodejs/README.md
Outdated
|
||
Default endpoint for node is 'localhost:20000', | ||
but instead of installing local node, | ||
can be used testnet node <https://node.testnet.concordium.com:20000> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endpoint has been replaced
can be used testnet node <https://node.testnet.concordium.com:20000> | |
can be used testnet node <https://grpc.testnet.concordium.com:20000> |
.markdown-linkcheck.json
Outdated
@@ -2,6 +2,9 @@ | |||
"ignorePatterns": [ | |||
{ | |||
"pattern": "classes/grpc.ConcordiumGRPCClient.html" | |||
}, | |||
{ | |||
"pattern": "https://node.testnet.concordium.com:20000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are migrating to another endpoint
"pattern": "https://node.testnet.concordium.com:20000" | |
"pattern": "https://grpc.testnet.concordium.com:20000" |
* @param {Parameter.Type} parameter - Input for contract function | ||
* @param {ReceiveName.Type} method - Represents a receive-function in a smart contract module | ||
* @param {bigint} signatureCount - Number of expected signatures | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Please document when this function throws and also that the estimate is given for the last finalized block according to the node, which means this the actual energy cost might be different depending on the implementation of the smart contract and the interaction with the instance, since this was estimated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not make sense to add an optional blockHash
argument which can be passed to the grpc client?
changed test node link updated getContractUpdateEnergyCost description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly comments regarding how we usually bump/release
packages/sdk/src/contractHelpers.ts
Outdated
export function getUpdatePayloadSize( | ||
parameterSize: number, | ||
receiveNameLength: number | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) { | |
): bigint { |
packages/sdk/package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@concordium/web-sdk", | |||
"version": "7.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would argue that this is a minor version (as it adds new functionality). The way we usually release though, is that we create a pull request specifically for bumping the version in preparation for the release. This is to avoid confusion with regards to what has already been released and what is pending release.
packages/sdk/CHANGELOG.md
Outdated
@@ -1,5 +1,11 @@ | |||
# Changelog | |||
|
|||
## 7.4.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consequently, this should be
## 7.4.1 | |
## Unreleased |
* @param {Parameter.Type} parameter - Input for contract function | ||
* @param {ReceiveName.Type} method - Represents a receive-function in a smart contract module | ||
* @param {bigint} signatureCount - Number of expected signatures | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not make sense to add an optional blockHash
argument which can be passed to the grpc client?
changed version to unreleased added optional blockHash param
…pdate-energy-costs
Purpose
We should provide functions for computing an estimate of energy usage needed for running an update transaction for a smart contract on chain.
The function should take the information needed for the update and use invokeContract to compute the energy cost.
Changes
Added new method getContractUpdateEnergyCost
Get contract update energy cost
Estimated by calculateEnergyCost, where transactionSpecificCost received from invokeContract used energy
Actual energy can be different from the estimated (about 1 - 5 NRG)
Updated README.md for node-sdk examples
Checklist
hard-to-understand areas.
By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0
link: https://developers.concordium.com/CLAs/Contributor-License-Agreement-v1.0.pdf
I accept the above linked CLA.