-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: check runtime vs database db #254
Conversation
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
if s.Logger == nil { | ||
s.Logger = log.WithFields("module", "compatibilityCheck") | ||
} |
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.
Why don't we move this to the constructor function (NewCompatibilityCheck
)?
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 prefer a lazy initialization: if I create the object but I don't use it doesn't produce any error, but if you try to use it you need to fullfil the parameters.
I case that your question if over populating s.Logger
. It's for the same reason, if I don't need Logger I don't need to populate until I'm going to use it, also, in the first version, not setting the Logger variable was an error
WDTY?
return nil | ||
} | ||
|
||
func (s *CompatibilityCheck[T]) initialize() 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.
WDYT, in order to be semantically more correct?
func (s *CompatibilityCheck[T]) initialize() error { | |
func (s *CompatibilityCheck[T]) validate() 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.
In fact it's doing both things: the field Logger is initialized and the rest checked... I don't mind if you prefer validate
for me it's ok. WDYT?
|
Description
key_value
)IsCompatible(storage T) error
can run, if not it's a fail (you can override that setting config variableRequireStorageContentCompatibility
to false)Config changes
RequireStorageContentCompatibility
(by default istrue
) as global var that is injected in:BridgeL1Sync
,BridgeL2Sync
,LastGERSync
,AggSender
:Fixes #165
Review comments:
Logger
have been moved fromaggsender/types
tocommon
packages because it's required by multiples modulessync.RuntimeData
:sync.EVMDriver
have a new fieldscompatibilityChecker compatibility.CompatibilityChecker
that implements the logic of this featuresync.downloader
interface usingGetRuntimeData
sync.processorInterface
implementing interfacecompatibility.CompatibilityDataStorager[RuntimeData]
: There are a helper objects to allow provide this funcionality directly: that iscompatibility.NewKeyValueToCompatibilityStorage[T]
The objects in compatibility module:
To implement
CompatibilityDataStorager
you can use:PR Checklist: