-
Notifications
You must be signed in to change notification settings - Fork 72
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
feat(node): expose endpointParameters to all pre/post-processing steps #1831
Conversation
The description looks good, I'll review as soon as possible |
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.
Requested some minor changes, didn't test it yet
// provide endpoint parameters immutably | ||
let endpointParameters = JSON.parse(JSON.stringify(payload.aggregatedApiCall.parameters)); | ||
|
||
// The HTTP gateway is a special case for ChainAPI that is not allowed to access reserved parameters |
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.
Sorry, I remember writing about this but I couldn't find where, but it may have been vague.
- We want both pre-processing and post-processing to not have access to the reserved parameters (this seems to only do it for post-processing)
- This should apply to all cases, and not only calls coming through the gateway. The reasoning is that breaking some old endpoints that use reserved parameters in processing (which to my knowledge don't exist) is preferable to endpoints potentially behaving differently when used in different ways.
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 want both pre-processing and post-processing to not have access to the reserved parameters
OK, I've removed access to reserved parameters from pre- and post-processing.
This should apply to all cases, and not only calls coming through the gateway.
The title and description of #1738 was specific for the gateway (because of ChainAPI test calls) and so that is what I addressed in #1794. But easy enough and makes sense. I've made the change.
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.
Right, I now realize that that is about an older PR. @andreogle for visibility I guess 😅 The fix looks good, thanks.
- make endpointParameters immutable between processing steps - remove access to reserved parameters from pre/post-processing regardless of API call 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.
Closes #1673.
I implemented this by passing
endpointParameters
to the VM context inunsafeEvaluate
andunsafeEvaluateAsync
for both pre- and post-processing. This allows the endpointParameters to be immutable with respect to theparameters
of theaggregatedApiCall
(more relevant to pre-processing).Note to achieve the above immutability and to avoid breaking existing post-processing code, I did not modify the
input
(the raw API call response data) of thereduce
ofpostProcessingSpecifications
.