-
Notifications
You must be signed in to change notification settings - Fork 452
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.
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?
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.
addressed in #2442
} | ||
} | ||
|
||
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?
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.
addressed in #2442
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
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.
addressed in #2442
}() | ||
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
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.
addressed in #2442
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.
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 test is mostly intended to be a regression test for a specific issue, I added a comment describing the details in the follow up PR: #2442
there should be only one key with the prefix (unless there was a reorg) so there is no need of caching. If the entry is found, the recentBlock
(previously i
) is advanced to the next block, and the iterator is created for the new prefix.
Let me know if you think that extending this test makes sense to cover more cases then the targeted issue
StateAndHeaderByNumberOrHash