Skip to content
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

Calculate gas for built in functions #2977

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Apr 8, 2021

  • Calculate the gas cost for built-in functions like ESDT Transfer,ESDT Local Burn,ESDT Local Mint, etc

@miiu96 miiu96 requested a review from sasurobert April 8, 2021 18:56
@miiu96 miiu96 changed the title calcule gas for built in function Calculate gas for built in functions Apr 8, 2021
@miiu96 miiu96 self-assigned this Apr 8, 2021
@AdoAdoAdo AdoAdoAdo self-requested a review April 9, 2021 06:47
// BuiltInFunctionsCostHandler is able to calculated the cost of a built in function call
type BuiltInFunctionsCostHandler interface {
ComputeBuiltInCost(tx process.TransactionWithFeeHandler) uint64
IsSpecialBuiltIn(tx process.TransactionWithFeeHandler) bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add IsInterfaceNIl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

}

// IsSpecialBuiltIn will check is the provided transaction is a special build in function call
func (bc *builtInFunctionsCost) IsSpecialBuiltIn(tx process.TransactionWithFeeHandler) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to IsBuiltInFuncCall ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

process/economics/interface.go Outdated Show resolved Hide resolved
process/economics/builtInFunctionsCost.go Show resolved Hide resolved
// IsSpecialBuiltIn -
func (b BuiltInCostHandlerStub) IsSpecialBuiltIn(_ process.TransactionWithFeeHandler) bool {
// IsBuiltInFuncCall -
func (b BuiltInCostHandlerStub) IsBuiltInFuncCall(_ process.TransactionWithFeeHandler) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change to pointer receiver everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

// IsSpecialBuiltIn -
func (b BuiltInCostHandlerStub) IsSpecialBuiltIn(_ process.TransactionWithFeeHandler) bool {
// IsBuiltInFuncCall -
func (b BuiltInCostHandlerStub) IsBuiltInFuncCall(_ process.TransactionWithFeeHandler) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change to pointer receiver everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

miiu96 and others added 3 commits April 9, 2021 14:27
(a transaction that does an NFT Transfer will have the "gasUsed" field equal with gas limit) and the remaining gas will be seen in SCR)
Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed.

@iulianpascalau iulianpascalau merged commit 3024443 into feat/eip-esdt-local-mint Apr 12, 2021
@iulianpascalau iulianpascalau deleted the calculate-gas-limit-special-built-in-functions branch April 12, 2021 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants