Merge pull request #188 from MAGICGrants/misc-fixes
What changed, and why it matters
This is a routine 'misc fixes' update for the Skylight Wallet app. It mainly improves how the wallet estimates transaction fees for 'sweep' sends, prevents some user-interface glitches after async operations, tightens Tor/onion address handling in connection settings, and fixes a build reproducibility issue. There is no clear security vulnerability being patched in the visible code, but the changes do reduce the chance of user confusion or incorrect fee display.
Review the linked wallet-core commit `2c2c8a3cbd33e5c28b958c25c0d002158e3a1185` for any security-relevant changes, since this app commit mostly consumes that dependency update. Otherwise, treat as a normal maintenance merge and ensure the new fee-estimation tests pass.
Security signals we found
UI async lifecycle guards added (mounted checks) — reduces crash/DoS surface but is a robustness fix, not a security patch
Tor/onion connection validation tightened — prevents misconfigured connections but no exploit path shown
Fee estimation fallback for sweep transactions — correctness fix, could affect displayed fees
Build reproducibility fix for SOURCE_DATE_EPOCH in F-Droid script
wallet-core dependency updated to a newer ref; contents of that ref not supplied
Evidence from the diff
The commit is a merge of PR #188 (‘misc-fixes’). Key changes include: (1) adding an isSweepAll flag to estimateFee and falling back to building the transaction when no native estimate is available, with a new test file covering this behavior; (2) adding if (!mounted) return; guards after async operations in multiple UI screens to avoid calling setState on disposed widgets; (3) refactoring connection address validation to use a new validateConnectionAddress helper and adding warnings when a saved Tor connection is silently disabled; (4) updating wallet-core git refs to 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185; and (5) preserving SOURCE_DATE_EPOCH in the F-Droid build script for reproducible builds. No explicit security bug or CVE is referenced.
Changed components
lib/models/app_wallet.dartlib/models/monero_wallet_adapter.dartlib/screens/send.dartlib/screens/restore_wallet.dartlib/screens/settings.dartlib/widgets/connection_settings_form.dartscripts/fdroid-build.shpubspec.yaml / pubspec.lock (wallet-core git refs)Inspect captured patch +238 / −69
### lib/l10n/app_en.arb
@@ -41,8 +41,11 @@
"connectionTypeNode": "Monero Node",
"connectionRemoteIpNotAllowed": "Connections to remote IP addresses aren't allowed. Use a domain name or a local IP address.",
"connectionLocalOverTorNotAllowed": "A local address can't be reached through Tor. Turn Tor off, or use the server's onion address.",
+ "connectionOnionNeedsTor": "An onion address can only be reached through Tor. Turn Tor on to use it.",
+ "connectionTorDisabledWarning": "Tor is disabled, so this connection no longer works. Please reconfigure it.",
"connectionProtocolHttps": "Removing protocol. Using HTTPS for domains.",
"connectionProtocolHttp": "Removing protocol. Using HTTP for local addresses.",
+ "connectionProtocolHttpOnion": "Removing protocol. Onion addresses use HTTP over Tor.",
"connectionTestStop": "Stop",
"connectionTestingTitle": "Testing connection",
"connectionTestingDetail": "Checking whether the server answers.",
### lib/l10n/app_localizations.dart
@@ -297,6 +297,18 @@ abstract class AppLocalizations {
/// **'A local address can\'t be reached through Tor. Turn Tor off, or use the server\'s onion address.'**
String get connectionLocalOverTorNotAllowed;
+ /// No description provided for @connectionOnionNeedsTor.
+ ///
+ /// In en, this message translates to:
+ /// **'An onion address can only be reached through Tor. Turn Tor on to use it.'**
+ String get connectionOnionNeedsTor;
+
+ /// No description provided for @connectionTorDisabledWarning.
+ ///
+ /// In en, this message translates to:
+ /// **'Tor is disabled, so this connection no longer works. Please reconfigure it.'**
+ String get connectionTorDisabledWarning;
+
/// No description provided for @connectionProtocolHttps.
///
/// In en, this message translates to:
@@ -309,6 +321,12 @@ abstract class AppLocalizations {
/// **'Removing protocol. Using HTTP for local addresses.'**
String get connectionProtocolHttp;
+ /// No description provided for @connectionProtocolHttpOnion.
+ ///
+ /// In en, this message translates to:
+ /// **'Removing protocol. Onion addresses use HTTP over Tor.'**
+ String get connectionProtocolHttpOnion;
+
/// No description provided for @connectionTestStop.
///
/// In en, this message translates to:
### lib/l10n/app_localizations_en.dart
@@ -116,12 +116,23 @@ class AppLocalizationsEn extends AppLocalizations {
String get connectionLocalOverTorNotAllowed =>
'A local address can\'t be reached through Tor. Turn Tor off, or use the server\'s onion address.';
+ @override
+ String get connectionOnionNeedsTor =>
+ 'An onion address can only be reached through Tor. Turn Tor on to use it.';
+
+ @override
+ String get connectionTorDisabledWarning =>
+ 'Tor is disabled, so this connection no longer works. Please reconfigure it.';
+
@override
String get connectionProtocolHttps => 'Removing protocol. Using HTTPS for domains.';
@override
String get connectionProtocolHttp => 'Removing protocol. Using HTTP for local addresses.';
+ @override
+ String get connectionProtocolHttpOnion => 'Removing protocol. Onion addresses use HTTP over Tor.';
+
@override
String get connectionTestStop => 'Stop';
### lib/l10n/app_localizations_pt.dart
@@ -116,12 +116,24 @@ class AppLocalizationsPt extends AppLocalizations {
String get connectionLocalOverTorNotAllowed =>
'Um endereço local não pode ser acessado via Tor. Desative o Tor ou use o endereço onion do servidor.';
+ @override
+ String get connectionOnionNeedsTor =>
+ 'Um endereço onion só pode ser acessado via Tor. Ative o Tor para usá-lo.';
+
+ @override
+ String get connectionTorDisabledWarning =>
+ 'O Tor está desativado, então esta conexão não funciona mais. Reconfigure-a.';
+
@override
String get connectionProtocolHttps => 'Removendo protocolo. Usando HTTPS para domínios.';
@override
String get connectionProtocolHttp => 'Removendo protocolo. Usando HTTP para endereços locais.';
+ @override
+ String get connectionProtocolHttpOnion =>
+ 'Removendo protocolo. Endereços onion usam HTTP via Tor.';
+
@override
String get connectionTestStop => 'Parar';
### lib/l10n/app_pt.arb
@@ -41,8 +41,11 @@
"connectionTypeNode": "Nó Monero",
"connectionRemoteIpNotAllowed": "Conexões com endereços IP remotos não são permitidas. Use um nome de domínio ou um endereço IP local.",
"connectionLocalOverTorNotAllowed": "Um endereço local não pode ser acessado via Tor. Desative o Tor ou use o endereço onion do servidor.",
+ "connectionOnionNeedsTor": "Um endereço onion só pode ser acessado via Tor. Ative o Tor para usá-lo.",
+ "connectionTorDisabledWarning": "O Tor está desativado, então esta conexão não funciona mais. Reconfigure-a.",
"connectionProtocolHttps": "Removendo protocolo. Usando HTTPS para domínios.",
"connectionProtocolHttp": "Removendo protocolo. Usando HTTP para endereços locais.",
+ "connectionProtocolHttpOnion": "Removendo protocolo. Endereços onion usam HTTP via Tor.",
"connectionTestStop": "Parar",
"connectionTestingTitle": "Testando conexão",
"connectionTestingDetail": "Verificando se o servidor responde.",
### lib/models/app_wallet.dart
@@ -121,7 +121,12 @@ abstract interface class AppWallet implements Listenable {
/// can't estimate it (typically insufficient balance for that priority).
/// [amount] is exact decimal text, never a double. A spend amount that has
/// been through a double is no longer the amount the user asked for.
- Future<int?> estimateFee(String destinationAddress, String amount, {int priority});
+ Future<int?> estimateFee(
+ String destinationAddress,
+ String amount, {
+ int priority,
+ bool isSweepAll,
+ });
Future<AppPendingTx> createTx(
String destinationAddress,
String amount,
### lib/models/monero_wallet_adapter.dart
@@ -214,13 +214,34 @@ class MoneroWalletAdapter extends ChangeNotifier implements AppWallet {
bool isAddressValid(String address) => _wallet.isAddressValid(address);
@override
- Future<int?> estimateFee(String destinationAddress, String amount, {int priority = 0}) async {
- final fee = await _wallet.estimateFee(
- destinationAddress,
- domain.decimalToBaseUnits(amount, _moneroDecimals),
- priority: priority,
- );
- return fee?.toInt();
+ Future<int?> estimateFee(
+ String destinationAddress,
+ String amount, {
+ int priority = 0,
+ bool isSweepAll = false,
+ }) async {
+ final amountBaseUnits = domain.decimalToBaseUnits(amount, _moneroDecimals);
+ if (!isSweepAll) {
+ final fee = await _wallet.estimateFee(
+ destinationAddress,
+ amountBaseUnits,
+ priority: priority,
+ );
+ if (fee != null) return fee.toInt();
+ }
+ // A sweep can't be estimated; build the tx (also the fallback when no
+ // estimate comes back).
+ try {
+ final tx = await _wallet.createTx(
+ destinationAddress,
+ amountBaseUnits,
+ isSweepAll,
+ priority: priority,
+ );
+ return tx.feeBaseUnits.toInt();
+ } catch (_) {
+ return null;
+ }
}
@override
### lib/screens/restore_wallet.dart
@@ -96,6 +96,7 @@ class _RestoreWalletScreenState extends State<RestoreWalletScreen> with SecureSc
locale: Localizations.localeOf(context).toString(),
),
);
+ if (!mounted) return;
if (result == null) return;
setState(() {
### lib/screens/send.dart
@@ -312,7 +312,9 @@ class _SendScreenState extends State<SendScreen> {
if (domainRegex.hasMatch(unresolvedDestinationAddress)) {
// OpenAlias: cached + deduped; the counter gates the send button while
// a lookup is in flight.
- if (await _resolveDomain(unresolvedDestinationAddress) == null) {
+ final resolved = await _resolveDomain(unresolvedDestinationAddress);
+ if (!mounted) return false;
+ if (resolved == null) {
if (setErrors) {
setState(() {
_destinationAddressError = i18n.sendOpenAliasResolveError;
@@ -366,12 +368,20 @@ class _SendScreenState extends State<SendScreen> {
final amountText = _amount.coinText;
try {
- // Estimate the fee per priority natively (no full tx build).
- final fees = await Future.wait([
- wallet.estimateFee(destinationAddress, amountText, priority: 1),
- wallet.estimateFee(destinationAddress, amountText, priority: 2),
- wallet.estimateFee(destinationAddress, amountText, priority: 3),
- ]);
+ // Sequential: estimateFee builds the tx when no estimate comes back (a
+ // sweep, or some states), and the builds share one wallet2.
+ final fees = <int?>[];
+ for (var priority = 1; priority <= 3; priority++) {
+ if (currentRequest != _feeCalculationCounter) return;
+ fees.add(
+ await wallet.estimateFee(
+ destinationAddress,
+ amountText,
+ priority: priority,
+ isSweepAll: _isSweepAll,
+ ),
+ );
+ }
// Only update state if this is still the latest request
if (currentRequest == _feeCalculationCounter && mounted) {
@@ -420,6 +430,7 @@ class _SendScreenState extends State<SendScreen> {
});
final isValid = await _validateForm();
+ if (!mounted) return;
if (!isValid) {
setState(() {
@@ -437,6 +448,7 @@ class _SendScreenState extends State<SendScreen> {
// it, so this comes back from the cache rather than hitting Tor again.
if (domainRegex.hasMatch(destinationAddressUnresolved)) {
final resolved = await _resolveDomain(destinationAddressUnresolved);
+ if (!mounted) return;
if (resolved == null) {
setState(() {
@@ -476,6 +488,7 @@ class _SendScreenState extends State<SendScreen> {
);
}
} catch (error) {
+ if (!mounted) return;
if (error.toString().contains('Unlocked funds too low')) {
// Display-only: picks which of two error messages to show, so the
// imprecision of a double cannot reach an amount anyone spends.
@@ -496,6 +509,7 @@ class _SendScreenState extends State<SendScreen> {
}
}
+ if (!mounted) return;
setState(() {
_isLoading = false;
});
### lib/screens/settings.dart
@@ -70,6 +70,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
void _loadPackageInfo() async {
final packageInfo = await PackageInfo.fromPlatform();
+ if (!mounted) return;
setState(() {
_appVersion = packageInfo.version;
_buildNumber = packageInfo.buildNumber;
@@ -140,6 +141,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
}
}
+ if (!mounted) return;
setState(() {
_appLockEnabled = value;
});
### lib/widgets/connection_settings_form.dart
@@ -87,6 +87,10 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
bool _initialBackgroundSync = false;
bool _initialForegroundSync = false;
+ // The saved connection's raw Tor flag (before masking by the global Tor mode).
+ // Used to warn when a Tor connection was silently turned off by disabling Tor.
+ bool _savedConnectionUsedTor = false;
+
bool get _isNode => _connectionType == 'node';
/// Background/continuous sync only helps a full-node connection (the slow
@@ -159,13 +163,15 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
Future<void> _loadPersistedConnection() async {
final wallet = appWalletOf(context);
final conn = await wallet.getPersistedConnection();
+ if (!mounted) return;
final useTor = conn.useTor && TorSettingsService.sharedInstance.torMode != TorMode.disabled;
final type = connectionTypeOptions.contains(conn.connectionType) ? conn.connectionType : 'lws';
setState(() {
_addressController.text = conn.address;
_customProxyPortController.text = conn.proxyPort;
_useTor = useTor;
+ _savedConnectionUsedTor = conn.useTor;
_connectionType = type;
_initialAddress = cleanConnectionAddress(conn.address);
_initialProxyPort = conn.proxyPort;
@@ -184,6 +190,7 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
final i18n = AppLocalizations.of(context)!;
final result = await Navigator.pushNamed(context, '/scan_qr');
+ if (!mounted) return;
if (result != null && result is String) {
final scannedAddress = cleanConnectionAddress(result);
@@ -205,33 +212,31 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
}
void _onAddressChange(String rawValue) {
- final hadProtocol = RegExp(r'https?:\/\/').hasMatch(rawValue);
- final value = cleanConnectionAddress(rawValue);
+ final input = analyzeAddressInput(rawValue);
final i18n = AppLocalizations.of(context)!;
// Strip any typed http(s):// from the field itself so it's ignored.
- if (_addressController.text != value) {
+ if (_addressController.text != input.cleaned) {
_addressController.value = TextEditingValue(
- text: value,
- selection: TextSelection.collapsed(offset: value.length),
+ text: input.cleaned,
+ selection: TextSelection.collapsed(offset: input.cleaned.length),
);
}
- final useTor = onionAddressRegex.hasMatch(value);
-
// Never auto-disable Tor if the user already turned it on.
- _setUseTor(useTor || _useTor);
+ _setUseTor(input.isOnion || _useTor);
setState(() {
_hasTested = false;
- _errorMessage = isRemoteIp(value) ? i18n.connectionRemoteIpNotAllowed : null;
+ _errorMessage = input.isRemoteIp ? i18n.connectionRemoteIpNotAllowed : null;
});
- if (hadProtocol) {
- showBrandToast(
- context,
- addressUsesSsl(value) ? i18n.connectionProtocolHttps : i18n.connectionProtocolHttp,
- );
+ if (input.hadProtocol) {
+ showBrandToast(context, switch (input.protocolHint) {
+ AddressProtocolHint.onion => i18n.connectionProtocolHttpOnion,
+ AddressProtocolHint.secure => i18n.connectionProtocolHttps,
+ AddressProtocolHint.plain => i18n.connectionProtocolHttp,
+ });
}
}
@@ -242,7 +247,7 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
}
void _setUseTor(bool? value) {
- if (TorSettingsService.sharedInstance.torMode == TorMode.disabled) {
+ if (value == true && TorSettingsService.sharedInstance.torMode == TorMode.disabled) {
log(LogLevel.info, 'Tor is disabled. Not setting useTor to true.');
value = false;
}
@@ -306,6 +311,7 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
_addressController.text = conn.address;
_customProxyPortController.text = conn.proxyPort;
_useTor = useTor;
+ _savedConnectionUsedTor = conn.useTor;
_hasTested = false;
_connectionSuccess = false;
_errorMessage = null;
@@ -316,6 +322,13 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
return type == 'node' ? i18n.connectionTypeNode : i18n.connectionTypeLws;
}
+ String _connectionAddressErrorMessage(AppLocalizations i18n, ConnectionAddressError error) =>
+ switch (error) {
+ ConnectionAddressError.remoteIp => i18n.connectionRemoteIpNotAllowed,
+ ConnectionAddressError.localOverTor => i18n.connectionLocalOverTorNotAllowed,
+ ConnectionAddressError.onionNeedsTor => i18n.connectionOnionNeedsTor,
+ };
+
/// Resolves the SOCKS proxy port to pass to `wallet.testConnection`. When Tor
/// is enabled this comes from the running TorService; otherwise it's the
/// optional custom HTTP/SOCKS proxy field.
@@ -341,18 +354,15 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
return;
}
- if (isRemoteIp(daemonAddress)) {
- setState(() {
- _hasTested = false;
- _errorMessage = i18n.connectionRemoteIpNotAllowed;
- });
- return;
- }
-
- if (_useTor && addressIsLocal(daemonAddress)) {
+ final addrError = validateConnectionAddress(
+ address: daemonAddress,
+ useTor: _useTor,
+ hasProxy: _customProxyPortController.text.trim().isNotEmpty,
+ );
+ if (addrError != null) {
setState(() {
_hasTested = false;
- _errorMessage = i18n.connectionLocalOverTorNotAllowed;
+ _errorMessage = _connectionAddressErrorMessage(i18n, addrError);
});
return;
}
@@ -416,13 +426,13 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
final daemonAddress = cleanConnectionAddress(_addressController.text);
final proxyAddress = _customProxyPortController.text;
- if (isRemoteIp(daemonAddress)) {
- setState(() => _errorMessage = i18n.connectionRemoteIpNotAllowed);
- return;
- }
-
- if (_useTor && addressIsLocal(daemonAddress)) {
- setState(() => _errorMessage = i18n.connectionLocalOverTorNotAllowed);
+ final addrError = validateConnectionAddress(
+ address: daemonAddress,
+ useTor: _useTor,
+ hasProxy: proxyAddress.trim().isNotEmpty,
+ );
+ if (addrError != null) {
+ setState(() => _errorMessage = _connectionAddressErrorMessage(i18n, addrError));
return;
}
@@ -518,6 +528,10 @@ class _ConnectionSettingsFormState extends State<ConnectionSettingsForm> {
onAddressChanged: _onAddressChange,
onScan: (Platform.isAndroid || Platform.isIOS) ? _scanQrCode : null,
errorMessage: _errorMessage,
+ // The saved connection used Tor, which is now disabled: prompt to reconfigure.
+ warning: (_savedConnectionUsedTor && torMode == TorMode.disabled)
+ ? i18n.connectionTorDisabledWarning
+ : null,
proxyController: _customProxyPortController,
onProxyChanged: _onProxyPortChange,
proxyEnabled: !_useTor,
### pubspec.lock
@@ -1264,62 +1264,62 @@ packages:
dependency: "direct main"
description:
path: "packages/wallet_background"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_domain:
dependency: "direct main"
description:
path: "packages/wallet_domain"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_fiat:
dependency: "direct main"
description:
path: "packages/wallet_fiat"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_infra:
dependency: "direct main"
description:
path: "packages/wallet_infra"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_monero:
dependency: "direct main"
description:
path: "packages/wallet_monero"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_openalias:
dependency: "direct main"
description:
path: "packages/wallet_openalias"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
wallet_ui:
dependency: "direct main"
description:
path: "packages/wallet_ui"
- ref: c69fffd03898046070fc800c1325525eab7d624f
- resolved-ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
+ resolved-ref: "2c2c8a3cbd33e5c28b958c25c0d002158e3a1185"
url: "https://github.com/MAGICGrants/wallet-core"
source: git
version: "0.1.0"
### pubspec.yaml
@@ -65,37 +65,37 @@ dependencies:
wallet_infra:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_infra
wallet_domain:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_domain
wallet_monero:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_monero
wallet_openalias:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_openalias
wallet_background:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_background
wallet_fiat:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_fiat
wallet_ui:
git:
url: https://github.com/MAGICGrants/wallet-core
- ref: c69fffd03898046070fc800c1325525eab7d624f
+ ref: 2c2c8a3cbd33e5c28b958c25c0d002158e3a1185
path: packages/wallet_ui
bip39:
### scripts/fdroid-build.sh
@@ -50,7 +50,11 @@ cp "/tmp/monero_c/monero_libwallet2_api_c/build/$ARCH/libwallet2_api_c.so" \
"/tmp/skylight/android/app/src/main/jniLibs/$ABI/libmonero_libwallet2_api_c.so"
rm -rf /tmp/monero_c
cd /tmp/skylight
-export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
+# Keep fdroid's inherited SOURCE_DATE_EPOCH; /tmp/skylight has no .git so git log
+# here would blank it, making OpenSSL bake the wall-clock time (non-reproducible).
+: "${SOURCE_DATE_EPOCH:=$(git -C "$REPO" log -1 --format=%ct 2>/dev/null)}"
+[ -n "$SOURCE_DATE_EPOCH" ] || { echo "SOURCE_DATE_EPOCH empty; refusing non-reproducible build" >&2; exit 1; }
+export SOURCE_DATE_EPOCH
RUST_TOOLCHAIN=$(sed -n 's/^[[:space:]]*channel[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' rust-toolchain.toml | head -1)
rustup default "$RUST_TOOLCHAIN"
rustup target add "$RUST"
### test/monero_sweep_fee_test.dart
@@ -0,0 +1,61 @@
+import 'dart:io';
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:wallet_domain/wallet_domain.dart';
+import 'package:wallet_infra/testing.dart';
+import 'package:wallet_infra/wallet_infra.dart';
+import 'package:wallet_monero/wallet_monero.dart';
+import 'package:skylight_wallet/models/monero_wallet_adapter.dart';
+
+/// estimateFee prices a normal send; when no estimate comes back (a sweep, or
+/// some states) the adapter falls back to building the tx.
+void main() {
+ late Directory tmp;
+ late FakeMoneroBackend backend;
+ late MoneroWalletAdapter adapter;
+
+ final dest = '4${'a' * 94}';
+
+ setUpAll(() => WalletFileCrypto.kdf = const FastTestPbkdf2());
+ tearDownAll(() => WalletFileCrypto.kdf = const WebCryptoPbkdf2());
+
+ setUp(() async {
+ tmp = Directory.systemTemp.createTempSync('monero_sweep_fee');
+ SharedPreferencesService.store = MemoryPreferenceStore();
+ WalletSecrets.store = MemorySecretStore();
+ WalletAppConfig.install(WalletAppConfig.skylight, directories: FixedDirectories(tmp));
+ useTestCaBundle();
+ WalletLog.sink = MemoryLogSink();
+ backend = FakeMoneroBackend();
+ final wallet = MoneroWallet(backend: backend);
+ backend.existingWalletPaths.add(await wallet.walletPathForType('lws'));
+ await wallet.openExisting(password: 'pw');
+ adapter = MoneroWalletAdapter(wallet, readStoredSeed: () async => null);
+ });
+
+ tearDown(() {
+ WalletAppConfig.resetForTesting();
+ CaBundle.resetForTesting();
+ SharedPreferencesService.resetForTesting();
+ tmp.deleteSync(recursive: true);
+ });
+
+ test('normal send: fee comes from the native estimate', () async {
+ backend.feeEstimate = BigInt.from(30000000);
+ backend.pendingFee = BigInt.from(12345);
+ // Estimate is used; the tx is not built.
+ expect(await adapter.estimateFee(dest, '1.0', priority: 1), 30000000);
+ });
+
+ test('no estimate returned: falls back to the built-tx fee', () async {
+ backend.feeEstimate = null;
+ backend.pendingFee = BigInt.from(12345);
+ expect(await adapter.estimateFee(dest, '1.0', priority: 1), 12345);
+ });
+
+ test('sweep: always priced from the built tx', () async {
+ backend.feeEstimate = BigInt.from(30000000);
+ backend.pendingFee = BigInt.from(12345);
+ expect(await adapter.estimateFee(dest, '1.0', priority: 1, isSweepAll: true), 12345);
+ });
+}Why this scored 33/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.