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

[Feature Request] Dynamic GAS Fee Calculation #3688

Closed
LemonHX opened this issue Aug 25, 2022 · 0 comments · Fixed by #3838
Closed

[Feature Request] Dynamic GAS Fee Calculation #3688

LemonHX opened this issue Aug 25, 2022 · 0 comments · Fixed by #3838
Assignees
Labels
area:stdlib area:vm Issue about vm break Issue will break blockchain's compatibility enhancement Enhancement security

Comments

@LemonHX
Copy link
Member

LemonHX commented Aug 25, 2022

Feature Request

Describe the Feature Request

Now the gas fee of Starcoin's native method is a fixed value, which simplifies the difficulty of implementation, but it may bring great risks:

For example, the fixed GAS fee we use in the current Hash module may face an attacker who can implement a Hash Collision attack with a small amount of STC.
In other words, Vec and String, an attacker can spend a small amount of gas fee to execute a contract with a long expected execution cycle, which will be catastrophic for the infrastructure

Dynamic calculation of GAS fee can at least ensure that miners still get their due income when they are attacked, and at the same time, it can ensure that some newly added native modules with dynamic length can run normally so that similar problems will not occur.

Describe Preferred Solution

  • Change the container of dynamic length in stdlib and native methods whose calculation time is not fixed, such as string vector table, etc.
  • The gas fee module introduces dynamic calculation after the next move update

Describe Alternatives

Related Code

Additional Context

Although the implementation of the move language itself is cumbersome, it also uses dynamic calculation of gas, so doing so can keep us consistent with the official behavior

If the feature request is approved, would you be willing to submit a PR?
Yes / No (Help can be provided if you need assistance submitting a PR)

YES

@LemonHX LemonHX added enhancement Enhancement area:vm Issue about vm area:stdlib break Issue will break blockchain's compatibility security labels Aug 25, 2022
@nkysg nkysg self-assigned this Dec 30, 2022
@nkysg nkysg linked a pull request Feb 21, 2023 that will close this issue
7 tasks
@nkysg nkysg closed this as completed Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:stdlib area:vm Issue about vm break Issue will break blockchain's compatibility enhancement Enhancement security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants