-
Notifications
You must be signed in to change notification settings - Fork 473
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 reorg on init flags #2538
Fix reorg on init flags #2538
Conversation
f.Uint64(prefix+".recreate-missing-state-from", InitConfigDefault.RecreateMissingStateFrom, "block number to start recreating missing states from (0 = disabled)") | ||
f.Bool(prefix+".rebuild-local-wasm", InitConfigDefault.RebuildLocalWasm, "rebuild local wasm database on boot if needed (otherwise-will be done lazily)") | ||
f.Int64(prefix+".reorg-to-batch", InitConfigDefault.ReorgToBatch, "rolls back the blockchain to a specified batch number") | ||
f.Int64(prefix+".reorg-to-message-batch", InitConfigDefault.ReorgToMessageBatch, "rolls back the blockchain to the first batch at or before a given message index") | ||
f.Int64(prefix+".reorg-to-block-batch", InitConfigDefault.ReorgToBlockBatch, "rolls back the blockchain to the first batch at or before a given block number") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add to Validate() a test that at most one of those is >= 0
execution/interface.go
Outdated
@@ -70,6 +70,7 @@ type FullExecutionClient interface { | |||
Maintenance() error | |||
|
|||
ArbOSVersionForMessageNumber(messageNum arbutil.MessageIndex) (uint64, error) | |||
BlockNumberToMessageIndex(blockNum uint64) (arbutil.MessageIndex, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that reorg is a good enough reason to add it to the API.
reorg-to-*batch will always be an advanced functionality, that should only be used by those who know what they are doing. I don't mind making it a little harder.
We should make genesis-block-number be easy to find. It's in chain-config which sounds reasonable.. maybe we should print chain config on init so it'll be even easier to find?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most 3rd party providers only really know block numbers. Is there a significant downside to adding this interface? It seems generally useful to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this a bit more, we have access to the chain config directly here, so I switched to using that instead and removed this interface
arbnode/transaction_streamer.go
Outdated
|
||
// If not started, use a background context. | ||
// This can happening when reorging on startup using the init flag. | ||
ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should no longer be necessary, since now reorg happends after Start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is a successor to #2036 which only reorgs to batch boundaries, as suggested there.
NIT-2710