-
Notifications
You must be signed in to change notification settings - Fork 3.9k
refactor+fix(op-node/sequencing): l1 origin selection improvements #18589
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
38 commits
Select commit
Hold shift + click to select a range
543df5b
WIP
geoknee ea66bee
wip
geoknee dbaa3ab
WIP
geoknee 7333916
Treat NotFound next L1 origin as chain end
geoknee acc6c33
Use recover mode in sequence window expiry test
geoknee e1bfc22
Invoke fault proof earlier and fix typos
geoknee 0aa6adc
reduce diff
geoknee 9e95a84
Use requireL1OriginAt helper in test
geoknee 90abe3d
Introduce L2Sequencer.ActMaybeL2StartBlock
geoknee 16f5198
add TestRecoverModeWhenChainHealthy acceptance test
geoknee dd9492e
Add SetSequencerRecoverMode and enable debug logs
geoknee 418a985
Adjust L1 block time and sequence window test
geoknee 3b22b34
restore stub
geoknee 8b0f3d1
WIP
geoknee d7d1ffa
name errs
geoknee 1c08546
refactor
geoknee 7187af4
fix
geoknee b33328a
add test
geoknee d164cfc
Rename error constant and add L1 origin tests
geoknee 9fb3560
Use drift check for next L1 origin and update tests
geoknee 84e6db9
Refactor L1 origin selection and error handling
geoknee 3ca9243
fixes
geoknee 581028e
fixes
geoknee f90208e
lint
geoknee c361b5c
don't use pointers
geoknee 55d709b
handle retries without a "temporary error"
geoknee 69bf84d
use Fjord drift constant
geoknee 5e7e859
fix origin_selector_test
geoknee b04f62b
Simplify FindL1Origin
geoknee 08dd4d3
move new pure function into a method on los
geoknee 204f4a1
Update comment to refer to empty nextL1Origin
geoknee 057e394
Use errors.Is for L1 origin error checks
geoknee 099e1b3
Return L1 origin on validation errors
geoknee ce9fa62
Add expectedResult to origin selector tests
geoknee 389f2b6
Add assertion message and clarify origin comments
geoknee 4e76749
Store recoverMode and add comment period
geoknee fd8d7fa
Update op-node/rollup/sequencing/origin_selector.go
geoknee 420c249
Update op-node/rollup/sequencing/origin_selector.go
geoknee 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package sequencer | ||
|
|
||
| import ( | ||
| "log/slog" | ||
| "testing" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-devstack/compat" | ||
| "github.com/ethereum-optimism/optimism/op-devstack/presets" | ||
| ) | ||
|
|
||
| // TestMain creates the test-setups against the shared backend | ||
| func TestMain(m *testing.M) { | ||
| presets.DoMain(m, presets.WithMinimal(), | ||
| presets.WithCompatibleTypes(compat.SysGo), | ||
| presets.WithLogLevel(slog.LevelDebug), | ||
| ) | ||
| } |
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,45 @@ | ||
| package sequencer | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-devstack/devtest" | ||
| "github.com/ethereum-optimism/optimism/op-devstack/presets" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestRecoverModeWhenChainHealthy checks that the chain | ||
| // can progress as normal when recover mode is activated. | ||
| // Recover mode is designed to recover from a sequencing | ||
| // window expiry when there are ample L1 blocks to eagerly | ||
| // progress the l1 origin to. But when the l1 origin is | ||
| // close to the tip of the l1 chain, the eagerness would cause | ||
| // a delay in unsafe block production while the sequencer waits | ||
| // for the next l1 origin to become available. Recover mode | ||
| // has since been patched, and the sequencer will not demand the | ||
| // next l1 origin until it is actually available. This tests | ||
| // protects against a regeression in that behavior. | ||
| func TestRecoverModeWhenChainHealthy(gt *testing.T) { | ||
| t := devtest.ParallelT(gt) | ||
| sys := presets.NewMinimal(t) | ||
| tracer := t.Tracer() | ||
| ctx := t.Ctx() | ||
|
|
||
| err := sys.L2CL.SetSequencerRecoverMode(true) | ||
| require.NoError(t, err) | ||
| blockTime := sys.L2Chain.Escape().RollupConfig().BlockTime | ||
| numL2Blocks := uint64(20) | ||
| waitTime := time.Duration(blockTime*numL2Blocks+5) * time.Second | ||
|
|
||
| num := sys.L2CL.SyncStatus().UnsafeL2.Number | ||
| new_num := num | ||
| require.Eventually(t, func() bool { | ||
| ctx, span := tracer.Start(ctx, "check head") | ||
| defer span.End() | ||
|
|
||
| new_num, num = sys.L2CL.SyncStatus().UnsafeL2.Number, new_num | ||
| t.Logger().InfoContext(ctx, "unsafe head", "number", new_num, "safe head", sys.L2CL.SyncStatus().SafeL2.Number) | ||
| return new_num >= numL2Blocks | ||
| }, waitTime, time.Duration(blockTime)*time.Second) | ||
| } |
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
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
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.