Skip to content

Commit

Permalink
Merge branch 'master' into sync-error-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfyone authored Feb 19, 2025
2 parents 543b101 + 41577e9 commit 903b570
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@ Start by looking through the 'good first issue' and 'help wanted' issues:
* [Good First Issue][search-label-good-first-issue] - issues which should only require a few lines of code, and a test or two.
* [Help wanted issues][search-label-help-wanted] - issues that are a bit more involved than `good first issue` issues.

Please keep in mind that we do not accept non-code contributions like fixing comments, typos or some other trivial fixes. Although we appreciate the extra help, managing lots of these small contributions is unfeasible, and puts extra pressure in our continuous delivery systems (running all tests, etc). Feel free to open an issue pointing any of those errors and we will batch them into a single change.
Please reach out in discord if you're looking to help out, and we can assist you in finding a good candidate ticket to work on, or discuss the idea you have.

We have a [Teku](https://discord.com/channels/697535391594446898/697539289042649190) channel, and also a [Teku Contributors](https://discord.com/channels/697535391594446898/1050616638497640548) channel.

Due to the prevalence of 'airdrop farming' type practices, this unfortunately puts heightened scrutiny on first time contributors, but if you're genuinely looking to help out, we'd really love to assist you in any way we can.
This does mean however that we will generally reject 'random' fixes such as 'TODO' fixes, typos, and generally things that add no value that we haven't identified as something we need. These are likely to be rejected with 'due to contribution guidelines' type responses.
This includes but is not limited to
* code replacement of TODO's that are not well tested or justified by performance and regression tests to prove their worth.
* typos, even if valid, will be worked into other PRs or just ignored completely if they're from first time contributors with no substantative value.
* things like replacing RuntimeException with a new exception type that's not well tested and adding value.
* rewording of comments

Minimal discussion will be given in PR's due to the volume we're needing to deal with currently of this type of PR, which is taking away from actual development time, so please don't be offended if you're genuinely trying to help out; and we say 'see contribution guidelines'.

### Local Development
The codebase is maintained using the "*contributor workflow*" where everyone without exception contributes patch proposals using "*pull-requests*". This facilitates social contribution, easy testing and peer review.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static java.util.Objects.requireNonNull;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -120,8 +121,12 @@ private <S extends SszData> RequestBody createOctetStreamRequestBody(final S req
return new RequestBody() {

@Override
public void writeTo(final BufferedSink bufferedSink) {
requestBodyObject.sszSerialize(bufferedSink.outputStream());
public void writeTo(final BufferedSink bufferedSink) throws IOException {
try {
requestBodyObject.sszSerialize(bufferedSink.outputStream());
} catch (final UncheckedIOException e) {
throw e.getCause();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import tech.pegasys.teku.infrastructure.exceptions.ExceptionUtil;
import tech.pegasys.teku.infrastructure.ssz.SszData;
import tech.pegasys.teku.infrastructure.ssz.schema.SszSchema;
import tech.pegasys.teku.infrastructure.time.Throttler;
import tech.pegasys.teku.infrastructure.time.TimeProvider;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.networking.eth2.gossip.encoding.DecodingException;
import tech.pegasys.teku.networking.eth2.gossip.encoding.Eth2PreparedGossipMessageFactory;
Expand Down Expand Up @@ -56,6 +58,10 @@ public class Eth2TopicHandler<MessageT extends SszData> implements TopicHandler
private final NetworkingSpecConfig networkingConfig;
private final DebugDataDumper debugDataDumper;
private final String topic;
final TimeProvider timeProvider;

// every slot of mainnet config
private final Throttler<Logger> loggerThrottler = new Throttler<>(LOG, UInt64.valueOf(12));

public Eth2TopicHandler(
final RecentChainData recentChainData,
Expand All @@ -79,6 +85,7 @@ public Eth2TopicHandler(
gossipEncoding.createPreparedGossipMessageFactory(
recentChainData::getMilestoneByForkDigest);
this.debugDataDumper = debugDataDumper;
this.timeProvider = recentChainData.getStore();
this.topic = GossipTopics.getTopic(forkDigest, topicName, gossipEncoding);
}

Expand Down Expand Up @@ -173,8 +180,12 @@ protected ValidationResult handleMessageProcessingError(
P2P_LOG.onGossipMessageDecodingError(getTopic(), message.getOriginalMessage(), err);
response = ValidationResult.Invalid;
} else if (ExceptionUtil.hasCause(err, RejectedExecutionException.class)) {
LOG.warn(
"Discarding gossip message for topic {} because the executor queue is full", getTopic());
loggerThrottler.invoke(
timeProvider.getTimeInSeconds(),
(log) ->
LOG.warn(
"Discarding gossip message for topic {} because the executor queue is full",
getTopic()));
response = ValidationResult.Ignore;
} else if (ExceptionUtil.hasCause(err, ServiceCapacityExceededException.class)) {
LOG.warn(
Expand Down

0 comments on commit 903b570

Please sign in to comment.