-
Notifications
You must be signed in to change notification settings - Fork 475
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
Validator recording fix #2660
Validator recording fix #2660
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.
I have a few minor comments, but generally LGTM
type BlockRecorderConfig struct { | ||
TrieDirtyCache int `koanf:"trie-dirty-cache"` | ||
TrieCleanCache int `koanf:"trie-clean-cache"` | ||
MaxPrepared int `koanf:"max-prepared"` |
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 think we should have this extend arbitrum.RecordingDatabaseConfig
(having that as an unnamed field, I forget the proper terminology in geth). Then we can call arbitrum.RecordingDatabaseConfigAddOptions
inside BlockRecorderConfigAddOptions
. Alternatively, I'd just drop the geth struct, or at least drop its koanf options and the AddOptions function to clarify that it's not directly part of the config.
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 think I'll remove the geth koanf and AddOptions
staker/stateless_block_validator.go
Outdated
return true, &fullInfo, nil | ||
} | ||
|
||
func clonePreimagesInto(dest, source map[arbutil.PreimageType]map[common.Hash][]byte) { |
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.
nit: I'd call this copyPreimagesInto
, to clarify that it won't clear out the destination and only adds new entries
staker/stateless_block_validator.go
Outdated
func clonePreimagesInto(dest, source map[arbutil.PreimageType]map[common.Hash][]byte) { | ||
for piType, piMap := range source { | ||
if dest[piType] == nil { | ||
dest[piType] = make(map[common.Hash][]byte, len(source[piType])) |
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.
nit: len(source[piType])
-> len(piMap)
staker/stateless_block_validator.go
Outdated
return nil, err | ||
} | ||
msg.Message.BatchGasCost = nil | ||
if err := msg.Message.FillInBatchGasCost(valBatchFetcher); err != nil { |
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.
technically, we don't need the preimages list for the batch gas cost calculation, but I don't think there's much overhead in practice especially with the cache so it's probably fine
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.
That's a good point and I do want to solve it because it allows making some things actually simpler..
PTAL
staker/stateless_block_validator.go
Outdated
if recording.Preimages != nil { | ||
e.Preimages[arbutil.Keccak256PreimageType] = recording.Preimages | ||
recordingPreimages := make(map[arbutil.PreimageType]map[common.Hash][]byte) | ||
recordingPreimages[arbutil.Keccak256PreimageType] = recording.Preimages |
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.
nit: map initialization syntax simplifies this slightly:
recordingPreimages := map[arbutil.PreimageType]map[common.Hash][]byte {
arbutil.Keccak256PreimageType: recording.Preimages,
}
…dator_fetch_batch_fix
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
Fixes batch recording.
Mostly:
pulls-in: OffchainLabs/go-ethereum#358 (though not necessary, it just removes now-unused code from geth)