forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 10
chore: add prune e2e test back #477
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
605613f
Impl ValueWithSubKey for VersionedValue
emhane 707d022
Revert changes to runners
emhane 7999191
Merge branch 'emhane/revert-ci-runners' into emhane/fix-missing-subke…
emhane cb80fe9
Merge branch 'unstable' into emhane/fix-missing-subkey-impl
dhyaniarun1993 f3e5a9b
chore: add prune e2e back
dhyaniarun1993 fc1c8bd
fix code
dhyaniarun1993 986c6f9
Merge remote-tracking branch 'origin/emhane/fix-missing-subkey-impl' …
dhyaniarun1993 1fdd712
added missing changes
dhyaniarun1993 8c7d628
Update crates/optimism/tests/proofs/prune/prune_test.go
dhyaniarun1993 87f01b9
Apply suggestions from code review
dhyaniarun1993 1020755
Fix add missing ValueWithSubkey impl for VersionedValue
emhane 1003ba8
Merge branch 'emhane/fix-missing-subkey-impl' into arun/chore/add-pru…
emhane e0bb9ba
Merge branch 'unstable' into arun/chore/add-prune-e2e
emhane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package prune | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-devstack/presets" | ||
| ) | ||
|
|
||
| // TestMain creates the test-setups against the shared backend | ||
| func TestMain(m *testing.M) { | ||
| // Other setups may be added here, hydrated from the same orchestrator | ||
| presets.DoMain(m, presets.WithSingleChainMultiNode()) | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| package prune | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-devstack/devtest" | ||
| "github.com/ethereum-optimism/optimism/op-devstack/presets" | ||
| "github.com/ethereum-optimism/optimism/op-service/apis" | ||
| "github.com/op-rs/op-geth/proofs/utils" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestPruneProofStorage(gt *testing.T) { | ||
| t := devtest.SerialT(gt) | ||
| sys := presets.NewSingleChainMultiNode(t) | ||
|
|
||
| var proofWindow = uint64(200) // Defined in the devnet yaml | ||
| var pruneDetectTimeout = time.Minute * 5 // An expected time within the prune should be detected. | ||
| opRethELNode, _ := utils.IdentifyELNodes(sys.L2EL, sys.L2ELB) | ||
|
|
||
| syncStatus := getProofSyncStatus(t, opRethELNode.Escape().EthClient()) | ||
| t.Log("Initial sync status:", syncStatus) | ||
| distance := syncStatus.Latest - syncStatus.Earliest | ||
|
|
||
| if distance < proofWindow { | ||
| // Wait till we reach proof window | ||
| t.Logf("Waiting for block %d", syncStatus.Earliest+proofWindow) | ||
| opRethELNode.WaitForBlockNumber(syncStatus.Earliest + proofWindow) | ||
| } | ||
| // Now we need to wait for pruner to execute pruning, which can be done anytime within 1 minute (pruner prune interval = 1 min) | ||
| startTime := time.Now() | ||
| var newSyncStatus proofSyncStatus | ||
| for { | ||
| // Get sync status each Second | ||
| if time.Since(startTime) > pruneDetectTimeout { | ||
| t.Error("Pruner did not prune proof storage within the interval") | ||
| return | ||
| } | ||
| newSyncStatus = getProofSyncStatus(t, opRethELNode.Escape().EthClient()) | ||
| if syncStatus.Earliest != newSyncStatus.Earliest { | ||
| break | ||
| } | ||
| t.Log("Waiting on earliest state to be changed: ", syncStatus.Earliest) | ||
| time.Sleep(time.Second * 5) | ||
| } | ||
| // Check how many has been pruned - we should have current proof window intake | ||
| currentProofWindow := newSyncStatus.Latest - newSyncStatus.Earliest | ||
| t.Log("Sync status:", syncStatus) | ||
| require.GreaterOrEqual(t, currentProofWindow, proofWindow, "Pruner has changed the proof window") | ||
| t.Logf("Successfully pruned proof storage. sync status: %v", syncStatus) | ||
| } | ||
|
|
||
| type proofSyncStatus struct { | ||
| Earliest uint64 `json:"earliest"` | ||
| Latest uint64 `json:"latest"` | ||
| } | ||
|
|
||
| func getProofSyncStatus(t devtest.T, client apis.EthClient) proofSyncStatus { | ||
| var result proofSyncStatus | ||
| err := client.RPC().CallContext(t.Ctx(), &result, "debug_proofsSyncStatus") | ||
| if err != nil { | ||
| t.Error(err) | ||
| } | ||
| return result | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.