-
Notifications
You must be signed in to change notification settings - Fork 30
Update LC with DS changes [ECR-3860] #1244
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
Conversation
ERROR, | ||
@SerializedName("panic") | ||
PANIC | ||
ERROR |
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 doesn't look like a complete definition of possible errors:
If I understand correctly, they are serialized using this enum:
https://github.com/exonum/exonum/blob/86379cdee673dfda94b6b1e23ddedb5d512664a7/exonum/src/runtime/error.rs#L378-L384
and this mapping
https://github.com/exonum/exonum/blob/86379cdee673dfda94b6b1e23ddedb5d512664a7/exonum/src/runtime/error.rs#L386
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.
Support for this may be done in a separate PR — but in that case please document that in Jira properly.
return ExecutionStatuses.success(); | ||
case ERROR: | ||
return TransactionResult.error(executionStatus.getCode(), | ||
return ExecutionStatuses.serviceError(executionStatus.getCode(), |
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.
It is not complete — see below.
exonum-light-client/pom.xml
Outdated
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>${protobuf.version}</version> | ||
<scope>provided</scope> |
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.
Why this dependency is needed? Doesn't common bring it as a transitive?
It may be specified explicitly, but certainly not as provided
. If it isn't already available — please fix the common.
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.
It is explicitly marked as an optional dependency and is not passed on transitively - https://github.com/exonum/exonum-java-binding/blob/master/exonum-java-binding/common/pom.xml#L47
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.
Added a PR that makes protobuf dependency transitive - #1246
exonum-light-client/src/main/lombok/com/exonum/client/response/TransactionResponse.java
Show resolved
Hide resolved
import com.exonum.client.response.BlocksResponse; | ||
import com.exonum.client.response.TransactionResponse; | ||
import com.exonum.client.response.TransactionStatus; | ||
import com.exonum.core.messages.Runtime.ExecutionStatus; |
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.
how does it come here? Is it a part of exonum-java-binding-common
? I mean exonum.core.
package
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.
Is it a part of exonum-java-binding-common?
Yes, it is, but, ideally, it mustn't be a part of it, but a dependency of it. I think we shall extract the messages into a separate module (or modules, if we believe that some messages are not needed everywhere, e.g., supervisor messages, or merkledb messages) that will have not just have its own package, but its own release cadence (since the main reason for their release is a new Exonum release).
String errorDescription = "Unexpected error"; | ||
String json = "{\n" | ||
+ " 'type': 'committed',\n" | ||
+ " 'content': {\n" |
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 is no content.debug
in 0.13, please check the format in the core.
+ " 'status': {\n" | ||
+ " 'type': 'panic',\n" | ||
+ " 'description': \"" + errorDescription + "\"" | ||
+ " }\n" |
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.
This is the only variable thing in this and the following tests. It seems like the main and/or test code have to be refactored to not duplicate the rest needlesly. E.g.,
- A template JSON for testing various results + a source of (JSONs, expected execution status) + a parameterized test asserting on the expected status (and the constants, if needed).
- A modification of main code that allows to test the various results independently from the transaction response.
+ "}\n"; | ||
|
||
return Stream.of( | ||
Arguments.of(ExecutionStatuses.success(), successStatus), |
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.
Arguments.arguments(...) (statically-imported)
TransactionLocation location; | ||
JsonObject locationProof; //TODO: in scope of LC P3 | ||
GetTxResponseExecutionResult status; | ||
String time; |
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.
@dmitry-timofeev should we add this time
to the TransactionResponse
? If yes, I'll create a Jira task
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, I'd go with it. But if we don't add it here, please remove the String time
field — it won't affect the JSON parsing.
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.
Added - ECR-3942
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.
+ " 'block_height': " + BLOCK_HEIGHT + ",\n" | ||
+ " 'position_in_block': " + INDEX_IN_BLOCK + "\n" | ||
+ " },\n" | ||
+ " 'location_proof': {\n" |
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 took this location_proof
from some core tests. It looks weird, but we don't use it in any way, so as long as it's a valid json, we are good.
exonum-light-client/pom.xml
Outdated
<!-- Project dependencies --> | ||
<okhttp.version>4.2.2</okhttp.version> | ||
<lombok.version>1.18.10</lombok.version> | ||
<protobuf.version>3.10.0</protobuf.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.
Unused.
Overview
Update LC with DS changes.
See: https://jira.bf.local/browse/ECR-3860
Definition of Done