-
Notifications
You must be signed in to change notification settings - Fork 4
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
e2e regression tests: HTTP caching proxy, new cases #633
Conversation
a7f90b3
to
c7ff623
Compare
cmd/analyzer/analyzer.go
Outdated
@@ -512,6 +526,16 @@ func (a *Service) Start() { | |||
ctx, cancelAnalyzers := context.WithCancel(context.Background()) | |||
defer cancelAnalyzers() // Start() only returns when analyzers are done, so this should be a no-op, but it makes the compiler happier. | |||
|
|||
// Start helpers. | |||
for _, helper := range a.helpers { |
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.
Should probably also try to gracefully Shutdown()
the server helpers in received interrupt, shutting down
part. And call Close()
on the servers in cleanup
.
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.
... not sure it's worth it for these proxies that are intended for e2e testing only and will be shut down simply by killing the whole binary.
But it's good to encourage nice clean code :). Added both, thank you.
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.
Today's end-to-end tests are tomorrow's production features 😁
cmd/analyzer/analyzer.go
Outdated
@@ -149,6 +151,7 @@ func wipeStorage(cfg *config.StorageConfig) error { | |||
type Service struct { | |||
analyzers []SyncedAnalyzer | |||
fastSyncAnalyzers []SyncedAnalyzer | |||
helpers []*http.Server |
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.
Should this be just named (caching) proxies, at least while caching proxies are the only type of helpers there is?
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.
👍 renamed here and related variables throughout the file.
accessing this cache over HTTP, can you talk about this in existing code that does similar, there's a Go interface and a caching implementation of that |
4d4be77
to
c3f6a8f
Compare
1075341
to
57204f9
Compare
// NOTE: We upsert rather than update; if the contract is not in the db yet, UPDATE would ignore the | ||
// contract and this analyzer would keep retrying it on every iteration. |
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.
Hm is there a case where the verifier would upsert rather than update? The GetItems
query fetches candidates from the chain.evm_contracts
table originally
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.
An insert can happen if sourcify has a contract that we haven't encountered yet, e.g. because we're scanning just a subset of blocks. GetItems no longer limits the items to chain.evm_contracts
addresses as of #634 (which is not merged; I accidentally merged it into this branch and then undid that, but I'll duplicate the PR to merge into main
once this PR goes in). The reasons for the change are pretty lightweight: we now don't have to worry about what happens as the number of contracts grows, and I found the new flow easier to understand, especially with the added partial/full verification.
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 switch to a mockable http client later
Yeah I'm totally OK with that. Right now the http proxy is only being used for sourcify, and it's a low enough number of requests that we could mock them more explicitly. FWIW, the caching proxy achieves pretty much the same effect, with the debugging downside that it's a lot harder to see the cached/mocked responses. |
57204f9
to
9e5ad3d
Compare
9e5ad3d
to
6622cc4
Compare
what's the item analyzer exit delay for? is there a new test that relies on it? new config api can't say to do what we did before, you instead have to set a very small delay |
cb3c188
to
458d2ca
Compare
Yeah the e2e. We ideally would want to run in 3 stages ...
True. I worried about it a little at first, but then decided it's just an aesthetic problem, not a functional one. And it only applies to testing. So screw it. |
458d2ca
to
aa761a4
Compare
This reverts commit 91dd3b8.
This PR expands our e2e testing capabilities; the motivation is the upcoming support for partial verifications in Sourcify.
The changes are:
evmverifier
analyzer is now included in e2e tests, using the new proxy.db__*
test cases that aim to capture the "derived" columns of txs and events, notably the ABI-parsing results.evmverifier
. Our current e2e block range does not engage with any contracts that are fully verified 😬stop_on_empty_queue
has been replaced with a duration-based flag ("exit only if the queue has been empty for N seconds"). This is helpful for item analyzers that interact with each other.