-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(08-wasm/test): register mockVm querier callbacks against TimestampAtHeightMsg to avoid recursive loops #5878
Conversation
…o avoid recursive loops
clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()) | ||
|
||
// NOTE: we register query callbacks against: types.TimestampAtHeightMsg{} | ||
// in practise, this can against any client state msg, however registering against types.StatusMsg{} introduces recursive loops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to Status
being used in the VerifyMembership
grpc implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to protect against this somehow? Or are avoiding recursive loops up to contract developers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to Status being used in the VerifyMembership grpc implementation?
Yes, exactly!
do we need to protect against this somehow? Or are avoiding recursive loops up to contract developers?
I feel like there is only a certain amount we can do to protect against this tbh. Any wasm client devs should be testing their code before anything like this can ever happen. I think it should be extremely rare to occur. The recursive loop scenario here imo is more due to how we use the mockVM and the fact that we are making callback into the same client state which has invoked the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift fix 💪, these tests can get spaghetti-ish at certain points.
we also need to bp this, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, quick fix!
clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()) | ||
|
||
// NOTE: we register query callbacks against: types.TimestampAtHeightMsg{} | ||
// in practise, this can against any client state msg, however registering against types.StatusMsg{} introduces recursive loops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to protect against this somehow? Or are avoiding recursive loops up to contract developers?
should |
Yeah, its down to the implementation of the contract right? and which one its calling. But specifying its own clientID seems like something that shouldn't ever need to happen - we can probably add a defensive check here. Happy to chat about this in eng call next week. |
Description
Register querier callbacks in mockVM against
TimestampAtHeightMsg
instead ofStatusMsg
.This avoids recursive loops introduced by yours truly in #5870, adding the client status check to the rpc handler of
VerifyMembership
.If anyone would rather a different approach to fixing this issue, we could additional create an entirely separate test func for
success: verify membership query
and only useTimestampAtHeightMsg
for that one, but it makes no difference to me.Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.