Changes to io project to accomodate bytes v2#53
Changes to io project to accomodate bytes v2#53lu-pinto wants to merge 4 commits intoConsensys:mainfrom
Conversation
This is a collapsed view of the previous old commits: * 0929d61 Merge remote-tracking branch 'upstream/main' into flatten-Bytes-class-hierarchy * | 6d79491 Miscelaneous fixes * | a4def2a Fix memleak in Hash and bug in devp2p Packet creation * | 10e6e81 fix bug in and/or/xor operations with UInt256/UInt384 * | 578e6bb Move bound checks for Bytes implementation out of constructors * | b9c6b05 Merge branch 'main' into flatten-Bytes-class-hierarchy * 4100d8b review feedback * afba2b9 change megamorphic benchmarks to slice and optimize size() * b2066fc JMH integration fixes * e40d796 remove InterfaceCall and VirtualCall benchmarks * dff599a fix ConnectTwoServersTest - missed package changes and port bindings * 5aba562 add missing package-info.java files * 1c641ff fix failure in DefaultDiscoveryV5ServiceTest about reusing ports * 279acd6 bring in old tuweni v1 after move * ace7910 move all other touched files to org.apache.tuweni.v2 package * 65f217b mv org.apache.tuweni.bytes.v2 to org.apache.tuweni.v2.bytes * ebaa8bd Implement Tuweni v2 Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
This is for easy reviewing by making the PR much shorter. Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
| @Override | ||
| public void appendTo(ByteBuffer byteBuffer) { | ||
| byteBuffer.put(this.byteBuffer); | ||
| } |
There was a problem hiding this comment.
Bug: appendTo(ByteBuffer) ignores offset in ByteBufferWrappingBytes
The appendTo(ByteBuffer) method ignores the offset field entirely. Unlike BufferWrappingBytes and ByteBufWrappingBytes which pre-slice their underlying buffers in the constructor, ByteBufferWrappingBytes stores the offset separately and must use it in all operations. Every other method in this class (get, getInt, getLong, slice, mutableCopy, toArray, and, or, xor, equals, computeHashcode) correctly uses this.offset, but appendTo just calls byteBuffer.put(this.byteBuffer) which will transfer bytes from the wrong position when the instance was created with a non-zero offset.
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
|
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
PR description
Changes to project
ioto accomodate bytes v2.NOTE: this PR has a dependency on #40 and amount of files changed will decrease once that PR goes in.
Note
Introduce v2 bytes library and io codecs, add JMH benchmarks, and enable JMH in build.
org.apache.tuweni.v2.bytesAPI (Bytes,MutableBytes,Bytes32,Bytes48, wrappers forByteBuffer/ByteBuf/Buffer,ConcatenatedBytes, etc.).org.apache.tuweni.v2.iocodecs:Base32,Base58(+Base58Codec),Base64,Base64URLSafeusing v2Bytes.bytes/src/jmh/...).src/jmhexists; add async-profiler options and annotation processor.assertj-corefor tests.Written by Cursor Bugbot for commit 2d27030. This will update automatically on new commits. Configure here.