-
Notifications
You must be signed in to change notification settings - Fork 9
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
(Partially) Remove 30000 #450
base: main
Are you sure you want to change the base?
Conversation
examples/eSealing/src/utils.ts
Outdated
maxContractExecutionEnergy: Energy.create(30000n), | ||
address: contractAddress, | ||
receiveName, | ||
maxContractExecutionEnergy: invokeResult.usedEnergy, |
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.
Adding a small margin EPSILON_ENERGY
will help in cases where someone else uses the front end at the same time and the state of the smart contract has changed between the simulation and the execution of the transaction.
const maxContractExecutionEnergy = Energy.create(dryRunResult.usedEnergy.value + EPSILON_ENERGY);
Applies to the other examples below as well.
examples/eSealing/src/utils.ts
Outdated
}); | ||
|
||
if (invokeResult.tag === 'failure') { | ||
throw Error('Transaction would fail!'); |
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.
It would be helpful if that error message reports the reason for the failure. The following, I suggest to cover:
- Return the
rejectReason
of the smart contract if present. - Return the
invokeResult.tag
(if it is notfailure
) since that is where we can seeOutOfEnergy
errors:
https://github.com/Concordium/concordium-smart-contract-tools/blob/main/front-end-tools/src/utils.ts#L209
const fullEntryPointName = `${contractName.value}.${entryPoint.value}`;
if (!res || res.tag === 'failure') {
const rejectReason = JSON.stringify(
((res as InvokeContractFailedResult)?.reason as RejectedReceive)?.rejectReason
);
throw new Error(
`RPC call 'invokeContract' on method '${fullEntryPointName}' of contract '${contractIndex}' failed.
${rejectReason !== undefined ? `Reject reason: ${rejectReason}` : ''}`
);
}
Reason for adding this reporting of errors now:
Before, people who reported problems while using this front end were able to give us a "failedTransactionHash" that we could use for further investigation. We don't have this anymore, so reporting potential problems here is what we have to rely on now.
This comment applies to the other examples as well.
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.
@DOBEN are you taking lead on this? We should ideally also either
- deploy these, or
- roll back the version bumps until we do deploy them
Purpose
Remove some of the hardcoded 30000 energy on contract updates.
Changes
Removed 30000 energy from updates in the wCCD, voting and eSealing dApps
Checklist
hard-to-understand areas.