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

Avoid double send for transactions when handle contract events #44

Open
akolotov opened this issue Apr 17, 2018 · 2 comments
Open

Avoid double send for transactions when handle contract events #44

akolotov opened this issue Apr 17, 2018 · 2 comments

Comments

@akolotov
Copy link
Contributor

Currently the bridge could send the same transactions several times if the database is not updated properly.

The following changes could be introduced:

  1. To handle Deposit() event and avoid invocation of deposit() several times for the same origin transaction:

For Foreign chain it is necessary to check that

depositsSigned(sha3(ValidatorAddress, sha3(HomeDepositSender, Value, HomeTransactionHash)))

returns false and invoke deposit() in this case only.


  1. To handle Withdraw() event on the Foreign side and avoid invocation of submitSignature() several times for the same 'message'

For Foreign chain it is necessary to check that

messagesSigned(sha3(ValidatorAddress, sha3(message)))

returns false and invoke submitSignature() in this case only.


  1. To handle CollectedSignatures() event on the Foreign side and avoid invocation of withdraw() several times for the the same origin transaction

For Home chain it is necessary to check that

withdraws(ForeignTransactionHash)

returns false and invoke withdraw() in this case only.

@rstormsf
Copy link
Contributor

rstormsf commented Apr 30, 2018

very good explanation
one more stategy to this is to run estimateGas it should succeed

@akolotov
Copy link
Contributor Author

my expectation is that estimateGas will require more time to check tx. But it needs to be measured first of course.

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

No branches or pull requests

2 participants