From d7a38301ece1a166af7b230e34be6e950e0aeb3c Mon Sep 17 00:00:00 2001 From: cyan Date: Mon, 26 Aug 2024 06:57:16 +0200 Subject: Monero v0.18.3.4 (#38) * updated monero dependency * update patches for v0.18.3.4 * update generate checksum to include version of submodule as well --- impls/monero.dart/lib/src/checksum_monero.dart | 2 +- impls/monero.dart/lib/src/checksum_wownero.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'impls/monero.dart/lib') diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index 9e553f9..364e618 100644 --- a/impls/monero.dart/lib/src/checksum_monero.dart +++ b/impls/monero.dart/lib/src/checksum_monero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad"; -const String wallet2_api_c_cpp_sha256 = "d1842cded0040c16b8886878681c8938005f69ec1378fa9be68a430311cc3666"; +const String wallet2_api_c_cpp_sha256 = "d1842cded0040c16b8886878681c8938005f69ec1378fa9be68a430311cc3666-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const String wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c"; diff --git a/impls/monero.dart/lib/src/checksum_wownero.dart b/impls/monero.dart/lib/src/checksum_wownero.dart index f4ed1e7..5b71c28 100644 --- a/impls/monero.dart/lib/src/checksum_wownero.dart +++ b/impls/monero.dart/lib/src/checksum_wownero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const String wallet2_api_c_cpp_sha256 = "ed400bd9c4709383ffd42a9fbe68be37a2a47a42f92eacaf3a2dbd248c422739"; +const String wallet2_api_c_cpp_sha256 = "ed400bd9c4709383ffd42a9fbe68be37a2a47a42f92eacaf3a2dbd248c422739-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const String wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; -- cgit v1.2.3 From 00a935025e1f405ae84f0618669011b12e6a6514 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Wed, 28 Aug 2024 11:07:35 +0200 Subject: update checksum --- generate_checksum.sh | 2 +- impls/monero.dart/lib/src/checksum_monero.dart | 2 +- impls/monero.dart/lib/src/checksum_wownero.dart | 2 +- monero_libwallet2_api_c/src/main/cpp/monero_checksum.h | 2 +- wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'impls/monero.dart/lib') diff --git a/generate_checksum.sh b/generate_checksum.sh index 7fcca70..5847ff5 100755 --- a/generate_checksum.sh +++ b/generate_checksum.sh @@ -1,6 +1,6 @@ #!/bin/bash cd "$(realpath $(dirname $0))" - +function sha256sum() { shasum -a 256 "$@" ; } && export -f sha256sum for coin in monero wownero; do submodule_hash=$(git ls-tree HEAD ${coin} | xargs | awk '{ print $3 }') diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index 364e618..4ab72a3 100644 --- a/impls/monero.dart/lib/src/checksum_monero.dart +++ b/impls/monero.dart/lib/src/checksum_monero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad"; -const String wallet2_api_c_cpp_sha256 = "d1842cded0040c16b8886878681c8938005f69ec1378fa9be68a430311cc3666-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; +const String wallet2_api_c_cpp_sha256 = "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const String wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c"; diff --git a/impls/monero.dart/lib/src/checksum_wownero.dart b/impls/monero.dart/lib/src/checksum_wownero.dart index 5b71c28..8d08889 100644 --- a/impls/monero.dart/lib/src/checksum_wownero.dart +++ b/impls/monero.dart/lib/src/checksum_wownero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const String wallet2_api_c_cpp_sha256 = "ed400bd9c4709383ffd42a9fbe68be37a2a47a42f92eacaf3a2dbd248c422739-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; +const String wallet2_api_c_cpp_sha256 = "28e4d44c565cd7d97d3f18cdd322be48f89dc9fded82fb533af56a8eaa4e0bda-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const String wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h index f07cafe..20cbeae 100644 --- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h +++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS const char * MONERO_wallet2_api_c_h_sha256 = "e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad"; -const char * MONERO_wallet2_api_c_cpp_sha256 = "d1842cded0040c16b8886878681c8938005f69ec1378fa9be68a430311cc3666-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; +const char * MONERO_wallet2_api_c_cpp_sha256 = "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const char * MONERO_wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c"; #endif diff --git a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h index 9a6f552..b7ff10c 100644 --- a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h +++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS const char * WOWNERO_wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const char * WOWNERO_wallet2_api_c_cpp_sha256 = "ed400bd9c4709383ffd42a9fbe68be37a2a47a42f92eacaf3a2dbd248c422739-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; +const char * WOWNERO_wallet2_api_c_cpp_sha256 = "28e4d44c565cd7d97d3f18cdd322be48f89dc9fded82fb533af56a8eaa4e0bda-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const char * WOWNERO_wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; #endif -- cgit v1.2.3 From 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Wed, 28 Aug 2024 11:08:19 +0200 Subject: std::set -> std::vector --- impls/monero.dart/lib/src/checksum_wownero.dart | 2 +- wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp | 2 +- wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'impls/monero.dart/lib') diff --git a/impls/monero.dart/lib/src/checksum_wownero.dart b/impls/monero.dart/lib/src/checksum_wownero.dart index 8d08889..7d501c6 100644 --- a/impls/monero.dart/lib/src/checksum_wownero.dart +++ b/impls/monero.dart/lib/src/checksum_wownero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const String wallet2_api_c_cpp_sha256 = "28e4d44c565cd7d97d3f18cdd322be48f89dc9fded82fb533af56a8eaa4e0bda-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; +const String wallet2_api_c_cpp_sha256 = "07d67f34a07869aaa4af6ca04e142dbad2fb1fba0e2ebdefd22bc333fd982e25-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const String wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; diff --git a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 2347496..19a14ba 100644 --- a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -1252,7 +1252,7 @@ void* WOWNERO_Wallet_createTransactionMultDest(void* wallet_ptr, const char* dst uint32_t subaddr_account, const char* preferredInputs, const char* preferredInputs_separator) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - std::set dst_addr = splitStringVector(std::string(dst_addr_list), std::string(dst_addr_list_separator)); + std::vector dst_addr = splitStringVector(std::string(dst_addr_list), std::string(dst_addr_list_separator)); Monero::optional> optAmount; if (!amount_sweep_all) { diff --git a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h index b7ff10c..40723cc 100644 --- a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h +++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS const char * WOWNERO_wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const char * WOWNERO_wallet2_api_c_cpp_sha256 = "28e4d44c565cd7d97d3f18cdd322be48f89dc9fded82fb533af56a8eaa4e0bda-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; +const char * WOWNERO_wallet2_api_c_cpp_sha256 = "07d67f34a07869aaa4af6ca04e142dbad2fb1fba0e2ebdefd22bc333fd982e25-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const char * WOWNERO_wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; #endif -- cgit v1.2.3 From 1e22390f512f97c89b6b4c75da4958c16316da22 Mon Sep 17 00:00:00 2001 From: cyan Date: Wed, 4 Sep 2024 14:57:12 +0200 Subject: fix find wallets (#46) * Update WalletManager_findWallets * prevent crash when there are no wallets found * return List instead of colon separated String --- impls/monero.dart/lib/monero.dart | 11 +++++++---- impls/monero.dart/lib/wownero.dart | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'impls/monero.dart/lib') diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index b30bd3f..997f1b6 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -3585,7 +3585,8 @@ bool WalletManager_verifyWalletPassword( return s; } -String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { +List WalletManager_findWallets(WalletManager wm_ptr, + {required String path}) { debugStart?.call('MONERO_WalletManager_findWallets'); lib ??= MoneroC(DynamicLibrary.open(libPath)); try { @@ -3595,13 +3596,15 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { .cast(); final str = strPtr.toDartString(); calloc.free(path_); - MONERO_free(strPtr.cast()); + if (str.isNotEmpty) { + MONERO_free(strPtr.cast()); + } debugEnd?.call('MONERO_WalletManager_findWallets'); - return str; + return str.split(";"); } catch (e) { errorHandler?.call('MONERO_WalletManager_findWallets', e); debugEnd?.call('MONERO_WalletManager_findWallets'); - return ""; + return []; } } diff --git a/impls/monero.dart/lib/wownero.dart b/impls/monero.dart/lib/wownero.dart index 5a0a288..e87488c 100644 --- a/impls/monero.dart/lib/wownero.dart +++ b/impls/monero.dart/lib/wownero.dart @@ -3220,7 +3220,8 @@ bool WalletManager_verifyWalletPassword( return s; } -String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { +List WalletManager_findWallets(WalletManager wm_ptr, + {required String path}) { debugStart?.call('WOWNERO_WalletManager_findWallets'); lib ??= WowneroC(DynamicLibrary.open(libPath)); try { @@ -3230,13 +3231,15 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { .cast(); final str = strPtr.toDartString(); calloc.free(path_); - WOWNERO_free(strPtr.cast()); + if (str.isNotEmpty) { + WOWNERO_free(strPtr.cast()); + } debugEnd?.call('WOWNERO_WalletManager_findWallets'); - return str; + return str.split(";"); } catch (e) { errorHandler?.call('WOWNERO_WalletManager_findWallets', e); debugEnd?.call('WOWNERO_WalletManager_findWallets'); - return ""; + return []; } } @@ -3606,7 +3609,6 @@ int WOWNERO_deprecated_14WordSeedHeight({ return s; } - String WOWNERO_checksum_wallet2_api_c_h() { debugStart?.call('WOWNERO_checksum_wallet2_api_c_h'); lib ??= WowneroC(DynamicLibrary.open(libPath)); -- cgit v1.2.3 From 4f844740bced43b5653d3152717f8b1e10b13293 Mon Sep 17 00:00:00 2001 From: cyan Date: Sun, 8 Sep 2024 17:52:09 +0200 Subject: use less memory for debugCallLength Map (#48) * use less memory for debugCallLength Map * ignore errors in default debug functions --- impls/monero.dart/lib/monero.dart | 34 ++++++++++++++++++++++++++++------ impls/monero.dart/lib/wownero.dart | 34 ++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 12 deletions(-) (limited to 'impls/monero.dart/lib') diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index 997f1b6..4fcc970 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -101,14 +101,36 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= []; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= []; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; +void debugChores() { + for (var key in debugCallLength.keys) { + if (debugCallLength[key]!.length > 1000000) { + final elm = + debugCallLength[key]!.reduce((value, element) => value + element); + debugCallLength[key]!.clear(); + debugCallLength["${key}_1M"] ??= []; + debugCallLength["${key}_1M"]!.add(elm); + } + } +} + +int debugCount = 0; + void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); diff --git a/impls/monero.dart/lib/wownero.dart b/impls/monero.dart/lib/wownero.dart index e87488c..d355005 100644 --- a/impls/monero.dart/lib/wownero.dart +++ b/impls/monero.dart/lib/wownero.dart @@ -101,14 +101,36 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= []; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= []; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; +void debugChores() { + for (var key in debugCallLength.keys) { + if (debugCallLength[key]!.length > 1000000) { + final elm = + debugCallLength[key]!.reduce((value, element) => value + element); + debugCallLength[key]!.clear(); + debugCallLength["${key}_1M"] ??= []; + debugCallLength["${key}_1M"]!.add(elm); + } + } +} + +int debugCount = 0; + void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); -- cgit v1.2.3