-
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
x/authz charge gas for expensive authorizations #8995
Conversation
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=2bbe2f2a49de4f28a5198a34120bfae0 |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=26826fee5aca4443b536e70f38d6d6f6 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=5b616c1269a8a2c1dea6631642610e30882496a8 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=730121ea62695792cb283c95b7c674b5a5dbbc61 |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=fc020eed5c0e41348eb494bdad2c40e1 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=be5c12fd5ada7674ac3ff619e3bc8bbe828b510f |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=e7a3636723596a95812cafc8bba634e42a6d2d93 |
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.
Looks like a good start. Is this R4R?
…os-sdk into aleem/8984-authz-gas
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=7a2b815380c885b58bd95b8157fcc1a0e62200fe |
Codecov Report
@@ Coverage Diff @@
## master #8995 +/- ##
==========================================
+ Coverage 58.97% 59.10% +0.12%
==========================================
Files 576 574 -2
Lines 32377 32241 -136
==========================================
- Hits 19095 19055 -40
+ Misses 11041 10950 -91
+ Partials 2241 2236 -5
|
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=bdfd3eeb81e13d81d329e281d8ab64fe04eeee0a |
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.
nits left, so pre-approving 🎉
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=e80dbd0b663446c1aa75c6ace083a66f |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=dd22b432b8ca40aca44d3a1deafc92ab |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=71aa27c4700a44289a7a7e7e51f26018 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=71900e768fb28de493d5472dffed1353271dc550 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=75b4ef85f35f6f6f04cdc320788364160c538330 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=82aed7737681416f5a0943e201daa7a467b985ee |
@@ -68,13 +80,16 @@ func (authorization StakeAuthorization) Accept(msg sdk.ServiceMsg, block tmproto | |||
isValidatorExists := false | |||
allowedList := authorization.GetAllowList().GetAddress() | |||
for _, validator := range allowedList { | |||
ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") |
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 do external clients know how much this number is? Are they required to dive into the code?
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.
They are not able to know exact number of gas. It would require a simulated run.
You can't do it, because one message can trigger many operations. And I don't think it would make sense to give exact numbers to clients. However, we should provide some estimates based on simulations.
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.
Could you possibly help with that @robert-zaremba ?
denyList := authorization.GetDenyList().GetAddress() | ||
for _, validator := range denyList { | ||
ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") |
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.
ditto
Thank you for the PR. I like where this is going, but it's hard to justify a hard coded value for gas like this. I may have missed something, but it doesn't seem there is a way for clients to know the cost of this transaction. What is wrong with adding a new method to Module.BasicManager that allows modules to register custom gas costs of a tx allowing clients to see the cost? I may also be conflating gas and fees here. |
@robert-zaremba suggesting on our call that we go with 10 (per iteration) for gas charge. |
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.
LGTM, couple of nits.
|
||
// ValidateBasic implements Authorization.ValidateBasic. | ||
func (authorization GenericAuthorization) ValidateBasic() error { | ||
if !msgservice.IsServiceMsg(authorization.MessageName) { |
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.
I am not sure if counting of "/" in IsServiceMsg is sufficient to check if typeURL satisfies service method name type e.g. i.e. /cosmos.bank.Msg/Send
Description
closes: #8984
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes