-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix: optimist resync over a bad block, tidy docker-compose yml #870
Conversation
4734ece
to
f580aca
Compare
I took a look and found that when the challenge is signed, there is a revert
Sibling path is fixed by #894, but there seems to be new problems now with websockets that prevent new blocks from being proposed.
|
Adversary issues are fixed in latest master so this PR should be good to go now. |
All the code looks good. Something to clarify, because an optimist will produce a challenge commit when it sees a bad block, if multiple challengers are connected to the same optimist, all of them will receive this transaction. At this point, if all of them submit the transaction, the first mined transaction becomes the valid one. The rest lose gas. This is something that is bound to happen if each of them used different optimists anyway but in the case of the same optimist it will happen every time. Assuming this, the best recommendation would be for challenger to run their own optimist as opposed to sharing one ? |
Yes, this is true. Nothing in this PR has changed that though; it's always been the case. The first challenger to post a successful challenge is the winner. Sharing an optimist if you are a challenger is indeed a bit silly because you want to have a faster optimist than anyone else (and also be luckier than anyone else because you can't control when your optimist will see the bad transaction). Challengers sharing an Optimist would be a bit like trying to win a Grand Prix with all of us in the same car! |
fixes #844
fixes #862
This PR fixes the issue whereby, if Optimist resyncs when there is an un-challenged bad block, it will become stuck - unable to start making blocks because it knows there is a bad block but unable to challenge the bad block because its challenge function is switched off during re-sync. The challenge function is switched off so that it doesn't challenge already resolved bad blocks during sync and waste huge amounts of gas.
To fix this issue, we note that, previously, whenever optimist detects a challengeable block, either during re-sync or in normal operation, it pushes a dummy function into the stop queue. This correctly prevents optimist making blocks until the challenge is resolved, at which point the dummy function is removed from the queue and normal block-making resumes.
In this PR we no longer push a dummy function - we push the actual challenge commitment. If optimist is in normal operation, this has no effect - it's queued and dequeued just like the dummy function was (and not run); if however optimist is syncing, it will wait until synchronisation is complete and then run any challenge commitments that remain in the stop queue (because the re-sync did not resolve them and so they really are outstanding). This fixes the issue of a bad block.
This PR also:
nf3.startChallenger()
function return an event emitter for consistency withstartProposer()
. There's now no need to call a separate getter.rollback complete
event to that emitter (again used for testing but probably more generally useful).CommitToChallenge
event (received fromoptimist
via its websocket) with a reveal, rather than delegating the decision tooptimist
. This is much cleaner because the Challenger definitely knows its own address and can well make the response decision itself. Thusoptimist
will send all such events to all connected challengers rather than a specific one that has registered the correct address. As there should be very few such events, this is not a significant comms overhead.optimist
andclient
and dependent containers/volumes. These are not used and so are just a waste of resource. The remaining ones are renamed without the trailing ordinal (optimist1 -> optimist etc).setup-nightfall
script has been modified to build containers sequentially with individual build commands because otherwise the docker composebuild
command often fails.