-
Notifications
You must be signed in to change notification settings - Fork 246
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
extended CompilationFailed error(s) #2464
Conversation
crates/rpc/src/error.rs
Outdated
@@ -202,7 +202,9 @@ impl ApplicationError { | |||
ApplicationError::InsufficientResourcesForValidate => None, | |||
ApplicationError::InsufficientAccountBalance => None, | |||
ApplicationError::ValidationFailure => None, | |||
ApplicationError::CompilationFailed => None, | |||
ApplicationError::CompilationFailed { data } => Some(json!({ | |||
"data": data, |
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.
I think this "data":
is redundant here. The JSON value returned by the .data()
method is already wrapped in "data":
in the JSON-RPC result.
And I'm not actually sure this is compliant with the specification: COMPILATION_FAILED
doesn't have its data
specified in the OpenRPC specification.
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.
Ah, OK, so this will eventually be valid after this PR is merged into the 0.8 specification. Then we should maybe make this change only for the 0.8 JSON-RPC API so that we don't break JSON-RPC 0.7?
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.
I think this
"data":
is redundant here. The JSON value returned by the.data()
method is already wrapped in"data":
in the JSON-RPC result.
Well yes, but this is implementing the .data()
method... Anyway, I just went by analogy with the other cases having data (i.e. GatewayError
and TransactionExecutionError
)...
Also, json!({ data })
doesn't compile - "missing tokens in macro arguments"... Or do you mean serde_json::Value::String(data.to_string())
?
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.
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.
I think this
"data":
is redundant here. The JSON value returned by the.data()
method is already wrapped in"data":
in the JSON-RPC result.Well yes, but this is implementing the
.data()
method... Anyway, I just went by analogy with the other cases having data (i.e.GatewayError
andTransactionExecutionError
)...Also,
json!({ data })
doesn't compile - "missing tokens in macro arguments"... Or do you meanserde_json::Value::String(data.to_string())
?
Yes, I meant json!(data)
.
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.
OK
crates/rpc/src/error.rs
Outdated
RpcVersion::V08 => Some(json!({ | ||
"data": data, | ||
})), | ||
_ => None, |
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.
BTW: considering the introduction of the next JSON-RPC version (if ever) I think we should special-case the V07
variant instead and default to including data. That way we'd automatically get the data for the next version.
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.
OK
23a43c2
to
26b2395
Compare
Returning Starknet compilation failure error message.
Fixes #2462 .