diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e13ba47ab1..31ef1048ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,5 +10,6 @@ ### Additions and Improvements - Added `--p2p-static-peers-url` option to read static peers from a URL or file +- Added node epoch and computed slot to the sync committee duties failure message for more context about the failure condition. ### Bug Fixes \ No newline at end of file diff --git a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java index 71d6402f3f3..b0f3cff1e37 100644 --- a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java +++ b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java @@ -802,15 +802,17 @@ private SafeFuture> getStateForCommitteeDuties( return SafeFuture.completedFuture(Optional.of(bestState)); } - final UInt64 lastQueryableEpoch = + final UInt64 maxQueryableEpoch = syncCommitteeUtil.computeLastEpochOfNextSyncCommitteePeriod( combinedChainDataClient.getCurrentEpoch()); - if (lastQueryableEpoch.isLessThan(epoch)) { + if (maxQueryableEpoch.isLessThan(epoch)) { + final Optional networkCurrentSlot = + chainDataProvider.getNetworkCurrentSlot(); return SafeFuture.failedFuture( new IllegalArgumentException( - "Cannot calculate sync committee duties for epoch " - + epoch - + " because it is not within the current or next sync committee periods")); + String.format( + "Cannot calculate sync committee duties for epoch %s because it is not within the current or next sync committee periods (node current epoch %s, computed current slot %s)", + epoch, combinedChainDataClient.getCurrentEpoch(), networkCurrentSlot))); } final UInt64 requiredEpoch; diff --git a/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java b/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java index 5905559cb2d..afa3fe84f90 100644 --- a/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java +++ b/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java @@ -148,6 +148,10 @@ public GenesisData getGenesisData() { spec.atEpoch(ZERO).getConfig().getGenesisForkVersion()); } + public Optional getNetworkCurrentSlot() { + return recentChainData.getCurrentSlot(); + } + public tech.pegasys.teku.spec.datastructures.genesis.GenesisData getGenesisStateData() { if (!isStoreAvailable()) { throw new ChainDataUnavailableException();