-
Notifications
You must be signed in to change notification settings - Fork 283
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
Implements a fallback Eth1Provider between multiple eth1 endpoints #3832
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.
This is looking really good. I'd say with a few little clean ups and improving the tests a bit it could be merged as the first step. Then use follow up PRs for checking syncing/chainid and getting the DepositContract
to use the fallback properly.
The CLI option to specify multiple endpoints is hidden anyway which is enough of a feature toggle to prevent users stumbling across this and finding it not fully ready yet.
pow/src/main/java/tech/pegasys/teku/pow/FallbackAwareEth1Provider.java
Outdated
Show resolved
Hide resolved
teku/src/main/java/tech/pegasys/teku/cli/options/DepositOptions.java
Outdated
Show resolved
Hide resolved
teku/src/main/java/tech/pegasys/teku/cli/options/DepositOptions.java
Outdated
Show resolved
Hide resolved
teku/src/main/java/tech/pegasys/teku/cli/options/DepositOptions.java
Outdated
Show resolved
Hide resolved
services/powchain/src/main/java/tech/pegasys/teku/services/powchain/PowchainService.java
Outdated
Show resolved
Hide resolved
pow/src/test/java/tech/pegasys/teku/pow/FallbackAwareEth1ProviderSelectorTest.java
Outdated
Show resolved
Hide resolved
d1fbd37
to
f9b6e85
Compare
@ajsutton should be better now |
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.
Looks good just a couple of little suggestions. Also would be worth changing the description so instead of fixes #3327
it's just part of #3327
otherwise it will close the issue and we need to get the DepositContract
using the fallback before the issue is fully fixed.
Also for the record, my theory around doing these reviews is that we're working in partnership so I try and provide actual code suggestions but it's also a change to "mind meld" on code style and the various decisions that mostly come down to personal preference but provide consistency across the code base. So while I could make the final few tweaks and merge this now I just leave them as suggestions to help with that knowledge sharing.
pow/src/main/java/tech/pegasys/teku/pow/FallbackAwareEth1Provider.java
Outdated
Show resolved
Hide resolved
services/powchain/src/main/java/tech/pegasys/teku/services/powchain/PowchainConfiguration.java
Outdated
Show resolved
Hide resolved
services/powchain/src/main/java/tech/pegasys/teku/services/powchain/PowchainConfiguration.java
Outdated
Show resolved
Hide resolved
@ajsutton thanks for providing these reviews. |
@ajsutton one question: I see there are various unused public methods in |
@ajsutton I did several changes. I also made the fallback provider to be used in case of single endpoint (unifies exception handling in tests and code) but don't know if you'll agree. |
Yep we can get rid of them. I think there's methods in Will make sure to take a look at the latest changes this morning. |
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 like the direction this is heading. Looking really good.
pow/src/main/java/tech/pegasys/teku/pow/exception/Eth1RequestExceptionsContainer.java
Outdated
Show resolved
Hide resolved
teku/src/main/java/tech/pegasys/teku/cli/options/DepositOptions.java
Outdated
Show resolved
Hide resolved
teku/src/main/java/tech/pegasys/teku/cli/options/DepositOptions.java
Outdated
Show resolved
Hide resolved
pow/src/main/java/tech/pegasys/teku/pow/exception/Eth1RequestExceptionsContainer.java
Outdated
Show resolved
Hide resolved
pow/src/main/java/tech/pegasys/teku/pow/exception/Eth1RequestExceptionsContainer.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Adrian Sutton <adrian@symphonious.net>
c8d6d70
to
3570a0f
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.
Looks great, thanks so much for taking this on. I'll do some manual testing on this today but I think this is ready to merge. We can continue to improve by only trying endpoints that are in-sync etc but I think this covers the key use case where a local node is offline so it should fail-over to another provider.
Anything else you want to get done in this PR?
pow/src/main/java/tech/pegasys/teku/pow/exception/Eth1RequestException.java
Outdated
Show resolved
Hide resolved
…xception.java Co-authored-by: Adrian Sutton <adrian@symphonious.net>
cool :) I'd like to add the endpoint validation logic but can be added on a separate PR |
LOG.warn("Retrying with next eth1 endpoint", err); | ||
return run(task, providers, exceptionsContainer); | ||
} else { | ||
LOG.error("All available eth1 endpoints failed", exceptionsContainer); | ||
return SafeFuture.failedFuture(exceptionsContainer); |
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 testing locally I was reminded that we deliberately don't print every error from the eth1 node above debug level because there are so many requests made and retries that they wind up swamping the logs. Otherwise this works great so I'm going to change these to debug level, pull in the latest changes and merge this.
I've logged #3855 to improve the logging around eth1 - it's not terrible now but we can do better and some of it may be worth at least bearing in mind when doing the status checks on endpoints.
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. Thanks so much for your work on this - fantastic stuff.
Oh, I've put this in the changelog as early access as the new CLI option is still hidden. Let's see where we get to with the endpoint validation stuff but I suspect we'll actually unhide it and make it a fully ready to go feature for the next release. |
PR Description
mainly based on #3377
Added
FallbackAwareEth1Provider
that implementsEth1Provider
Eth1Provider
corresponding to the candidatesEth1ProviderSelector
Added
--eth1-endpoints
alias for the optionUpdated to a list of endpoints
PowchainService
to build theEth1Provider
accordinglyFallbackAwareEth1Provider
is builtTODOs\TBAs
Eth1ProviderSelector
and\orPowchainService
to poll and select usable candidates based onethSyncing()
calls andgetChainId()
FallbackAwareEth1ProviderSelectorTest
are not covering all methods inEth1Provider
interfaceFallbackAwareEth1Provider
DepositContractAccessor
andDepositContract
so that we don't have to provide a specific web3js instance to itFixed Issue(s)
part of #3327
Documentation
documentation
label to this PR if updates are required.Changelog