From 5afe90e4b1a860ed14f13751c6660d4027e58396 Mon Sep 17 00:00:00 2001 From: gtebrean <99179176+gtebrean@users.noreply.github.com> Date: Fri, 12 Apr 2024 01:05:51 +0300 Subject: [PATCH 01/12] update signature Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com> --- gradle/publish/build.gradle | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gradle/publish/build.gradle b/gradle/publish/build.gradle index 9426ed6fd..597f08b3e 100644 --- a/gradle/publish/build.gradle +++ b/gradle/publish/build.gradle @@ -83,8 +83,7 @@ nexusStaging { signing { sign publishing.publications.maven - def signingKey = new File("$rootDir/web3j.asc") - if (signingKey.exists()) { - useInMemoryPgpKeys(signingKey.getText('UTF-8'), System.getenv('GPG_PASSPHRASE')) - } -} \ No newline at end of file + def gpgSecretKey = System.getenv('OSSRH_GPG_SECRET_KEY') + def password = System.getenv('OSSRH_GPG_SECRET_KEY_PASSWORD') + useInMemoryPgpKeys(gpgSecretKey, password) +} From a2e685000a39654b2a3e291ac44f0fddac059218 Mon Sep 17 00:00:00 2001 From: gtebrean <99179176+gtebrean@users.noreply.github.com> Date: Fri, 12 Apr 2024 01:07:33 +0300 Subject: [PATCH 02/12] update changelog Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 354ebcde9..1413f9eb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * Fix for test wrappers generation [#2025](https://github.com/web3j/web3j/pull/2025) * Fix Snapshot release secrets [#2031](https://github.com/hyperledger/web3j/pull/2031) +* Fix Sign method [#2033](https://github.com/hyperledger/web3j/pull/2033) ### Features From 1e896e957829561354414cac7d8d96b0d6c57231 Mon Sep 17 00:00:00 2001 From: gtebrean <99179176+gtebrean@users.noreply.github.com> Date: Fri, 12 Apr 2024 01:42:40 +0300 Subject: [PATCH 03/12] revert changes Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com> --- .github/workflows/publish-snapshot.yml | 7 ++++--- gradle/publish/build.gradle | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index c272fdc90..d70bf14b0 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -12,9 +12,8 @@ jobs: runs-on: ubuntu-latest env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} - OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 @@ -30,6 +29,8 @@ jobs: restore-keys: ${{ runner.os }}-gradle - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Decrypt secret key + run: openssl aes-256-cbc -K ${{ secrets.GPG_KEY }} -iv ${{ secrets.GPG_IV }} -in web3j.asc.enc -out web3j.asc -d - name: Publish snapshot run: ./gradlew publish diff --git a/gradle/publish/build.gradle b/gradle/publish/build.gradle index 597f08b3e..9426ed6fd 100644 --- a/gradle/publish/build.gradle +++ b/gradle/publish/build.gradle @@ -83,7 +83,8 @@ nexusStaging { signing { sign publishing.publications.maven - def gpgSecretKey = System.getenv('OSSRH_GPG_SECRET_KEY') - def password = System.getenv('OSSRH_GPG_SECRET_KEY_PASSWORD') - useInMemoryPgpKeys(gpgSecretKey, password) -} + def signingKey = new File("$rootDir/web3j.asc") + if (signingKey.exists()) { + useInMemoryPgpKeys(signingKey.getText('UTF-8'), System.getenv('GPG_PASSPHRASE')) + } +} \ No newline at end of file From 1c875904040b59f494112aa10cdab7a09f19a7b7 Mon Sep 17 00:00:00 2001 From: gtebrean <99179176+gtebrean@users.noreply.github.com> Date: Fri, 12 Apr 2024 01:44:54 +0300 Subject: [PATCH 04/12] update changelog Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1413f9eb5..f399c4035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * Fix for test wrappers generation [#2025](https://github.com/web3j/web3j/pull/2025) * Fix Snapshot release secrets [#2031](https://github.com/hyperledger/web3j/pull/2031) * Fix Sign method [#2033](https://github.com/hyperledger/web3j/pull/2033) +* Revert 2031 and 2033 [#2034](https://github.com/hyperledger/web3j/pull/2034) ### Features From 4e2fcfcd7bbfc4c8e100266062dad60c5f20730b Mon Sep 17 00:00:00 2001 From: gtebrean <99179176+gtebrean@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:02:10 +0300 Subject: [PATCH 05/12] update secrets Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com> --- .github/workflows/publish-snapshot.yml | 7 +++---- gradle/publish/build.gradle | 13 ++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index d70bf14b0..94fd4536b 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -11,9 +11,10 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_USERNAME: ${{ secrets.OSSRH_WEB3_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 @@ -29,8 +30,6 @@ jobs: restore-keys: ${{ runner.os }}-gradle - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Decrypt secret key - run: openssl aes-256-cbc -K ${{ secrets.GPG_KEY }} -iv ${{ secrets.GPG_IV }} -in web3j.asc.enc -out web3j.asc -d - name: Publish snapshot run: ./gradlew publish diff --git a/gradle/publish/build.gradle b/gradle/publish/build.gradle index 9426ed6fd..caa229dfc 100644 --- a/gradle/publish/build.gradle +++ b/gradle/publish/build.gradle @@ -48,9 +48,9 @@ publishing { slug = project.rootProjectOverride } - url = "https://github.com/web3j/$slug" - connection = "scm:https://github.com/web3j/${slug}.git" - developerConnection = "scm:git://github.com/web3j/${slug}.git" + url = "https://github.com/hyperledger/$slug" + connection = "scm:https://github.com/hyperledger/${slug}.git" + developerConnection = "scm:git://github.com/hyperledger/${slug}.git" } developers { @@ -83,8 +83,7 @@ nexusStaging { signing { sign publishing.publications.maven - def signingKey = new File("$rootDir/web3j.asc") - if (signingKey.exists()) { - useInMemoryPgpKeys(signingKey.getText('UTF-8'), System.getenv('GPG_PASSPHRASE')) - } + def gpgSecretKey = System.getenv('OSSRH_GPG_SECRET_KEY') + def password = System.getenv('OSSRH_GPG_SECRET_KEY_PASSWORD') + useInMemoryPgpKeys(gpgSecretKey, password) } \ No newline at end of file From fc4d8afbfc47524d4a2c05c4474950bc05eca250 Mon Sep 17 00:00:00 2001 From: Nischal Sharma Date: Thu, 11 Apr 2024 11:55:33 +0530 Subject: [PATCH 06/12] main branch configs Signed-off-by: Nischal Sharma --- .github/CODEOWNERS | 2 +- .github/workflows/codeql.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fcd531c15..e72f50dd2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @conor10 @iikirilov \ No newline at end of file +* @conor10 @gtebrean @NickSneo \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7deaa35da..e6d542258 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,10 +2,10 @@ name: "CodeQL" on: push: - branches: [ 'master' ] + branches: [ 'main' ] pull_request: # The branches below must be a subset of the branches above - branches: [ 'master' ] + branches: [ 'main' ] schedule: - cron: '35 2 * * 3' From 309aa359862f1de39a8c43b1353c59f949e12852 Mon Sep 17 00:00:00 2001 From: Nischal Sharma Date: Thu, 11 Apr 2024 11:59:16 +0530 Subject: [PATCH 07/12] changelog entry Signed-off-by: Nischal Sharma --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f399c4035..b32de7ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ### BREAKING CHANGES -* +* Rename default master branch to main. [#2029](https://github.com/hyperledger/web3j/pull/2029) # [4.11.2](https://github.com/web3j/web3j/releases/tag/v4.11.2) (2024-03-27) From e91f690ff3a56a25ec4af3469219222c266252cd Mon Sep 17 00:00:00 2001 From: Nischal Sharma Date: Fri, 12 Apr 2024 13:59:52 +0530 Subject: [PATCH 08/12] web3j release fix Signed-off-by: Nischal Sharma --- .github/workflows/publish-snapshot.yml | 2 +- .github/workflows/release.yml | 7 +++---- .gitignore | 2 -- web3j.asc.enc | Bin 5216 -> 0 bytes 4 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 web3j.asc.enc diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 94fd4536b..af3ad35c2 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -11,7 +11,7 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest env: - OSSRH_USERNAME: ${{ secrets.OSSRH_WEB3_USERNAME }} + OSSRH_USERNAME: ${{ secrets.OSSRH_WEB3J_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e25449ed4..cab5e70b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,10 @@ jobs: release: runs-on: ubuntu-latest env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_USERNAME: ${{ secrets.OSSRH_WEB3J_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 @@ -36,8 +37,6 @@ jobs: restore-keys: ${{ runner.os }}-gradle - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Decrypt secret key - run: openssl aes-256-cbc -K ${{ secrets.GPG_KEY }} -iv ${{ secrets.GPG_IV }} -in web3j.asc.enc -out web3j.asc -d - name: Release name id: release_name uses: actions/github-script@v4 diff --git a/.gitignore b/.gitignore index 2f1e27ce7..84a0e8221 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,5 @@ docs/build **/.settings **/bin -web3j.asc - # Besu-dev-quickstart logs integration-tests/src/test/resources/quorum-test-network/logs \ No newline at end of file diff --git a/web3j.asc.enc b/web3j.asc.enc deleted file mode 100644 index 2bc247e7a009775411c50611430269d8530d1f4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5216 zcmV-m6rbzx|4<0T`3LDzB>fwsZSWP5EM;US?1c!EXci|jok(aK%vtC-5s*jR4^dh3 zK$hKOX_n1dGkzbc!HSNLreqt0|ADh z1FfYG+)n8Q2|TBFf>HuAuBavmJOO50Mx8s{9oGDPq%)-KTGpIvB$ ztJU7SogiTuigfbzFL{RcWm8=IMxMXW!b`S1BrzUFqxmhNNW)`^!zC^#9J?)e>;|?` z((?ocT`bsln62}J>h@jftCA%`!@)Y#U5*Z^_VCr}hYivMEjr1oT5jX|l=2bZA@$?N zCii^7OeA)MhPA@Cs3)gv_|HEbaaL!iY9`pbaeXQ6^tUIwsbue-&CZ*=uZQNigbW#5 zu|GgF7G-_uxo$_$G)*02Y!>*+&non)XvSg+;aZLa%>$RCDJ=3ET-){xaq3a_j|>^F_*`erFgS# zH4Zi=Kt!{tpZ{B4yQ6~TDa#%y*#i>V%qR#Bq^$xiPSLK19VM3^k8qQ014d`Faa3|1 ze)keaKj1+&rCw79x3EH40QTNt(X{H-l>OCpJEtyiHSawJW#7z&igF4p3p zZ4{Q&8A!+)8|2arF)_noESu`Ir+yIOe^mTt6rPyAcG(T9qT!8Tz zMq+q^1V&}dPZ)fPgQw8&%_6Oq=On@t>!;D$1?rDpOo z8t`Q+ssM2SukvU?ai+Nbr;Y>*)=x_;o#lbQgHa9exfr7(<>JKd)8|;0_b7m& zyEW#O6jXTxVSH8jr<1{kDC{k!gU){&HFg;BQM;J5<|sG{NNIdy&|!k8+Nn*M_mP9s z^hd*(v}(&$zdG7t#qu2Ot^l*g4hP7CWoAnux-X>)LpnzzNu*kCV{d+i%I&{i%dXQ@ z@`@RDx@~HEx?=h8#*hh9DRQ+FfT>>gtbJ2oCeakVIwpAAa#rp{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[PATCH 09/12] web3j release fix Signed-off-by: Nischal Sharma --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b32de7ad3..95f634ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * Fix Snapshot release secrets [#2031](https://github.com/hyperledger/web3j/pull/2031) * Fix Sign method [#2033](https://github.com/hyperledger/web3j/pull/2033) * Revert 2031 and 2033 [#2034](https://github.com/hyperledger/web3j/pull/2034) +* Web3j release fix [2037](https://github.com/hyperledger/web3j/pull/2037) ### Features From 20882df345d418699a17649c0d0b5ed286087073 Mon Sep 17 00:00:00 2001 From: hamburger <1210062377@qq.com> Date: Thu, 18 Apr 2024 21:50:14 +0800 Subject: [PATCH 10/12] encodePacked DynamicBytes Signed-off-by: hamburger <1210062377@qq.com> --- abi/src/main/java/org/web3j/abi/TypeEncoder.java | 2 +- .../org/web3j/abi/DefaultFunctionEncoderTest.java | 14 ++++++++++++++ .../java/org/web3j/abi/TypeEncoderPackedTest.java | 15 ++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/abi/src/main/java/org/web3j/abi/TypeEncoder.java b/abi/src/main/java/org/web3j/abi/TypeEncoder.java index d3fac932c..959921f89 100644 --- a/abi/src/main/java/org/web3j/abi/TypeEncoder.java +++ b/abi/src/main/java/org/web3j/abi/TypeEncoder.java @@ -103,7 +103,7 @@ public static String encodePacked(Type parameter) { if (parameter instanceof Utf8String) { return removePadding(encode(parameter), parameter); } else if (parameter instanceof DynamicBytes) { - return encode(parameter).substring(64); + return Numeric.toHexStringNoPrefix(((DynamicBytes) parameter).getValue()); } else if (parameter instanceof DynamicArray) { return arrayEncodePacked((DynamicArray) parameter); } else if (parameter instanceof StaticArray) { diff --git a/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java b/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java index 4f43f7e7a..f676ba747 100644 --- a/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java +++ b/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java @@ -33,6 +33,7 @@ import org.web3j.abi.datatypes.generated.Bytes10; import org.web3j.abi.datatypes.generated.Uint256; import org.web3j.abi.datatypes.generated.Uint32; +import org.web3j.utils.Numeric; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -151,6 +152,19 @@ public void testEncodeConstructorPacked_multipleParameters() { new Address("0x663e27AdC18d862dA9A82f060310621D379e469a"), new Uint256(BigInteger.TEN), new Bytes10("1234567890".getBytes())))); + assertEquals( + "0000004501000102030405", + FunctionEncoder.encodeConstructorPacked( + Arrays.asList( + new Uint32(BigInteger.valueOf(69)), + new Bool(true), + 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}))))); } @Test diff --git a/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java b/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java index a2edf5416..2184ebbbe 100644 --- a/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java +++ b/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java @@ -905,17 +905,22 @@ public void testStaticArrayEncodePacked() { public void testDynamicBytesEncodePacked() { DynamicBytes dynamicBytes = new DynamicBytes(new byte[] {0, 1, 2, 3, 4, 5}); assertEquals( - "0001020304050000000000000000000000000000000000000000000000000000", + "000102030405", TypeEncoder.encodePacked(dynamicBytes)); - DynamicBytes empty = new DynamicBytes(new byte[] {0}); + DynamicBytes zero = new DynamicBytes(new byte[] {0}); assertEquals( - "0000000000000000000000000000000000000000000000000000000000000000", + "00", + TypeEncoder.encodePacked(zero)); + + DynamicBytes empty = new DynamicBytes(new byte[] {}); + assertEquals( + "", TypeEncoder.encodePacked(empty)); DynamicBytes dave = new DynamicBytes("dave".getBytes()); assertEquals( - "6461766500000000000000000000000000000000000000000000000000000000", + "64617665", TypeEncoder.encodePacked(dave)); DynamicBytes loremIpsum = @@ -942,7 +947,7 @@ public void testDynamicBytesEncodePacked() { + "756c6c612070617269617475722e204578636570746575722073696e74206f63" + "63616563617420637570696461746174206e6f6e2070726f6964656e742c2073" + "756e7420696e2063756c706120717569206f666669636961206465736572756e" - + "74206d6f6c6c697420616e696d20696420657374206c61626f72756d2e000000"), + + "74206d6f6c6c697420616e696d20696420657374206c61626f72756d2e"), TypeEncoder.encodePacked(loremIpsum)); } From 7f999b6c23c4edf4e031e8021c7d4cc0d675db76 Mon Sep 17 00:00:00 2001 From: hamburger <1210062377@qq.com> Date: Mon, 22 Apr 2024 17:29:26 +0800 Subject: [PATCH 11/12] add changelog for fix encodePacked DynamicBytes Signed-off-by: hamburger <1210062377@qq.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f634ec6..e3e40bbc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * Fix Sign method [#2033](https://github.com/hyperledger/web3j/pull/2033) * Revert 2031 and 2033 [#2034](https://github.com/hyperledger/web3j/pull/2034) * Web3j release fix [2037](https://github.com/hyperledger/web3j/pull/2037) +* Fix encodePacked DynamicBytes [2042](https://github.com/hyperledger/web3j/pull/2042) ### Features From b1ad81b6ad657adeb12ebd0d1dbdf875e0b9e9b4 Mon Sep 17 00:00:00 2001 From: hamburger <1210062377@qq.com> Date: Wed, 24 Apr 2024 02:17:51 +0800 Subject: [PATCH 12/12] modify encodePacked Utf8String Signed-off-by: hamburger <1210062377@qq.com> --- abi/src/main/java/org/web3j/abi/TypeEncoder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/abi/src/main/java/org/web3j/abi/TypeEncoder.java b/abi/src/main/java/org/web3j/abi/TypeEncoder.java index 959921f89..c0fbe1bc4 100644 --- a/abi/src/main/java/org/web3j/abi/TypeEncoder.java +++ b/abi/src/main/java/org/web3j/abi/TypeEncoder.java @@ -101,8 +101,10 @@ public static String encode(Type parameter) { */ public static String encodePacked(Type parameter) { if (parameter instanceof Utf8String) { - return removePadding(encode(parameter), parameter); + //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 return Numeric.toHexStringNoPrefix(((DynamicBytes) parameter).getValue()); } else if (parameter instanceof DynamicArray) { return arrayEncodePacked((DynamicArray) parameter); @@ -140,6 +142,9 @@ static String removePadding(String encodedValue, Type parameter) { int length = ((Utf8String) parameter).getValue().getBytes(StandardCharsets.UTF_8).length; return encodedValue.substring(64, 64 + length * 2); + } + if (parameter instanceof DynamicBytes) { + return encodedValue.substring(64, 64 + ((DynamicBytes) parameter).getValue().length * 2); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass());