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

Consume gas before verifying range proof #1987

Merged
merged 4 commits into from
Dec 13, 2024
Merged

Conversation

mj850
Copy link
Contributor

@mj850 mj850 commented Dec 11, 2024

Describe your changes and provide context

Consuming gas only after performing all operations could lead to exploits where a lot of work is done but no gas is consumed (or gas provided is insufficient). The correct practice should be to charge for gas before performing the work

Since we perform validation before other operations, it is not feasible to use a scaling gas multiplier. Instead, we can use a fixed gas cost (set as 1000000 to start with). This is currently roughly the amount we were going to be charging with the default 10x multiplier as well.

Testing performed to validate your change

Current unit and integration tests

Comment on lines 183 to 186
go func() {
ch <- am.ExportGenesis(ctx, cdc)
close(ch)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
@mj850 mj850 changed the base branch from main to feature/ct_module December 11, 2024 11:17
Copy link
Contributor

@dssei dssei left a comment

Choose a reason for hiding this comment

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

lgtm

@dssei dssei self-requested a review December 12, 2024 18:56
@mj850 mj850 merged commit e19c16c into feature/ct_module Dec 13, 2024
27 of 28 checks passed
@mj850 mj850 deleted the mj/gasBefore branch December 13, 2024 05:46
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.

2 participants