pokt-network / pocket-core

Official implementation of the Pocket Network Protocol
http://www.pokt.network
MIT License
208 stars 101 forks source link

Infinite recursion #1578

Closed cristaloleg closed 6 months ago

cristaloleg commented 10 months ago

Describe the bug I was occasionally reading your repository and had found infinite recursion.

To Reproduce

See x/pocketcore/types/session.go

func (s Session) HashString() string {
    return s.HashString() // <-- calls itself again
}

Expected behavior No infinite recursion

Screenshots Not applicable.

Operating System or Platform: Any

Additional context None.

Olshansk commented 10 months ago

Pretty sure we don't use this anywhere but ccing @msmania for visibility.

msmania commented 10 months ago

Good catch!

This function is needed for Session to implement CacheStorage, but luckily it's never called because we don't seal a cached session, which is the only place we use CacheStorage.HashString. The correct return value should be s.SessionHeader.HashString(). Let's fix it in the next version.

msmania commented 6 months ago

Closing this as this was fixed.