fix: Use fixed length hex for pointer at FwdCapabilityKey (#11737)

Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
Facundo Medica 2022-04-25 03:12:32 -03:00 committed by GitHub
parent a8b3602c23
commit dc98d7bf83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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.

View File

@ -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))
}