Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Enable mocking contracts #1331
Enable mocking contracts #1331
Changes from 7 commits
7c84bc1
5123152
66b2a84
2526857
b994e94
6563469
c59df2e
d66d7cc
ffdfe5d
b9399af
b09a677
e36da54
e82d6b3
5ec45b4
e8a5204
3690ee0
5ed54ea
ba0817c
a6a9be7
d479b9e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Maybe we can move the details of intercept_call to the trait implementation, so we don't leak the struct that could then be internal to the implementation.
We could move that behind a feature-flag like this
or maybe simply
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.
we have removed the feature flag, haven't we?
what if we return just
Result<(), ExecResult>
instead of the current new enum type? same semantics, no new typesThere 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.
Or
Option<ExecResult>
which is less confusing to the implementor of the trait but would require a bit more work here to handle it properly.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.
We can always re-introduce it. For tracing we needed to have basic traces regardless of the environment, so we could get away without introducing a feature flag. Intercepting calls seems more like a dev only feature, so I think it could make sense to have that gated behind a feature flag.
Moving it all behind a
T::Debug::wrap_execute
that would just call the actual code with the default()
Debug trait might be good alternative as well. @athei any thought on this?I think that's what I am suggesting with the code snippet above.
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.
That's not how we saw it. You suggested (assuming it's the 2nd snippet):
which looked like the
wrap_execute
should also callexecute
?I think we can leave the
T::Debug::intercept_call
as-is but change the return type.if we agree to the general idea I think we can pin down the details (method name and return type).
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.
Yes right
So you would do something like
Yes I guess we can start with this
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.
Yes. Or slightly more cleanly IMHO
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.
so all in all I've removed the new
CallInterceptorResult
enum in favor ofOption
... does it meet the consensus above?