Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions decentralized-api/internal/server/admin/setup_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ func (s *Server) checkPermissions(ctx context.Context) Check {
warmKeyAddr := s.recorder.GetSignerAddress()

authzQueryClient := authztypes.NewQueryClient(s.recorder.GetClientContext())
grantsResp, err := authzQueryClient.GranteeGrants(ctx, &authztypes.QueryGranteeGrantsRequest{
// Query only the cold->warm pair. GranteeGrants scans the entire authz store
// (grants are keyed granter-first) and trips the node's query-gas-limit on a
// populated chain; Grants(granter,grantee) prefix-scans just this pair. Cf. the
// keeper's HasWarmKeyGrant.
grantsResp, err := authzQueryClient.Grants(ctx, &authztypes.QueryGrantsRequest{
Granter: coldKeyAddr,
Grantee: warmKeyAddr,
})

Expand All @@ -250,16 +255,14 @@ func (s *Server) checkPermissions(ctx context.Context) Check {
}
}

grantedFromColdKey := make(map[string]*authztypes.GrantAuthorization)
grantedFromColdKey := make(map[string]*authztypes.Grant)
for _, grant := range grantsResp.Grants {
if grant.Granter == coldKeyAddr {
var authorization authztypes.Authorization
if err := s.cdc.UnpackAny(grant.Authorization, &authorization); err != nil {
continue
}
if genericAuth, ok := authorization.(*authztypes.GenericAuthorization); ok {
grantedFromColdKey[genericAuth.Msg] = grant
}
var authorization authztypes.Authorization
if err := s.cdc.UnpackAny(grant.Authorization, &authorization); err != nil {
continue
}
if genericAuth, ok := authorization.(*authztypes.GenericAuthorization); ok {
grantedFromColdKey[genericAuth.Msg] = grant
}
}

Expand Down