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

☂️ Reorg resistance of Ethereum backend #19

Closed
17 tasks done
matthiasgeihs opened this issue Mar 10, 2021 · 3 comments
Closed
17 tasks done

☂️ Reorg resistance of Ethereum backend #19

matthiasgeihs opened this issue Mar 10, 2021 · 3 comments
Assignees
Labels
umbrella Umbrella issue
Projects
Milestone

Comments

@matthiasgeihs
Copy link
Contributor

matthiasgeihs commented Mar 10, 2021

The Ethereum backend is currently build on the assumption that a transaction cannot be reverted. While this may be true for local testnets, it is not true for public testnets and the Ethereum mainnet, where block reorgs can happen.

We should make the Ethereum backend work with Ethereum nets where reorgs appear. An idea how to implement this is as follows: We introduce a parameter ConfirmationBlockDepth. Whenever go-perun accesses on-chain state, we only provide on-chain state if it is at least ConfirmationBlockDepth blocks old.

The following appear to be relevant places in the code where on-chain state is accessed:

  • Contract validation: ValidateAdjudicator, ValidateAssetHolder
  • Event subscription: Watch, Filter
  • Contract deployment: WaitDeployed
  • Transaction confirmation: ConfirmTransaction

Added by @ggwpez:
The current road map for this issue looks like this:

@matthiasgeihs matthiasgeihs added the enhancement Improvement of an existing feature label Mar 10, 2021
@ggwpez
Copy link
Contributor

ggwpez commented Mar 16, 2021

Biggest point missing: How to test this.
Currently we use the simulated block chain from go-ethereum. Im evaluating if it can do reorgs here.

@ggwpez
Copy link
Contributor

ggwpez commented Mar 31, 2021

After adding a Reorg(depth) function to go-ethereum, i was able to get a legit reorg on the simulated backend.
It removed the previous events with a removed: true event.
It does seem, however, that the TX do not end up in the mempool again, and therefore needs to be resent by the user.
Im not sure if this is normal behaviour in a geth node or an incapability of the simulated chain.

Looking at chainlink, they periodically pull the mempool status to check that the TX is still in and resend if not.
We therefore probably need something similar to their BPTM (bullet proof TX manager).

This was referenced Apr 6, 2021
@ggwpez ggwpez added umbrella Umbrella issue and removed enhancement Improvement of an existing feature labels Apr 8, 2021
@matthiasgeihs matthiasgeihs added this to To do in Priority May 17, 2021
@ggwpez ggwpez modified the milestone: Mainnet Jun 7, 2021
@matthiasgeihs matthiasgeihs added this to the Mainnet milestone Aug 24, 2021
@matthiasgeihs matthiasgeihs changed the title Reorg resistance of Ethereum backend ☂️ Reorg resistance of Ethereum backend Oct 14, 2021
@matthiasgeihs
Copy link
Contributor Author

All done

@matthiasgeihs matthiasgeihs moved this from To do to Done in Priority Dec 3, 2021
cryptphil added a commit to perun-network/go-perun that referenced this issue Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella Umbrella issue
Projects
Development

No branches or pull requests

2 participants