Skip to content
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

deprecation: replace calls to isEqualToComparingFieldByField #3042

Merged
merged 6 commits into from
Nov 15, 2021

Conversation

macfarla
Copy link
Contributor

with usingRecursiveComparison().isEqualTo

Signed-off-by: Sally MacFarlane sally.macfarlane@consensys.net

Simple find and replace.

Changelog

…).isEqualTo

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Copy link
Member

@antonydenyer antonydenyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Related to #2766

Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending some reversal based on unit and integration tests.

@macfarla
Copy link
Contributor Author

@atoulme Q for you -
the test failures here - a lot of them boil down to this problem - is this something to address in tuweni? I can't really see a nice way around it at the besu end.

field/property 'payload.unsignedPayload.digest.delegate' differ:
- actual value  : 0xb58e0d975ca2e178b705d7c5a5ee243f51b7d8449097746bb93a47f17392ff85 (ArrayWrappingBytes32@f09a29b)
- expected value: 0xb58e0d975ca2e178b705d7c5a5ee243f51b7d8449097746bb93a47f17392ff85 (ByteBufferWrappingBytes32@1afb8449)
org.apache.tuweni.bytes.ArrayWrappingBytes32 can't be compared to org.apache.tuweni.bytes.ByteBufferWrappingBytes32 as ByteBufferWrappingBytes32 does not declare all ArrayWrappingBytes32 fields, it lacks these: [bytes]

or this one which I think is the inverse of ^
org.apache.tuweni.bytes.ByteBufferWrappingBytes32 can't be compared to org.apache.tuweni.bytes.ArrayWrappingBytes32 as ArrayWrappingBytes32 does not declare all ByteBufferWrappingBytes32 fields, it lacks these: [byteBuffer]

@macfarla macfarla added TeamRevenant GH issues worked on by Revenant Team testing labels Nov 12, 2021
@atoulme
Copy link
Contributor

atoulme commented Nov 12, 2021

Not sure I can help much here - equality works:
assertEquals(new ArrayWrappingBytes32(new byte[32]), new ByteBufferWrappingBytes32(ByteBuffer.allocate(32)));

These are different implementations of the Bytes object, one with a native byte array, and one with a ByteBuffer backing it. I am not sure what the effort here is, but if you try to compare the fields of the object, it won't work here.

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@macfarla macfarla merged commit c0b1316 into hyperledger:main Nov 15, 2021
@macfarla macfarla deleted the field-by-field branch November 15, 2021 10:31
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
…dger#3042)

* replace isEqualToComparingFieldByField with usingRecursiveComparison().isEqualTo

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* isEqualTo()

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* revert ibft and qbft tests back to compareFieldByField

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* revert tests back to compareFieldByField

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TeamRevenant GH issues worked on by Revenant Team testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants