x/authz charge gas for expensive authorizations (#8995)

* WIP

* Add consume gas

* update authz.go

* add build flag

* Update x/staking/types/authz.go

* Update x/staking/types/authz.go

* add tests docs

* review changes

* fix operations

* Update x/authz/types/msgs.go

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>

* review changes

* update gas cost

* review changes

Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
MD Aleem
2021-04-09 12:33:27 +00:00
committed by GitHub
co-authored by Amaury SaReN
parent 338e9a4277
commit 8a376a41c9
13 changed files with 175 additions and 37 deletions
+7
View File
@@ -3,6 +3,7 @@ package msgservice
import (
"context"
"fmt"
"strings"
"github.com/gogo/protobuf/proto"
"google.golang.org/grpc"
@@ -42,3 +43,9 @@ func RegisterMsgServiceDesc(registry codectypes.InterfaceRegistry, sd *grpc.Serv
func noopInterceptor(_ context.Context, _ interface{}, _ *grpc.UnaryServerInfo, _ grpc.UnaryHandler) (interface{}, error) {
return nil, nil
}
// IsServiceMsg checks if a type URL corresponds to a service method name,
// i.e. /cosmos.bank.Msg/Send vs /cosmos.bank.MsgSend
func IsServiceMsg(typeURL string) bool {
return strings.Count(typeURL, "/") >= 2
}