-
Notifications
You must be signed in to change notification settings - Fork 379
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
pull in geth changes for state recreation #2005
Conversation
This reverts commit 8eebd46.
8b1407a
to
f69b53e
Compare
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.
approved with comments on tests.
Let's do a round on these in chat / separate PR.
|
||
blockCountRequiredToFlushDirties := builder.execConfig.Caching.BlockCount | ||
makeSomeTransfers(t, ctx, builder, blockCountRequiredToFlushDirties) | ||
|
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.
can we add here a check that StateAndHeaderByNumber will now fail?
Or maybe force state to drop after the end of current test - and check that StateAndHeaderByNumber fails then?
} | ||
} | ||
|
||
func TestGettingStateForRPCHybridArchiveNode(t *testing.T) { |
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.
Is the logic here different from above other than config? can we merge the functions?
var wgCallers sync.WaitGroup | ||
for j := 0; j < threads && ctx.Err() == nil; j++ { | ||
wgCallers.Add(1) | ||
go func() { |
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 gofunc is quite weird and deserves at least some explanation in comments
}() | ||
api := builder.L2.ExecNode.Backend.APIBackend() | ||
db := builder.L2.ExecNode.Backend.ChainDb() | ||
i := 1 |
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 is a sync variable between multiple threads.. the name "i" doesn't really fit it
prefix = append([]byte("b"), prefix...) | ||
it := db.NewIterator(prefix, nil) | ||
defer it.Release() | ||
if it.Next() { |
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.
suggestion: to speed up polling and hit more edge-cases, each thread could cache blockhashes that it already got a non-error response for in previous loops and skip them the next time iterator gets them
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.
alternatively, we could poll old blockhashes and make sure they don't return the "ahead of current block" error.
StateAndHeaderByNumberOrHash