fix(fault-proof): evict expired challenged games and guard proving with gameOver()#849
Open
fakedev9999 wants to merge 7 commits into
Open
fix(fault-proof): evict expired challenged games and guard proving with gameOver()#849fakedev9999 wants to merge 7 commits into
fakedev9999 wants to merge 7 commits into
Conversation
The proposer wastes prover-network gas by generating proofs for games that are already over (expired or already proven by someone else). The on-chain prove() call reverts with GameOver() in both cases. Add gameOver() checks in two places: - should_skip_proving(): before starting proof generation, to avoid wasting compute on games that are already over - prove_game(): after proof generation completes but before submitting the on-chain tx, to catch games that expired during the minutes-to- hours proof generation window Addresses succinctlabs/cloud-ops#75 References celo-org#91
Contributor
|
- Move gameOver() RPC call after the local deadline check in should_skip_proving() — avoids unnecessary RPC for games already caught by the cheaper cached-deadline check - Add tracing::warn before bail in prove_game() so operators can see when hours of proof work are discarded - Update doc comment to reflect new check order
Don't discard hours of proof work on a transient RPC hiccup. If the gameOver() call fails, proceed with submission — the on-chain prove() will revert if the game is truly over (cheap gas vs. wasted proof).
Games that are Challenged + expired (deadline < now) are guaranteed to resolve as CHALLENGER_WINS. This cascades to all descendants via the contract's resolve() logic (parent CHALLENGER_WINS → child CHALLENGER_WINS). Without eviction, these dead games stay IN_PROGRESS in cache forever (nobody calls resolve), causing the proposer to repeatedly attempt proving → revert → retry. RemoveSubtree is safe because: - Challenged + expired = CHALLENGER_WINS regardless of parent state - All descendants also guaranteed CHALLENGER_WINS (parent cascade) - sync_games reads fresh on-chain claim_data, so if a prove() tx landed, status would be ChallengedAndValidProofProvided (not evicted)
Align test expectations with the new RemoveSubtree behavior for Challenged + expired games: - test_mixed_states_multiple_branches: first sync now evicts games 3+4 immediately (previously required a second sync after on-chain resolution). Added a stability check confirming a second sync after on-chain resolution is a no-op. - test_in_progress_proposal_status_multi_branch: game 1 (Challenged + expired) is now evicted during sync. Assert absence instead of inspecting stale cache entry. Challenged status coverage for should_attempt_to_resolve is already in test_in_progress_games_resolution_marking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two-layer fix for proposer wasting prover-network gas on dead games (games that are
Challenged + expiredand will always resolve asCHALLENGER_WINS).Layer 1: Evict dead games from cache (root fix)
In
sync_gamesstep 2,Challenged + expiredgames are evicted viaRemoveSubtree. This is safe because:Challenged + expired= guaranteedCHALLENGER_WINSon resolve (contract line 456-459)CHALLENGER_WINScascades to ALL descendants (contract line 442-446) — descendants can never beDEFENDER_WINSsync_gamesreads fresh on-chainclaim_data— if aprove()tx landed, status would beChallengedAndValidProofProvided, notChallengedWithout this, dead games stay
IN_PROGRESSforever if nobody callsresolve(), causing infinite prove → revert → retry loops.Layer 2:
gameOver()guards (transient protection)Covers the window between sync cycles:
should_skip_proving(): on-chaingameOver()check after cheaper deadline check, before proof generationprove_game(): best-effortgameOver()check after proof generation, before tx submission. Tolerates transient RPC failure to avoid discarding expensive proofs.Addresses succinctlabs/cloud-ops#75
References celo-org/op-succinct#91
Test plan
cargo check -p op-succinct-fpcargo test -p op-succinct-fp --lib— 46/46 passcargo fmt/cargo clippyclean