Skip to content

Commit

Permalink
Upgrade gradle to 8.4 (Consensys#7607)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored Oct 19, 2023
1 parent ccaf7a4 commit 7fb8eb1
Show file tree
Hide file tree
Showing 39 changed files with 133 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class SyncManager extends Service {

private boolean syncActive = false;
private boolean syncQueued = false;

/**
* Tracks the last state we notified subscribers of. It differs from syncActive at the start of a
* sync because we set syncActive as soon as we begin, but only notify subscribers once we've
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
public class ValidatorApiHandler implements ValidatorApiChannel {

private static final Logger LOG = LogManager.getLogger();

/**
* Number of epochs ahead of the current head that duties can be requested. This provides some
* tolerance for validator clients clocks being slightly ahead while still limiting the number of
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ allprojects {
endWithNewline()
licenseHeaderFile "${rootDir}/gradle/spotless.java.license"
// See gradle.properties for exports/opens flags required by JDK 16 and Google Java Format plugin
googleJavaFormat('1.13.0')
googleJavaFormat('1.17.0')
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public List<SpecMilestone> getSupportedMilestones() {
return SpecMilestone.getMilestonesUpTo(getHighestSupportedMilestone());
}

/** @return The latest milestone that is supported */
/**
* @return The latest milestone that is supported
*/
public SpecMilestone getHighestSupportedMilestone() {
return epochToMilestone.lastEntry().getValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public int getSyncCommitteeSize(final UInt64 slot) {
.map(SpecConfigAltair::getSyncCommitteeSize)
.orElse(0);
}

// Genesis
public BeaconState initializeBeaconStateFromEth1(
Bytes32 eth1BlockHash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public Eth1Data withBlockHash(final Bytes32 blockHash) {
return new Eth1Data(getDepositRoot(), getDepositCount(), blockHash);
}

/** @return the deposit_root */
/**
* @return the deposit_root
*/
public Bytes32 getDepositRoot() {
return getField0().get();
}
Expand All @@ -78,7 +80,9 @@ public UInt64 getDepositCount() {
return getField1().get();
}

/** @return the block_hash */
/**
* @return the block_hash
*/
public Bytes32 getBlockHash() {
return getField2().get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public interface MinimalBeaconBlockSummary {

Bytes32 getStateRoot();

/** @return the hash tree root of the block */
/**
* @return the hash tree root of the block
*/
Bytes32 getRoot();

default String toLogString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ default UInt64 getTimeSeconds() {

UInt64 getGenesisTime();

/** @return the genesis time in milliseconds */
/**
* @return the genesis time in milliseconds
*/
default UInt64 getGenesisTimeMillis() {
return secondsToMillis(getGenesisTime());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ public int size() {
return childToParent.size();
}

/** @return A stream of all tree nodes in pre-order traversal order */
/**
* @return A stream of all tree nodes in pre-order traversal order
*/
public Stream<Bytes32> preOrderStream() {
return preOrderStream(rootHash);
}

/** @return A stream of all tree nodes in breadth-first traversal order */
/**
* @return A stream of all tree nodes in breadth-first traversal order
*/
public Stream<Bytes32> breadthFirstStream() {
return createBreadthFirstStream(rootHash);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public UInt64 getBlockSlot() {
return block.getSlot();
}

/** @return The checkpoint state which is advanced to the checkpoint epoch boundary */
/**
* @return The checkpoint state which is advanced to the checkpoint epoch boundary
*/
public BeaconState getState() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
@VisibleForTesting
public static final BLSSignatureVerifier DEFAULT_DEPOSIT_SIGNATURE_VERIFIER =
BLSSignatureVerifier.SIMPLE;

/**
* For debug/test purposes only enables/disables {@link DepositData} BLS signature verification
* Setting to <code>false</code> significantly speeds up state initialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ public TotalBalances(
this.previousEpochHeadAttesters = previousEpochHeadAttesters;
}

/** @return The sum of effective balances of all active validators from the current epoch. */
/**
* @return The sum of effective balances of all active validators from the current epoch.
*/
public UInt64 getCurrentEpochActiveValidators() {
return currentEpochActiveValidators.max(effectiveBalanceIncrement);
}

/** @return The sum of effective balances of all active validators from the previous epoch. */
/**
* @return The sum of effective balances of all active validators from the previous epoch.
*/
public UInt64 getPreviousEpochActiveValidators() {
return previousEpochActiveValidators.max(effectiveBalanceIncrement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public boolean isCurrentEpochTargetAttester() {
return currentEpochTargetAttester;
}

/** @return True if the validator correctly attested to the correct head in the current epoch. */
/**
* @return True if the validator correctly attested to the correct head in the current epoch.
*/
public boolean isCurrentEpochHeadAttester() {
return currentEpochHeadAttester;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ enum FailureReason {

boolean isSuccessful();

/** @return If successful, returns a {@code SignedBeaconBlock}, otherwise returns null. */
/**
* @return If successful, returns a {@code SignedBeaconBlock}, otherwise returns null.
*/
SignedBeaconBlock getBlock();

/** @return If failed, returns a non-null failure reason, otherwise returns null. */
/**
* @return If failed, returns a non-null failure reason, otherwise returns null.
*/
FailureReason getFailureReason();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class SyncCommitteeMessagePool implements SlotEventsChannel {

private final Spec spec;
private final SyncCommitteeMessageValidator validator;

/**
* Effectively provides a mapping from (slot, blockRoot, subcommitteeIndex) -> ContributionData
* but using a nested map under slot so that pruning based on slot is efficient.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
import tech.pegasys.teku.storage.client.RecentChainData;
import tech.pegasys.teku.storage.store.UpdatableStore.StoreTransaction;

/** @deprecated Prefer ChainBuilder, ChainUpdater, or StorageSystem */
/**
* @deprecated Prefer ChainBuilder, ChainUpdater, or StorageSystem
*/
@Deprecated
public class BeaconChainUtil {

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void respondWithCode(final int statusCode) {
statusCode);
respondWithUndocumentedCode(statusCode);
}

/** This is only used when intending to return status code without a response body */
@Override
public void respondWithUndocumentedCode(final int statusCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class SingleQueryParameterUtils {
"Unable to read Bytes96 data from query parameter.";
public static final String INVALID_NUMERIC_VALUE =
"Unable to read a numeric value from query parameter.";

/**
* Checks that a parameter exists, has a single entry, and is not an empty string
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

class SwaggerWebjarIntegrityTest {
private static final String VENDOR_COPY_PATH = "/swagger-ui/vendor";

/**
* `infrastructure/restapi/src/main/resources/swagger-ui/vendor` contains several files which
* should match files with the same names in 'org.webjars:swagger-ui'.
Expand Down
5 changes: 4 additions & 1 deletion infrastructure/ssz/generator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
dependencies {
implementation project(':infrastructure:bytes')
// for some reasons, if gradle 8.4 builds using java 21, build fails if we specify
// implementation project(':infrastructure:bytes')
// so we use the following instead
implementation 'org.apache.tuweni:tuweni-bytes'
implementation project(':infrastructure:ssz')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public NodeRelation inverse() {
* Effectively this is {@link Long#MIN_VALUE} or <code>0b10000...000L</code> in binary form
*/
public static final long LEFTMOST_G_INDEX = gIdxLeftmostFrom(SELF_G_INDEX);

/**
* The generalized index (normally an index of non-existing node) of the rightmost possible node
* Effectively this is <code>-1L</code> or <code>0b11111...111L</code> in binary form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ public double doubleValue() {
public BigInteger bigIntegerValue() {
return toUnsignedBigInteger(value);
}

// From Guava UnsignedLong.bigIntegerValue(). Apache 2 license.

private static BigInteger toUnsignedBigInteger(final long value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ public int getCommitteesPerSlot(final int activeValidatorCount) {
.intValue();
}

/** @return The desired time to decay a single scoring event to zero */
/**
* @return The desired time to decay a single scoring event to zero
*/
public Duration getTargetScoreRetention() {
return targetScoringDuration;
}
Expand All @@ -192,7 +194,9 @@ public double getTargetScoreDecayFactor() {
return calculateDecayFactor(getTargetScoreRetention());
}

/** @return The target degree (number of peers) in each topic mesh */
/**
* @return The target degree (number of peers) in each topic mesh
*/
public int getD() {
return d;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public interface GossipEncoding {
*/
<T extends SszData> Bytes encode(T value);

/** @return A factory for creating PreparedGossipMessages */
/**
* @return A factory for creating PreparedGossipMessages
*/
Eth2PreparedGossipMessageFactory createPreparedGossipMessageFactory(
ForkDigestToMilestone forkDigestToMilestone);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public interface PreparedGossipMessage {
*/
Bytes getMessageId();

/** @return Returns the decoded message content */
/**
* @return Returns the decoded message content
*/
DecodedMessageResult getDecodedMessage();

Bytes getOriginalMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ private static void addGossipParamsMiscValues(

private static void addGossipParamsDValues(
final GossipConfig gossipConfig, final GossipParamsBuilder builder) {
builder
.D(gossipConfig.getD())
builder.D(gossipConfig.getD())
.DLow(gossipConfig.getDLow())
.DHigh(gossipConfig.getDHigh())
.DLazy(gossipConfig.getDLazy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void reportDisconnection(
final Optional<DisconnectReason> reason,
final boolean locallyInitiated);

/** @return boolean representing whether the manager should disconnect. */
/**
* @return boolean representing whether the manager should disconnect.
*/
boolean adjustReputation(final PeerAddress peerAddress, final ReputationAdjustment effect);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ public interface StorageQueryChannel extends ChannelInterface {

SafeFuture<WeakSubjectivityState> getWeakSubjectivityState();

/** @return The earliest available finalized block's slot */
/**
* @return The earliest available finalized block's slot
*/
SafeFuture<Optional<UInt64>> getEarliestAvailableBlockSlot();

/** @return The earliest available finalized block */
/**
* @return The earliest available finalized block
*/
SafeFuture<Optional<SignedBeaconBlock>> getEarliestAvailableBlock();

SafeFuture<Optional<SignedBeaconBlock>> getFinalizedBlockAtSlot(UInt64 slot);
Expand Down Expand Up @@ -84,7 +88,9 @@ SafeFuture<List<BlobSidecar>> getBlobSidecarsBySlotAndBlockRoot(

SafeFuture<Optional<DepositTreeSnapshot>> getFinalizedDepositSnapshot();

/** @return The earliest available finalized blob sidecar's slot */
/**
* @return The earliest available finalized blob sidecar's slot
*/
SafeFuture<Optional<UInt64>> getEarliestAvailableBlobSidecarSlot();

SafeFuture<Optional<BlobSidecar>> getBlobSidecar(SlotAndBlockRootAndBlobIndex key);
Expand Down
Loading

0 comments on commit 7fb8eb1

Please sign in to comment.