Skip to content

Commit

Permalink
Merge branch 'master' into integration-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Beast authored Nov 20, 2024
2 parents 5d5079f + d72c15f commit 0e888c1
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 717 deletions.
1 change: 0 additions & 1 deletion .github/workflows/full_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ jobs:
with:
name: ios ${{ matrix.coin }}
path: release/${{ matrix.coin }}

bulk_lib_release:
name: create single release file
runs-on: ubuntu-latest
Expand Down
827 changes: 159 additions & 668 deletions LICENSE

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions external/ios/build_boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ if [ -d "$BOOST_DIR_PATH" ]; then
echo "Boost directory already exists."
else
echo "Cloning Boost from $BOOST_URL"
mkdir -p $BOOST_DIR_PATH || true
rm -rf $BOOST_DIR_PATH || true
cp -r "${MONEROC_DIR}/external/Apple-Boost-BuildScript" $BOOST_DIR_PATH
mkdir -p "$BOOST_DIR_PATH" || true
rm -rf "$BOOST_DIR_PATH" || true
cp -r "${MONEROC_DIR}/external/Apple-Boost-BuildScript" "$BOOST_DIR_PATH"
fi
cd $BOOST_DIR_PATH
cd "$BOOST_DIR_PATH"

./boost.sh -ios \
--min-ios-version ${MIN_IOS_VERSION} \
--boost-libs "${BOOST_LIBS}" \
--boost-version ${BOOST_VERSION} \
--no-framework

mv -f ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv -f ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/lib/* $EXTERNAL_IOS_LIB_DIR
cp -r "${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}"/ios/release/prefix/include/boost "$EXTERNAL_IOS_INCLUDE_DIR/boost"
cp -r "${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}"/ios/release/prefix/lib/* "$EXTERNAL_IOS_LIB_DIR/"
10 changes: 5 additions & 5 deletions external/ios/build_openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ if [ -d "$OPEN_SSL_DIR_PATH" ]; then
else
mkdir -p "$OPEN_SSL_DIR_PATH" || true
rm -rf "$OPEN_SSL_DIR_PATH"
cp -r "${MONEROC_DIR}/external/OpenSSL-for-iPhone" $OPEN_SSL_DIR_PATH
cp -r "${MONEROC_DIR}/external/OpenSSL-for-iPhone" "$OPEN_SSL_DIR_PATH"
fi
cd $OPEN_SSL_DIR_PATH
cd "$OPEN_SSL_DIR_PATH"

./build-libssl.sh --version=1.1.1q --targets="ios-cross-arm64" --deprecated


mv -f ${OPEN_SSL_DIR_PATH}/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv -f ${OPEN_SSL_DIR_PATH}/lib/libcrypto-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libcrypto.a
mv -f ${OPEN_SSL_DIR_PATH}/lib/libssl-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libssl.a
cp -r "${OPEN_SSL_DIR_PATH}"/include/* "$EXTERNAL_IOS_INCLUDE_DIR/"
cp "${OPEN_SSL_DIR_PATH}"/lib/libcrypto-iOS.a "${EXTERNAL_IOS_LIB_DIR}"/libcrypto.a
cp "${OPEN_SSL_DIR_PATH}"/lib/libssl-iOS.a "${EXTERNAL_IOS_LIB_DIR}"/libssl.a
12 changes: 6 additions & 6 deletions external/ios/build_sodium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ if [ -d "$SODIUM_PATH" ]; then
echo "Sodium directory already exists."
else
echo "Cloning Sodium from $SODIUM_URL"
mkdir -p $SODIUM_PATH || true
rm -rf $SODIUM_PATH
cp -r "${MONEROC_DIR}/external/libsodium" $SODIUM_PATH
mkdir -p "$SODIUM_PATH" || true
rm -rf "$SODIUM_PATH"
cp -r "${MONEROC_DIR}/external/libsodium" "$SODIUM_PATH"
fi

cd $SODIUM_PATH
cd "$SODIUM_PATH"
../../../../libsodium_apple-ios.sh

mv -f ${SODIUM_PATH}/libsodium-apple/ios/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv -f ${SODIUM_PATH}/libsodium-apple/ios/lib/* $EXTERNAL_IOS_LIB_DIR
cp -r "${SODIUM_PATH}"/libsodium-apple/ios/include/* "$EXTERNAL_IOS_INCLUDE_DIR/"
cp -r "${SODIUM_PATH}"/libsodium-apple/ios/lib/* "$EXTERNAL_IOS_LIB_DIR/"
18 changes: 18 additions & 0 deletions impls/monero.dart/lib/monero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3607,6 +3607,24 @@ bool WalletManager_verifyWalletPassword(
return s;
}

int WalletManager_queryWalletDevice(
WalletManager wm_ptr, {
required String keysFileName,
required String password,
required int kdfRounds,
}) {
debugStart?.call('MONERO_WalletManager_queryWalletDevice');
lib ??= MoneroC(DynamicLibrary.open(libPath));
final keysFileName_ = keysFileName.toNativeUtf8().cast<Char>();
final password_ = password.toNativeUtf8().cast<Char>();
final s = lib!.MONERO_WalletManager_queryWalletDevice(
wm_ptr, keysFileName_, password_, kdfRounds);
calloc.free(keysFileName_);
calloc.free(password_);
debugEnd?.call('MONERO_WalletManager_queryWalletDevice');
return s;
}

List<String> WalletManager_findWallets(WalletManager wm_ptr,
{required String path}) {
debugStart?.call('MONERO_WalletManager_findWallets');
Expand Down
6 changes: 3 additions & 3 deletions impls/monero.dart/lib/src/checksum_monero.dart
Original file line number Diff line number Diff line change
@@ -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 = "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const String wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c";
const String wallet2_api_c_h_sha256 = "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b";
const String wallet2_api_c_cpp_sha256 = "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const String wallet2_api_c_exp_sha256 = "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522";
14 changes: 7 additions & 7 deletions impls/monero.dart/lib/src/generated_bindings_monero.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4911,14 +4911,14 @@ class MoneroC {
bool Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>, bool, int)>();

bool MONERO_WalletManager_queryWalletDevice(
int device_type,
int MONERO_WalletManager_queryWalletDevice(
ffi.Pointer<ffi.Void> wm_ptr,
ffi.Pointer<ffi.Char> keys_file_name,
ffi.Pointer<ffi.Char> password,
int kdf_rounds,
) {
return _MONERO_WalletManager_queryWalletDevice(
device_type,
wm_ptr,
keys_file_name,
password,
kdf_rounds,
Expand All @@ -4927,15 +4927,15 @@ class MoneroC {

late final _MONERO_WalletManager_queryWalletDevicePtr = _lookup<
ffi.NativeFunction<
ffi.Bool Function(
ffi.Int,
ffi.Int Function(
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>,
ffi.Uint64)>>('MONERO_WalletManager_queryWalletDevice');
late final _MONERO_WalletManager_queryWalletDevice =
_MONERO_WalletManager_queryWalletDevicePtr.asFunction<
bool Function(
int, ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>();
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>, int)>();

ffi.Pointer<ffi.Char> MONERO_WalletManager_findWallets(
ffi.Pointer<ffi.Void> wm_ptr,
Expand Down
2 changes: 1 addition & 1 deletion impls/monero.dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
dev_dependencies:
lints: ^5.0.0
test: ^1.24.0
ffigen: ^14.0.0
ffigen: ^14.0.0
6 changes: 3 additions & 3 deletions impls/monero.ts/checksum_monero.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const moneroChecksum = {
wallet2_api_c_h_sha256: "e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad",
wallet2_api_c_cpp_sha256: "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd",
wallet2_api_c_exp_sha256: "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c",
wallet2_api_c_h_sha256: "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b",
wallet2_api_c_cpp_sha256: "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd",
wallet2_api_c_exp_sha256: "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522",
}
3 changes: 2 additions & 1 deletion monero_libwallet2_api_c/monero_libwallet2_api_c.exp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ _MONERO_WalletManager_createWalletFromPolyseed
_MONERO_WalletManager_closeWallet
_MONERO_WalletManager_walletExists
_MONERO_WalletManager_verifyWalletPassword
_MONERO_WalletManager_queryWalletDevice
_MONERO_WalletManager_findWallets
_MONERO_WalletManager_errorString
_MONERO_WalletManager_setDaemonAddress
Expand Down Expand Up @@ -306,4 +307,4 @@ _MONERO_cw_WalletListener_height
_MONERO_free
_MONERO_checksum_wallet2_api_c_h
_MONERO_checksum_wallet2_api_c_cpp
_MONERO_checksum_wallet2_api_c_exp
_MONERO_checksum_wallet2_api_c_exp
6 changes: 3 additions & 3 deletions monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
Original file line number Diff line number Diff line change
@@ -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 = "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const char * MONERO_wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c";
const char * MONERO_wallet2_api_c_h_sha256 = "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b";
const char * MONERO_wallet2_api_c_cpp_sha256 = "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const char * MONERO_wallet2_api_c_exp_sha256 = "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522";
#endif
11 changes: 8 additions & 3 deletions monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,10 +1767,15 @@ bool MONERO_WalletManager_verifyWalletPassword(void* wm_ptr, const char* keys_fi
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);
return wm->verifyWalletPassword(std::string(keys_file_name), std::string(password), no_spend_key, kdf_rounds);
}

// virtual bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const = 0;
// bool MONERO_WalletManager_queryWalletDevice(int device_type, const char* keys_file_name, const char* password, uint64_t kdf_rounds) {
// return Monero::WalletManagerFactory::getWalletManager()->queryWalletDevice(device_type, std::string(keys_file_name), std::string(password), kdf_rounds);
//}
int MONERO_WalletManager_queryWalletDevice(void* wm_ptr, const char* keys_file_name, const char* password, uint64_t kdf_rounds) {
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);
Monero::Wallet::Device device_type;
wm->queryWalletDevice(device_type, std::string(keys_file_name), std::string(password), kdf_rounds);
return device_type;
}

// virtual std::vector<std::string> findWallets(const std::string &path) = 0;
const char* MONERO_WalletManager_findWallets(void* wm_ptr, const char* path, const char* separator) {
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);
Expand Down
4 changes: 2 additions & 2 deletions monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ extern ADDAPI bool MONERO_WalletManager_walletExists(void* wm_ptr, const char* p
// virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const = 0;
extern ADDAPI bool MONERO_WalletManager_verifyWalletPassword(void* wm_ptr, const char* keys_file_name, const char* password, bool no_spend_key, uint64_t kdf_rounds);
// virtual bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const = 0;
extern ADDAPI bool MONERO_WalletManager_queryWalletDevice(int device_type, const char* keys_file_name, const char* password, uint64_t kdf_rounds);
extern ADDAPI int MONERO_WalletManager_queryWalletDevice(void* wm_ptr, const char* keys_file_name, const char* password, uint64_t kdf_rounds);
// virtual std::vector<std::string> findWallets(const std::string &path) = 0;
extern ADDAPI const char* MONERO_WalletManager_findWallets(void* wm_ptr, const char* path, const char* separator);
// virtual std::string errorString() const = 0;
Expand Down Expand Up @@ -1039,4 +1039,4 @@ extern ADDAPI const char* MONERO_checksum_wallet2_api_c_exp();

#ifdef __cplusplus
}
#endif
#endif
17 changes: 9 additions & 8 deletions patches/monero/0016-add-dummy-device-for-ledger.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 6b40191d35df998280e1d6e19ff9bf4bce54d5bf Mon Sep 17 00:00:00 2001
From 77f328ba6befb9b964f764a27f8a03b71bf9095d Mon Sep 17 00:00:00 2001
From: Czarek Nakamoto <[email protected]>
Date: Wed, 26 Jun 2024 15:04:38 +0200
Subject: [PATCH 16/16] add dummy device for ledger
Expand All @@ -12,10 +12,10 @@ Subject: [PATCH 16/16] add dummy device for ledger
src/device/device_io_dummy.hpp | 74 ++++++++++++++++++
src/device/device_ledger.cpp | 6 +-
src/device/device_ledger.hpp | 7 +-
src/wallet/api/wallet.cpp | 93 +++++++++++++++++++++++
src/wallet/api/wallet.cpp | 94 +++++++++++++++++++++++
src/wallet/api/wallet.h | 18 +++++
src/wallet/api/wallet2_api.h | 12 +++
11 files changed, 356 insertions(+), 21 deletions(-)
11 files changed, 357 insertions(+), 21 deletions(-)
create mode 100644 src/device/device_io_dummy.cpp
create mode 100644 src/device/device_io_dummy.hpp

Expand Down Expand Up @@ -234,13 +234,13 @@ index 000000000..fb082694e
+ MDEBUG("exchange(): waitsForDeviceSend");
+ // NOTE: waitsForDeviceSend should be changed by external code
+ while (waitsForDeviceSend) {
+ sleep(1);
+ usleep(1000);
+ MDEBUG("exchange(): waitsForDeviceSend (still)");
+ }
+
+ MDEBUG("exchange(): waitsForDeviceReceive");
+ while (waitsForDeviceReceive) {
+ sleep(1);
+ usleep(1000);
+ MDEBUG("exchange(): waitsForDeviceReceive (still)");
+ }
+
Expand Down Expand Up @@ -414,7 +414,7 @@ index 03058c4f1..506f27c4a 100644
unsigned char buffer_send[BUFFER_SEND_SIZE];
unsigned int length_recv;
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index a307d35a7..3ead385ec 100644
index 8bdd75a5a..09f91c5e2 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -49,6 +49,9 @@
Expand All @@ -427,7 +427,7 @@ index a307d35a7..3ead385ec 100644

using namespace std;
using namespace cryptonote;
@@ -3298,4 +3301,94 @@ uint64_t WalletImpl::getBytesSent()
@@ -3299,4 +3302,95 @@ uint64_t WalletImpl::getBytesSent()
return m_wallet->get_bytes_sent();
}

Expand Down Expand Up @@ -502,6 +502,7 @@ index a307d35a7..3ead385ec 100644
+ return;
+ #else
+ hw::io::device_io_dummy::receivedFromDevice = static_cast<unsigned char *>(malloc(len));
+ hw::io::device_io_dummy::receivedFromDeviceLength = len;
+ memset(hw::io::device_io_dummy::receivedFromDevice, 0, len);
+ memcpy(hw::io::device_io_dummy::receivedFromDevice, data, len);
+ hw::io::device_io_dummy::waitsForDeviceReceive = false;
Expand Down Expand Up @@ -575,5 +576,5 @@ index 2bbb32c8b..c8d6bb179 100644

/**
--
2.39.2
2.45.1.windows.1

0 comments on commit 0e888c1

Please sign in to comment.