Skip to content

Commit

Permalink
fix: Use fixed length hex for pointer at FwdCapabilityKey (#11737)
Browse files Browse the repository at this point in the history
Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
facundomedica and tac0turtle committed Apr 25, 2022
1 parent a8b3602 commit dc98d7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x/capability/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func RevCapabilityKey(module, name string) []byte {
// FwdCapabilityKey returns a forward lookup key for a given module and capability
// reference.
func FwdCapabilityKey(module string, cap *Capability) []byte {
return []byte(fmt.Sprintf("%s/fwd/%p", module, cap))
return []byte(fmt.Sprintf("%s/fwd/%#016p", module, cap))
}

// IndexToKey returns bytes to be used as a key for a given capability index.
Expand Down
2 changes: 1 addition & 1 deletion x/capability/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestRevCapabilityKey(t *testing.T) {

func TestFwdCapabilityKey(t *testing.T) {
cap := types.NewCapability(23)
expected := []byte(fmt.Sprintf("bank/fwd/%p", cap))
expected := []byte(fmt.Sprintf("bank/fwd/%#016p", cap))
require.Equal(t, expected, types.FwdCapabilityKey("bank", cap))
}

Expand Down

0 comments on commit dc98d7b

Please sign in to comment.