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

vm: changes in the gas estimation #3611

Closed
Tracked by #145
dshulyak opened this issue Oct 3, 2022 · 0 comments
Closed
Tracked by #145

vm: changes in the gas estimation #3611

dshulyak opened this issue Oct 3, 2022 · 0 comments
Assignees

Comments

@dshulyak
Copy link
Contributor

dshulyak commented Oct 3, 2022

more info: https://community.spacemesh.io/t/nonce-in-self-spawn-never-ending-battle/304/4

val storageCost = tx.binarySize * STORAGE_COST_FACTOR
val baseCost = FIXED_GAS(tx.template, "Verify")
val intrinsicGas = baseCost + storageCost
val computationCost = FIXED_GAS(tx.template, tx.method)
val totalGas = intrinsicGas + computationCost

implementation

  • add constant BaseGas for every template
  • extend ParseOutput with BaseGas field
  • header.MaxGas should be equal to BaseGas + len(tx) * STORAGE_COST + FixedGas
  • change the following condition ctx.PrincipalAccount.Balance < ctx.ParseOutput.FixedGas*ctx.ParseOutput.GasPrice
    to ctx.PrincipalAccount.Balance < BaseGas + len(tx) * STORAGE_COST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant