From f58d191e4ec7c8ec38d5f0d4640800e3a25ea1d2 Mon Sep 17 00:00:00 2001 From: Eduard Maximovich Date: Fri, 21 Jun 2019 16:45:07 +0300 Subject: [PATCH] updated bip39 library, updated secp256k1 - fixed NPE after signing, test for leading zero address --- README.md | 2 +- RELEASE.md | 4 ++++ build.gradle | 6 +++++- src/main/cpp/bip39 | 2 +- src/main/cpp/secp256k1 | 2 +- .../minter/core/MinterAddressTest.java | 21 +++++++++++++++++-- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 270ef93..d84624b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ project build.gradle ```groovy ext { - minterSdkVersion = "0.3.2" + minterSdkVersion = "0.4.0" } dependencies { diff --git a/RELEASE.md b/RELEASE.md index a899a1f..b9a4e8e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,9 @@ # Release notes +## 0.4.0 + - Updated BIP39 library + - Updated secp256k1 library - fixed NPE after fail signing + ## 0.3.2 - Fixed RLP encoding for raw bytes contains leading zeroes diff --git a/build.gradle b/build.gradle index 1589339..e71b0de 100644 --- a/build.gradle +++ b/build.gradle @@ -90,7 +90,7 @@ apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' group = 'network.minter.android' -version = '0.3.2' +version = '0.4.0' def libPath = "" if(hasProperty("nativeLibPath")) { @@ -98,6 +98,8 @@ if(hasProperty("nativeLibPath")) { } println "Native lib path: ${libPath}" + + android { compileSdkVersion minterMaxSdk @@ -111,6 +113,7 @@ android { externalNativeBuild { cmake { + arguments '-DWITH_BIP39_TEST=Off', '-DENABLE_GO=Off', '-DENABLE_JNI=On', '-DENABLE_CONAN_BUILD=Off' cppFlags "-std=c++14" } } @@ -202,6 +205,7 @@ android { externalNativeBuild { cmake { path 'src/main/cpp/CMakeLists.txt' + version '3.10.2' } } } diff --git a/src/main/cpp/bip39 b/src/main/cpp/bip39 index d33c51f..d3c633c 160000 --- a/src/main/cpp/bip39 +++ b/src/main/cpp/bip39 @@ -1 +1 @@ -Subproject commit d33c51f5cd9138fe41b079eaf1d331dfb5b0ef21 +Subproject commit d3c633c3e24723ce2e13ef5513552f6d6bccdd74 diff --git a/src/main/cpp/secp256k1 b/src/main/cpp/secp256k1 index 9e53acb..a0753f2 160000 --- a/src/main/cpp/secp256k1 +++ b/src/main/cpp/secp256k1 @@ -1 +1 @@ -Subproject commit 9e53acb840d7f8fbacaf819f6a628f4e82fa7191 +Subproject commit a0753f2449948f59f6cdc58991cd9f86401795cb diff --git a/src/test/java/network/minter/core/MinterAddressTest.java b/src/test/java/network/minter/core/MinterAddressTest.java index c219d58..d3dd6dc 100644 --- a/src/test/java/network/minter/core/MinterAddressTest.java +++ b/src/test/java/network/minter/core/MinterAddressTest.java @@ -31,8 +31,6 @@ import network.minter.core.crypto.MinterAddress; import network.minter.core.crypto.MinterPublicKey; import network.minter.core.crypto.UnsignedBytesData; -import network.minter.core.internal.helpers.BytesHelper; -import network.minter.core.internal.helpers.StringHelper; import network.minter.core.util.DecodeResult; import network.minter.core.util.RLPBoxed; @@ -78,6 +76,25 @@ public void testFirstZeroBytesAddressRLP() { } + @Test + public void testFirstZeroBytesAddressArrayRLP() { + MinterAddress[] addresses = new MinterAddress[]{ + new MinterAddress("Mx00aacae635ad329dc2a3f0509f947065703efc79"), + new MinterAddress("Mx00aacae635ad329dc2a3f0509f947065703efc79"), + }; + + char[] enc = RLPBoxed.encode(new Object[]{addresses}); + DecodeResult res = RLPBoxed.decode(enc, 0); + Object[] dec = (Object[]) res.getDecoded(); + Object[] dec0 = (Object[]) dec[0]; + char[] add1 = (char[]) dec0[0]; + char[] add2 = (char[]) dec0[1]; + + assertEquals(20, add1.length); + assertEquals(20, add2.length); + + } + @Test public void testFirstZeroBytesPubKeyRLP() { MinterPublicKey pk = new MinterPublicKey("Mp009b5528f09d1c74a83d18414f2e4263e14850c47a3fac3f855f200111111111");