-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
R4R: Consume Gas Proportional to Tx Size #3447
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3447 +/- ##
===========================================
- Coverage 52.97% 52.94% -0.03%
===========================================
Files 137 137
Lines 10719 10741 +22
===========================================
+ Hits 5678 5687 +9
- Misses 4698 4710 +12
- Partials 343 344 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions but mostly looks good.
address your comments @cwgoes -- lmk if the cost logic makes sense. |
I think that's fine; we should consider the total tx cost but in the broader context of #1008 (comment). |
Hey @mossid can you take a look at this too? |
x/auth/ante.go
Outdated
// contain a pubkey, so we must account for tx size of including a | ||
// StdSignature (Amino encoding) and simulate gas consumption | ||
// (assuming a SECP256k1 simulation key). | ||
simSig := StdSignature{PubKey: pubKey} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the multisig case, gas estimate would be wrong here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't support multi-sig for estimation afaik -- correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we with a flag or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cwgoes multisig is tricky nonetheless - signature verification strictly depends on the signature itself, i.e. given a N-of-M multikey and a multisig signature with P sub sigs, all sub signatures get always processed/verified, even when N < P. Knowing the original N-of-M key might help obtaining a more accurate estimate (i.e. you know that you would process at least N signature), though it does not solve the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just estimating the upper bound by default?
(I agree that the problem is tricky but we should optimize for the average use case and relatively low cost of paying a bit extra gas)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to account for multisigs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gas estimate in multisig txs is controversial - approving
Looks like we are still failing some tests here. |
@cwgoes @alessio @jackzampolin updated to account for multisigs and fixed CI regression. |
BaseApp#Simulate
now takes tx bytes because it needs to be set on the contextcloses: #3256
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: