-
Notifications
You must be signed in to change notification settings - Fork 863
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
Refactor Besu custom error prone dependency #6692
Conversation
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info> # Conflicts: # ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/StorageRangeDataRequest.java
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info> # Conflicts: # ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/BadBlockCause.java # ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/BadBlockReason.java
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info> # Conflicts: # ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractGasLimitSpecification.java
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
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.
couple of comments
gradle/verification-metadata.xml
Outdated
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.
are all these dependencies required? I thought we'd end up with fewer dependencies by moving error-prone out?
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.
@macfarla This is gradle verification metadata. This is automagically updated by running command ./gradlew --write-verification-metadata sha256 help
. This file simply records the sha256 signaturs of various jars that gradle resolves.
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 think its a good idea to re-generate the whole file (by deleting it first and rerunning above command), otherwise it will keep updating it rather than removing older entries.
build.gradle
Outdated
@@ -226,8 +229,9 @@ allprojects { | |||
] | |||
|
|||
options.errorprone { | |||
excludedPaths = '.*/(generated/*.*|.*ReferenceTest_.*|build/.*/annotation-output/.*)' | |||
|
|||
//excludedPaths = '.*/(generated/*.*|.*ReferenceTest_.*|build/.*/annotation-output/.*)' |
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.
what's the consequence of this change - do we end up flagging issues within ref tests?
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.
@macfarla Should have removed the commented line. I think the option disableWarningsInGeneratedCode = true
has started ignoring quite a bit of files. Also, the ReferenceTest_
tests are generated in the generated
sub-folder. In summary, we are still good by updating the excludedPath to only ignore generated
subfolders.
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
allowlistEntry.toLowerCase().equals(header.toLowerCase()))) | ||
allowlistEntry | ||
.toLowerCase(Locale.ROOT) | ||
.equals(header.toLowerCase(Locale.ROOT)))) |
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.
Better to replace it with equalsIgnoreCase
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.
done.
@@ -41,25 +40,25 @@ public void lastSeenAndFirstDiscoveredTimestampsUpdatedOnMessage() { | |||
final Packet pong = helper.createPongPacket(agent, Hash.hash(agentPing.getHash())); | |||
helper.sendMessageBetweenAgents(testAgent, agent, pong); | |||
|
|||
final AtomicLong lastSeen = new AtomicLong(); | |||
final AtomicLong firstDiscovered = new AtomicLong(); | |||
long lastSeen; |
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't see why an AtomicLong was ever needed, but it's normally a very deliberate choice. Is there some concurrency happening in this test?
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.
@jframe I checked the git history. It used to have code similar to:
await()
.atMost(1, TimeUnit.SECONDS)
.untilAsserted(
() -> {
assertThat(controller.getPeers()).hasSize(1);
which since has been removed. Now there is no need to have AtomicLong anymore (and errorprone reported it as UnnecessaryAsync
warning).
@@ -141,6 +141,7 @@ protected boolean hasExpectedNonce( | |||
} | |||
|
|||
@Override | |||
@SuppressWarnings("NonApiType") | |||
protected void internalConsistencyCheck( | |||
final Map<Address, TreeMap<Long, PendingTransaction>> prevLayerTxsBySender) { |
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 think the TreeMap can be changed to a NavigableMap. I think the method we use on the Map is computeIfPresent which is also present on the NavigableMap. I changed this locally and for types that inherit this method and seemed to compile for me.
@@ -568,6 +568,7 @@ public String logSender(final Address sender) { | |||
|
|||
protected abstract String internalLogStats(); | |||
|
|||
@SuppressWarnings("NonApiType") | |||
boolean consistencyCheck( | |||
final Map<Address, TreeMap<Long, PendingTransaction>> prevLayerTxsBySender) { |
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 this also be changed to use a NavigableMap?
@@ -130,6 +130,7 @@ public boolean isResponseReceived() { | |||
return true; | |||
} | |||
|
|||
@SuppressWarnings("NonApiType") | |||
public void addLocalData( | |||
final WorldStateProofProvider worldStateProofProvider, | |||
final TreeMap<Bytes32, Bytes> accounts, |
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 this be a NavigableMap?
@@ -203,6 +204,7 @@ public Bytes32 getStorageRoot() { | |||
return storageRoot; | |||
} | |||
|
|||
@SuppressWarnings("NonApiType") | |||
public TreeMap<Bytes32, Bytes> getSlots() { |
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.
NavigableMap?
@@ -126,6 +126,7 @@ protected int doPersist( | |||
return nbNodesSaved.get(); | |||
} | |||
|
|||
@SuppressWarnings("NonApiType") | |||
public void addResponse( | |||
final SnapWorldDownloadState downloadState, |
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.
Is is the TreeMap is doesn't like here?
@@ -129,12 +129,12 @@ allprojects { | |||
} | |||
|
|||
task sourcesJar(type: Jar, dependsOn: classes) { | |||
classifier = 'sources' | |||
archiveClassifier = 'sources' |
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.
Why did this need to change?
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.
These were warnings in build.gradle file that will be an issue in future release of gradle. Although they should not be technically part of this PR, I fixed them originally while researching this problem and were using debug flags to the build.
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Move Besu custom error-prone checks into its own repository and use it as an external dependency. This allows to move to a newer version of Google errorprone checks as well while cleaning up build.gradle file. Key changes resulted due to this change: * String toLowerCase and toUpperCase to use Locale.ROOT as argument * Use interface such as List,Map or NavigatableMap instead of concrete class where appropriate. * Simplify StringBuilder to plain String * Suppress warnings where appropriate. ----- Signed-off-by: Usman Saleem <usman@usmans.info> Signed-off-by: amsmota <antonio.mota@citi.com>
Move Besu custom error-prone checks into its own repository and use it as an external dependency. This allows to move to a newer version of Google errorprone checks as well while cleaning up build.gradle file. Key changes resulted due to this change: * String toLowerCase and toUpperCase to use Locale.ROOT as argument * Use interface such as List,Map or NavigatableMap instead of concrete class where appropriate. * Simplify StringBuilder to plain String * Suppress warnings where appropriate. ----- Signed-off-by: Usman Saleem <usman@usmans.info> Signed-off-by: amsmota <antonio.mota@citi.com>
Move Besu custom error-prone checks into its own repository and use it as an external dependency. This allows to move to a newer version of Google errorprone checks as well while cleaning up build.gradle file. Key changes resulted due to this change: * String toLowerCase and toUpperCase to use Locale.ROOT as argument * Use interface such as List,Map or NavigatableMap instead of concrete class where appropriate. * Simplify StringBuilder to plain String * Suppress warnings where appropriate. ----- Signed-off-by: Usman Saleem <usman@usmans.info>
PR description
Move Besu custom error-prone checks into its own repository. This allows to move to a newer version of Google errorprone checks as well while cleaning up
build.gradle
file.Key changes:
toLowerCase
andtoUpperCase
to useLocale.ROOT
as argumentList
,Map
orNavigatableMap
instead of concrete class where appropriate.StringBuilder
to plain StringThanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Most advanced CI tests are deferred until PR approval, but you could:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests
Fixed Issue(s)