Skip to content

Conversation

dmitry-timofeev
Copy link
Contributor

Overview

Empty string caused panic in the native code,
and, subsequently, failed request processing.
Made #info return an empty object, though, one might
argue it will be more difficult to understand
why transactions returns nothing. That, however,
is to be addressed after Dynamic Services.


See: https://jira.bf.local/browse/ECR-3193

Definition of Done

  • There are no TODOs left in the code
  • Change is covered by automated tests
  • The coding guidelines are followed
  • Public API has Javadoc
  • Method preconditions are checked and documented in the Javadoc of the method
  • Changelog is updated if needed (in case of notable or breaking changes)
  • The continuous integration build passes

Empty string caused panic in the native code,
and, subsequently, a lost request. Made #info
return an empty object, though, one might
argue it will be more difficult to understand
why `transactions` returns nothing. That, however,
is to be addressed *after* Dynamic Services.
@dmitry-timofeev dmitry-timofeev merged commit 0a4a445 into exonum:master May 24, 2019
@dmitry-timofeev dmitry-timofeev deleted the fix-default-tx-info-ECR-3193 branch May 24, 2019 09:36
@vnermolaev
Copy link

Pardon me, but why not return the actual status of the transaction instead of an empty object?

  1. this would be aligned with the behaviour exhibited by similar services written in Rust
  2. JS light client inherently expects some status in Transaction.send method (which polls blockchain until status of the tx changes to committed)

For example, the front end for the cryptocurrency Java service uses Transaction.send

return transaction.send(TRANSACTION_URL, data, keyPair.secretKey)

This method will fail if the info method is not overridden as such

https://github.com/exonum/exonum-java-binding/blob/master/exonum-java-binding/cryptocurrency-demo/src/main/java/com/exonum/binding/cryptocurrency/transactions/CreateWalletTx.java#L83

@dmitry-timofeev
Copy link
Contributor Author

I am not sure I understand — you will get everything you see here:

in the response, i.e.:

{
  "type": "committed",
  "content": {
    "comment": "That's our default Transaction#info below, everything else is intact:",
    "debug": {}, 
    "message": "41c453a7f45cb0dd73644aa376d3802bb7da4c6797bcf6749211fbcabb5aa8710000800000000a220a20ae740320999e335dd4f5fdc0468f34eb46544aa1995b6cacfcedc82428bd71dd100a1896f7fda8bf8c8af71cfccd80d4c0d5d6f82955cf7c081969282604d3f7e416274a4319484ceea947981b8d337bd170210acd62508f3663acba395bd131456c0b6cd7f09690aec68a05"
  },
  "location": {
    "block_height": 11,
    "position_in_block": 0
  },
  "location_proof": {
    "val": "2f23541b10b258dfc80693ed1bf6ed6f53ccf8908047f7d33e0fec4f29a4a613"
  },
  "status": {
    "type": "success"
  }
}

The thing that Transaction#info returns is put in an extra field content.debug. It isn't even included in TransactionResponse in Java light client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants