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

Bump snapshot version 4.11.4 #2049

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [4.11.3]() (Upcoming)
# [4.11.4]() (Upcoming)

### Bug Fixes

*

### Features

* bump snapshot version to 4.11.4 [#2049](https://github.com/web3j/web3j/pull/2049)

### BREAKING CHANGES

*

# [4.11.3](https://github.com/hyperledger/web3j/releases/tag/v4.11.3) (2024-05-01)

### Bug Fixes

Expand Down
10 changes: 6 additions & 4 deletions abi/src/main/java/org/web3j/abi/TypeEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ public static String encode(Type parameter) {
*/
public static String encodePacked(Type parameter) {
if (parameter instanceof Utf8String) {
//removePadding can also be used, but is not necessary
return Numeric.toHexStringNoPrefix(((Utf8String) parameter).getValue().getBytes(StandardCharsets.UTF_8));
// removePadding can also be used, but is not necessary
return Numeric.toHexStringNoPrefix(
((Utf8String) parameter).getValue().getBytes(StandardCharsets.UTF_8));
} else if (parameter instanceof DynamicBytes) {
//removePadding can also be used, but is not necessary
// removePadding can also be used, but is not necessary
return Numeric.toHexStringNoPrefix(((DynamicBytes) parameter).getValue());
} else if (parameter instanceof DynamicArray) {
return arrayEncodePacked((DynamicArray) parameter);
Expand Down Expand Up @@ -144,7 +145,8 @@ static String removePadding(String encodedValue, Type parameter) {
return encodedValue.substring(64, 64 + length * 2);
}
if (parameter instanceof DynamicBytes) {
return encodedValue.substring(64, 64 + ((DynamicBytes) parameter).getValue().length * 2);
return encodedValue.substring(
64, 64 + ((DynamicBytes) parameter).getValue().length * 2);
} else {
throw new UnsupportedOperationException(
"Type cannot be encoded: " + parameter.getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ public void testEncodeConstructorPacked_multipleParameters() {
Arrays.asList(
new Uint32(BigInteger.valueOf(69)),
new Bool(true),
new DynamicBytes((new byte[]{0, 1, 2, 3, 4, 5})))));
new DynamicBytes((new byte[] {0, 1, 2, 3, 4, 5})))));
assertEquals(
"12000102030405",
FunctionEncoder.encodeConstructorPacked(
Arrays.asList(
new DynamicBytes(Numeric.hexStringToByteArray("0x12")),
new DynamicBytes((new byte[]{0, 1, 2, 3, 4, 5})))));
new DynamicBytes((new byte[] {0, 1, 2, 3, 4, 5})))));
}

@Test
Expand Down
16 changes: 4 additions & 12 deletions abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -904,24 +904,16 @@ public void testStaticArrayEncodePacked() {
@Test
public void testDynamicBytesEncodePacked() {
DynamicBytes dynamicBytes = new DynamicBytes(new byte[] {0, 1, 2, 3, 4, 5});
assertEquals(
"000102030405",
TypeEncoder.encodePacked(dynamicBytes));
assertEquals("000102030405", TypeEncoder.encodePacked(dynamicBytes));

DynamicBytes zero = new DynamicBytes(new byte[] {0});
assertEquals(
"00",
TypeEncoder.encodePacked(zero));
assertEquals("00", TypeEncoder.encodePacked(zero));

DynamicBytes empty = new DynamicBytes(new byte[] {});
assertEquals(
"",
TypeEncoder.encodePacked(empty));
assertEquals("", TypeEncoder.encodePacked(empty));

DynamicBytes dave = new DynamicBytes("dave".getBytes());
assertEquals(
"64617665",
TypeEncoder.encodePacked(dave));
assertEquals("64617665", TypeEncoder.encodePacked(dave));

DynamicBytes loremIpsum =
new DynamicBytes(
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ext {
// test dependencies
equalsverifierVersion = '3.14.1'
junitVersion = '5.5.2'
web3jUnitVersion = '4.11.2'
web3jUnitVersion = '4.11.3'
junitBenchmarkVersion = '0.7.2'
logbackVersion = '1.4.14'
mockitoJunitVersion = '3.1.0'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=org.web3j
version=4.11.3-SNAPSHOT
version=4.11.4-SNAPSHOT
Loading