Update LC with DS changes [ECR-3860] - #1244
Conversation
| ERROR, | ||
| @SerializedName("panic") | ||
| PANIC | ||
| ERROR |
There was a problem hiding this comment.
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.
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.
It is not complete — see below.
| <groupId>com.google.protobuf</groupId> | ||
| <artifactId>protobuf-java</artifactId> | ||
| <version>${protobuf.version}</version> | ||
| <scope>provided</scope> |
There was a problem hiding this comment.
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.
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.
Added a PR that makes protobuf dependency transitive - #1246
| 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.
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.
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.
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.
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.
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.
@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.
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.
| + " 'block_height': " + BLOCK_HEIGHT + ",\n" | ||
| + " 'position_in_block': " + INDEX_IN_BLOCK + "\n" | ||
| + " },\n" | ||
| + " 'location_proof': {\n" |
There was a problem hiding this comment.
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.
| <!-- Project dependencies --> | ||
| <okhttp.version>4.2.2</okhttp.version> | ||
| <lombok.version>1.18.10</lombok.version> | ||
| <protobuf.version>3.10.0</protobuf.version> |

Overview
Update LC with DS changes.
See: https://jira.bf.local/browse/ECR-3860
Definition of Done