-
Notifications
You must be signed in to change notification settings - Fork 36
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
precompiled: adjust the gas cost of consortium precompiled contract #376
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minh-bq
force-pushed
the
fix/precompiled-gas
branch
4 times, most recently
from
November 14, 2023 11:04
915a221
to
60542f6
Compare
andicrypt
approved these changes
Nov 15, 2023
minh-bq
force-pushed
the
fix/precompiled-gas
branch
2 times, most recently
from
November 30, 2023 09:44
ea76b97
to
1f870a8
Compare
Currently, every time the precompiled contract is called, the contract ABI is unmarshalled even though the ABI is unchanged. This commit moves the contract ABI unmarshal to init to save the computation. This commit also optimizes the SortableValidators.Less to reduce the memory allocation.
This commit adds the benchmarks and calculated gas cost from the benchmarks to validator sorting, pick validator set and verify double sign proof precompiled contracts. Ethereum aims for 30 mgas/s when setting gas cost for precompiled contracts, we aims for 60 mgas/s. Benchmark results: BenchmarkConsortiumValidatorSorting/validator-sort-Gas=2310-8 548737 20101 ns/op 2310 gas/op 114.9 mgas/s 11616 B/op 224 allocs/op BenchmarkConsortiumValidatorSorting/validator-sort-Gas=9780-8 205410 66083 ns/op 9780 gas/op 148.0 mgas/s 49280 B/op 852 allocs/op BenchmarkConsortiumVerifyHeaders/verify-headers-Gas=21000-8 48445 232612 ns/op 21000 gas/op 90.27 mgas/s 53043 B/op 477 allocs/op BenchmarkConsortiumPickValidatorSet/pick-validator-set-Gas=3540-8 377305 32748 ns/op 3540 gas/op 108.1 mgas/s 19775 B/op 299 allocs/op BenchmarkConsortiumPickValidatorSet/pick-validator-set-Gas=14790-8 113479 129076 ns/op 14790 gas/op 114.6 mgas/s 76689 B/op 1092 allocs/op
minh-bq
force-pushed
the
fix/precompiled-gas
branch
from
December 4, 2023 03:36
1f870a8
to
5874958
Compare
andicrypt
approved these changes
Dec 29, 2023
minh-bq
added a commit
to minh-bq/ronin
that referenced
this pull request
Feb 20, 2024
…xieinfinity#376) * precompiled: move contract ABI unmarshal to init Currently, every time the precompiled contract is called, the contract ABI is unmarshalled even though the ABI is unchanged. This commit moves the contract ABI unmarshal to init to save the computation. This commit also optimizes the SortableValidators.Less to reduce the memory allocation. * precompiled: adjust the gas cost of consortium precompiled contract This commit adds the benchmarks and calculated gas cost from the benchmarks to validator sorting, pick validator set and verify double sign proof precompiled contracts. Ethereum aims for 30 mgas/s when setting gas cost for precompiled contracts, we aims for 60 mgas/s. Benchmark results: BenchmarkConsortiumValidatorSorting/validator-sort-Gas=2310-8 548737 20101 ns/op 2310 gas/op 114.9 mgas/s 11616 B/op 224 allocs/op BenchmarkConsortiumValidatorSorting/validator-sort-Gas=9780-8 205410 66083 ns/op 9780 gas/op 148.0 mgas/s 49280 B/op 852 allocs/op BenchmarkConsortiumVerifyHeaders/verify-headers-Gas=21000-8 48445 232612 ns/op 21000 gas/op 90.27 mgas/s 53043 B/op 477 allocs/op BenchmarkConsortiumPickValidatorSet/pick-validator-set-Gas=3540-8 377305 32748 ns/op 3540 gas/op 108.1 mgas/s 19775 B/op 299 allocs/op BenchmarkConsortiumPickValidatorSet/pick-validator-set-Gas=14790-8 113479 129076 ns/op 14790 gas/op 114.6 mgas/s 76689 B/op 1092 allocs/op
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the benchmarks and calculated gas cost from the benchmarks to
validator sorting, pick validator set and verify double sign proof precompiled
contracts. Ethereum aims for 30 mgas/s when setting gas cost for precompiled
contracts, we aims for 60 mgas/s.
Benchmark results: