-
Notifications
You must be signed in to change notification settings - Fork 119
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
Contract execution should return the validated request instead of the input request #643
Comments
I believe the change would be simple, and occur here: https://github.com/accordproject/ergo/blob/881ceb5d1471f98554639cd03a631fd1a6ebfb32/packages/ergo-engine/lib/engine.js#L136 |
@mttrbrts @dselman @martinhalford would love some user-level feedback on this. |
I can't see an issue with this. The interaction model is a synchronous request/response and the client will always have the original request instance. Are there any instances where values from the input could be changed by validation, or is validation always additive? |
That is a really interesting question... Besides default values... all I can think of:
So depending on how you think of additive, it's not entirely additive. |
Interestingly, there isn't an easy way for the application to get the validated request (would currently need a separate call to the validator). |
This hasn't (so far) been an issue for us. However, if the request object is modified by the validator then I'd certainly like to see what was actually processed by Cicero. I can imagine some scenarios where an obscure bug might be obfuscated if the contract template developer is looking at the stale request object and not realising this might be different to what Cicero executed. Thoughts? |
@jeromesimeon can you clarify, is the validated output request object actually the same as the input to the engine? I.e. validation happens before and after execution? For example, to @martinhalford's question, this is a concern, and area for weird bugs, but it's no different than what we have already on the input side. |
Are we open to any solutions for this? I feel that sending the request object is relevant and would make sense as mentioned before by @jeromesimeon! |
Hey!! I'm a new member of this wonderful community, I would like to work on this issue if it's still open or any beginner-friendly issue you guys can suggest. |
This is the output of the request before validation.
This is the output of the verified request after validation.
In which format do I display the validated response? The validateInput function returns the above format of the validated request. Thank You |
Fixed in #731 |
Description
Currently, Cicero contract execution returns the input request rather than the request after validation. This means we do not have default values, identifiers, or timestamps. This is inconsistent with what we do on responses, so looks a little odd:
[Notice:
response
has a$timestamp
butrequest
does not]It might be preferable to return the validated request. What do people think?
The text was updated successfully, but these errors were encountered: