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

consensus: use the public constant MaxGasLimit to check the header.GasLimit #24092

Merged
merged 4 commits into from
Dec 14, 2021

Conversation

jovijovi
Copy link
Contributor

Use the constant maxGasLimit to check the header.GasLimit to avoid creating new variables repeatedly.
It has been tested and passed in the development environment.

@holiman
Copy link
Contributor

holiman commented Dec 10, 2021

The way you did it, instead of being three 'magic' values spread out in the codebase, it's instead three constants spread out in the codebase. Not sure if that's (a lot) better, really?
If we want it a constant, perhaps better to make it a public constant somewhere.

@jovijovi
Copy link
Contributor Author

The way you did it, instead of being three 'magic' values spread out in the codebase, it's instead three constants spread out in the codebase. Not sure if that's (a lot) better, really?

If we want it a constant, perhaps better to make it a public constant somewhere.

I thought of that. But there seems to be no place for public constants in the consensus code files. Maybe we can add a new consensus/const.go file to save public constants.

@jovijovi jovijovi changed the title consensus: use the constant maxGasLimit to check the header.GasLimit consensus: use the public constant MaxGasLimit to check the header.GasLimit Dec 12, 2021
@fjl
Copy link
Contributor

fjl commented Dec 13, 2021

We usually keep such constants in package params.

@jovijovi
Copy link
Contributor Author

We usually keep such constants in package params.

You're right, I got it. I'll keep the constant MaxGasLimit in params/protocol_params.go.

@holiman holiman added this to the 1.10.14 milestone Dec 14, 2021
@holiman holiman merged commit b3b8b26 into ethereum:master Dec 14, 2021
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
* consensus: use the maxGasLimit constant to check the header.GasLimit to avoid creating new variables repeatedly

* consensus: check the header.GasLimit by the public constant MaxGasLimit

* consensus: check the header.GasLimit by the constant MaxGasLimit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants