@@ -206,11 +206,11 @@ func (k Keeper) GetOwners(ctx sdk.Context, index uint64) (types.CapabilityOwners
206
206
func (k Keeper ) InitializeCapability (ctx sdk.Context , index uint64 , owners types.CapabilityOwners ) {
207
207
memStore := ctx .KVStore (k .memKey )
208
208
209
- cap := types .NewCapability (index )
209
+ capability := types .NewCapability (index )
210
210
for _ , owner := range owners .Owners {
211
211
// Set the forward mapping between the module and capability tuple and the
212
212
// capability name in the memKVStore
213
- memStore .Set (types .FwdCapabilityKey (owner .Module , cap ), []byte (owner .Name ))
213
+ memStore .Set (types .FwdCapabilityKey (owner .Module , capability ), []byte (owner .Name ))
214
214
215
215
// Set the reverse mapping between the module and capability name and the
216
216
// index in the in-memory store. Since marshalling and unmarshalling into a store
@@ -219,7 +219,7 @@ func (k Keeper) InitializeCapability(ctx sdk.Context, index uint64, owners types
219
219
memStore .Set (types .RevCapabilityKey (owner .Module , owner .Name ), sdk .Uint64ToBigEndian (index ))
220
220
221
221
// Set the mapping from index from index to in-memory capability in the go map
222
- k .capMap [index ] = cap
222
+ k .capMap [index ] = capability
223
223
}
224
224
}
225
225
@@ -244,10 +244,10 @@ func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capab
244
244
245
245
// create new capability with the current global index
246
246
index := types .IndexFromKey (store .Get (types .KeyIndex ))
247
- cap := types .NewCapability (index )
247
+ capability := types .NewCapability (index )
248
248
249
249
// update capability owner set
250
- if err := sk .addOwner (ctx , cap , name ); err != nil {
250
+ if err := sk .addOwner (ctx , capability , name ); err != nil {
251
251
return nil , err
252
252
}
253
253
@@ -258,7 +258,7 @@ func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capab
258
258
259
259
// Set the forward mapping between the module and capability tuple and the
260
260
// capability name in the memKVStore
261
- memStore .Set (types .FwdCapabilityKey (sk .module , cap ), []byte (name ))
261
+ memStore .Set (types .FwdCapabilityKey (sk .module , capability ), []byte (name ))
262
262
263
263
// Set the reverse mapping between the module and capability name and the
264
264
// index in the in-memory store. Since marshalling and unmarshalling into a store
@@ -267,11 +267,11 @@ func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capab
267
267
memStore .Set (types .RevCapabilityKey (sk .module , name ), sdk .Uint64ToBigEndian (index ))
268
268
269
269
// Set the mapping from index from index to in-memory capability in the go map
270
- sk .capMap [index ] = cap
270
+ sk .capMap [index ] = capability
271
271
272
272
logger (ctx ).Info ("created new capability" , "module" , sk .module , "name" , name )
273
273
274
- return cap , nil
274
+ return capability , nil
275
275
}
276
276
277
277
// AuthenticateCapability attempts to authenticate a given capability and name
@@ -389,12 +389,12 @@ func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capab
389
389
return nil , false
390
390
}
391
391
392
- cap := sk .capMap [index ]
393
- if cap == nil {
392
+ capability := sk .capMap [index ]
393
+ if capability == nil {
394
394
panic (errors .New ("capability found in memstore is missing from map" ))
395
395
}
396
396
397
- return cap , true
397
+ return capability , true
398
398
}
399
399
400
400
// GetCapabilityName allows a module to retrieve the name under which it stored a given
@@ -414,13 +414,13 @@ func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.Capabilit
414
414
if strings .TrimSpace (name ) == "" {
415
415
return nil , false
416
416
}
417
- cap , ok := sk .GetCapability (ctx , name )
417
+ capability , ok := sk .GetCapability (ctx , name )
418
418
if ! ok {
419
419
return nil , false
420
420
}
421
421
422
422
prefixStore := prefix .NewStore (ctx .KVStore (sk .storeKey ), types .KeyPrefixIndexCapability )
423
- indexKey := types .IndexToKey (cap .GetIndex ())
423
+ indexKey := types .IndexToKey (capability .GetIndex ())
424
424
425
425
var capOwners types.CapabilityOwners
426
426
@@ -442,7 +442,7 @@ func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *t
442
442
if strings .TrimSpace (name ) == "" {
443
443
return nil , nil , errorsmod .Wrap (types .ErrInvalidCapabilityName , "cannot lookup modules with empty capability name" )
444
444
}
445
- cap , ok := sk .GetCapability (ctx , name )
445
+ capability , ok := sk .GetCapability (ctx , name )
446
446
if ! ok {
447
447
return nil , nil , errorsmod .Wrap (types .ErrCapabilityNotFound , name )
448
448
}
@@ -457,7 +457,7 @@ func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *t
457
457
mods [i ] = co .Module
458
458
}
459
459
460
- return mods , cap , nil
460
+ return mods , capability , nil
461
461
}
462
462
463
463
func (sk ScopedKeeper ) addOwner (ctx sdk.Context , cap * types.Capability , name string ) error {
0 commit comments