-
Notifications
You must be signed in to change notification settings - Fork 382
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
[gnovm/bug] deploying same contract to longer pkg_path spends more gas #2083
Comments
@r3v4s |
It's gnodev node and simulations are on same chain (not fresh). |
just a share of my test result(every time on fresh node). curious what's happening, more dig needed. the difference between the two is: 815,040 gnokey maketx addpkg -pkgdir ./gnoswap/uint256 -pkgpath gno.land/p/demo/u2 -broadcast=true -gas-fee 1ugnot -gas-wanted 20000000 1216 -remote localhost:26657 OK! gnokey maketx addpkg -pkgdir ./gnoswap/uint256 -pkgpath gno.land/p/demo/what_a_long_pkg_path -broadcast=true -gas-fee 1ugnot -gas-wanted 20000000 1216 -remote localhost:26657 OK! |
if run on non-fresh node, the gas of the second OK! $ gnokey maketx addpkg -pkgdir ./gnoswap/uint256 -pkgpath gno.land/p/demo/what_a_long_pkg_path -broadcast=true -gas-fee 1ugnot -gas-wanted 20000000 1216 -remote localhost:26657 OK! |
In a simplified scenario to replicate the issue, found that the However, when executing on a non-fresh node, an additional Before delving deeper into investigation, it would be helpful to understand the exact amount of gas increases due to the extended package path. This information will provide a clearer baseline for further analysis. @r3v4s , can you provide an exact number? 🙏 store set, write byte, writeCostPerByte: 30, len(value) 201, value: store set, write byte, writeCostPerByte: 30, len(value) 236, value: |
Update: A simple solution could be to use a fixed-length pkgpath, such as |
@ltzmaxwell I'm not really sure that deploying to a longer path should take more gas. This would mean that over time, deployment cost would go up simply because the shorter paths are taken. Also, a user with a shorter username would not have to pay as much for as a user with a longer username for uploading the same code, which is unfair. Is there any way we can not spend more gas only if a package path is longer? |
It's likely a bug that we can fix. However, it may also be beneficial for security to encourage shorter names, as this improves readability when using or auditing the dApps. |
deploying same contract to longer pkg_path spends more gas
Description
Originally, this issue was founded here
Somehow, deploying same contract to longer pkg_path spends more gas
The text was updated successfully, but these errors were encountered: