Skip to content

Conversation

@manoranjith
Copy link

@manoranjith manoranjith commented Jul 2, 2021

Fix is attempted using approach 1 suggested in #62.

@manoranjith manoranjith force-pushed the 62-fix-tx-nonce-mismatch-error-1 branch from 532632c to 889ef0d Compare July 2, 2021 13:22
@matthiasgeihs
Copy link
Contributor

LGTM, but there is a typo in your sign off.

@manoranjith manoranjith force-pushed the 62-fix-tx-nonce-mismatch-error-1 branch from 889ef0d to e086a22 Compare July 2, 2021 13:44
@manoranjith
Copy link
Author

Fixed the signed-off message.


nonce, err := c.PendingNonceAt(ctx, acc.Address)
if err != nil {
return nil, errors.Wrap(err, "fetching nonce")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you have to check for IsChainNotReachableError here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Author

Choose a reason for hiding this comment

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

@matthiasgeihs Because, we explicitly inform the user by returning a named error when there are problems connecting with the blockchain node.

@ggwpez I have fixed this now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. It seems a bit unclean that we introduce such specific error handling logic in so many places. We could add wrappers for the handful of functions that need this handling and then consistently use the wrappers, right? It's ok here, but it's something worth discussing in general, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes the initial approach calls the error wrapping on the lowest level, where we also could have done it on the highest…
Its much more effort like this i think.

@manoranjith manoranjith force-pushed the 62-fix-tx-nonce-mismatch-error-1 branch from e086a22 to a508719 Compare July 5, 2021 07:22
- Previously, ERC20 deposit transactions would not work when using
  ganache-cli node. Because ERC20 deposit involved two txs and both txs
  got the same nonce.

- Now, track the nonce in contract backend for each account and use it
  to ensure no two transactions get the same nonce.

Resolves hyperledger-labs#62.

Signed-off-by: Manoranjith <ponraj.manoranjitha@in.bosch.com>
@manoranjith manoranjith force-pushed the 62-fix-tx-nonce-mismatch-error-1 branch from a508719 to 402b9e5 Compare July 5, 2021 07:27
@manoranjith manoranjith requested a review from ggwpez July 5, 2021 07:28
@ggwpez ggwpez merged commit 867f6ee into hyperledger-labs:dev Jul 5, 2021
@ggwpez ggwpez mentioned this pull request Nov 1, 2021
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.

3 participants