Skip to content
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

passing error from sendTx as response of send raw tx #218

Closed
wants to merge 4 commits into from

Conversation

eshavkun
Copy link
Contributor

fixes #207
sendRawTransaction now returns an object {hash, error} with error: 0 in case of success

@codecov
Copy link

codecov bot commented Mar 25, 2019

Codecov Report

Merging #218 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #218      +/-   ##
==========================================
+ Coverage   94.46%   94.47%   +0.01%     
==========================================
  Files          70       70              
  Lines        1030     1032       +2     
  Branches      193      193              
==========================================
+ Hits          973      975       +2     
  Misses         51       51              
  Partials        6        6
Impacted Files Coverage Δ
src/api/methods/checkSpendingCondition.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69cdbd7...8577aa4. Read the comment docs.

@johannbarbie
Copy link
Member

johannbarbie commented Mar 25, 2019

don't you break the compatibility with Ethereum RPC by changing the response? https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction

return [false, e.toString()];
let err = e.toString();
if (err === '[object Object]') {
err = JSON.stringify(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @johannbarbie . We should be smarter and add some error messages to the tx handlers. Also we don't know if that could be a security issue if we return the whole stringified object 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with you but I was not sure how to do batter
@johannbarbie Do you think it's better just to send error instead of tx hash in case there is an error?
@pinkiebell The only other way I see it is to find out why vmerror is not thrown as proper exception and fix it there

Copy link
Member

@johannbarbie johannbarbie Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's better just to send error instead of tx hash in case there is an error?

yes, the user knows the txHash anyways .

What he really cares about is the moment when the tx is included.

i think the way it works in ethereum is 2 steps:

  1. from sendRawTransaction() you get a txHash back
  2. with the txHash you use getTransactionReceipt() to wait for the block to be mined

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt

i think we should follow the API, and start thinking about receipts, but outside of this bounty.

Copy link
Contributor Author

@eshavkun eshavkun Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the user knows the txHash anyways

ok, fixed that
and agree, it would be great if we can get error by calling getTransactionReceipt

tx ash in case of success or error in case of an error
Copy link
Member

@troggy troggy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. please add unit tests
  2. do not commit lotion/package.json and lotion/yarn.lock — these aren't needed

@troggy
Copy link
Member

troggy commented Apr 19, 2019

this is not compatible with changes introduced in #241

@troggy
Copy link
Member

troggy commented Sep 16, 2019

this issue is now included in a next Dev Circle project ("Duct Tape")

@eshavkun are you up to finish this PR ?

@eshavkun eshavkun closed this Nov 23, 2019
@eshavkun eshavkun deleted the txResult branch November 23, 2019 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

return errors when invalid transaction submitted
4 participants