You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modules/core/keeper: NewKeeper blank value detection assumes interface values are all non-pointer receivers and will fail to detect blank pointer receivers
#2268
Closed
1 of 3 tasks
odeke-em opened this issue
Sep 10, 2022
· 4 comments
· Fixed by #2403
checks if values are Zero values using reflect.ValueOf. That'll work in cases where value receivers are passed in. However, for a general purpose package that receives either pointer or value receivers, this forces odd behavior in which only value receivers can be checked. For example if we examine https://go.dev/play/p/zfFZRDjqz-X or inlined below
Maybe I am missing something, but the stakingKeeper and upgradeKeeper parameters need to be passed by value (as the signature of NewKeeper indicates), so if in the upstream caller function they were pointers, they would need to be dereferenced before being passed to NewKeeper, right?
@crodriguezvega it expects values that conform to an interface. Anything that conforms to that interface can be passed in and they could either be pointers or non-pointers.
@crodriguezvega it expects values that conform to an interface. Anything that conforms to that interface can be passed in and they could either be pointers or non-pointers.
Summary of Bug
The code inside
ibc-go/modules/core/keeper/keeper.go
Lines 52 to 60 in a4be561
Which prints out
But really if zero value checking were implemented correctly by dereferencing pointers, every line should print true.
Expected Behaviour
Catching blank pointer values
Just an FYI for my colleagues @elias-orijtech @kirbyquerby @willpoint
For Admin Use
The text was updated successfully, but these errors were encountered: