-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix: Longer package Path Spend More Gas [investigate] #2736
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
No decision was reached yesterday. I still think making people pay more simply because of the longer username is unfair, but I do agree that shorter paths are more readable. Maybe a good compromise would be to only count gas for the part after |
This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months. |
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
This is expected behavior. The total transaction size per block is capped. We charge a gas fee based on the message size per byte. The package path is part of the transaction message. |
Agreed with @piux2. If the issue only concerns things like the |
Description
This PR address the process of identifying and resolviong the cause of gas usage variations during deployment based on the length of package path.
Testing Process
To identify the cause, I conducted tests using txtar testscript. I used the following script, chainging only the length of the package path for check.
Even when an out of gas error occured, the only function visible in the stack trace was the
ExecSignAndBroadcast
function inmaketx.go
file. Therefore, I added additional debugging lines to trace which function were being called.Cause Identification
While running the test script, I discovered that the
NewAnteHandler
function was being called repeatedly. This function contains the following line, whereTxSizeCostPerByte
is set a default value of 10:I added a debugging line like below:
func NewAnteHandler(ak AccountKeeper, bank BankKeeperI, sigGasConsumer SignatureVerificationGasConsumer, opts AnteOptions) sdk.AnteHandler { // ... newCtx.GasMeter().ConsumeGas(params.TxSizeCostPerByte*store.Gas(len(newCtx.TxBytes())), "txSize") + println("xxxxxxxx ante gas consumed", newCtx.GasMeter().GasConsumed()) // ... }
Output
I executed the script while chainging the pacakge path to make have different lengths and confirmed that the gas amount changed according to the length of
TxBytes()
as follows:Case 1: Package path length 22 (gno.land/p/demo/foo/aa)
TxSizeCosePerByte
NewAnteHandler
callCase 2: Package path length 23 (gno.land/p/demo/foo/aaa)
TxSizeCosePerByte
NewAnteHandler
callWe can observe that as the length of the package path increases, so does the gas usage. However, since gas usage is calculated based on the length of the transaction data obtained through the
TxBytes
method, we can hypothesize that it is also affected by the length of the contract content, not only the package path.[TODO]
Related Issue
#2083
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description