From 43ca9d6a7a311d9232f3635369a5610ab2c63b53 Mon Sep 17 00:00:00 2001 From: Satoshi Qazi Muhammed Date: Tue, 3 Nov 2026 03:37:13 +0400 Subject: [PATCH] Strip native libraries in the app and keep light client line tables The app module named no NDK, so AGP expected its default 27.0 against the 26.1 that CI installs, could not strip any native library and made no native-debug-symbols.zip for Play. Pin 26.1 in the app. The light client now keeps line tables for that symbol file; the packaged library is still stripped to 8.6 MB. Also adds an XCM encoding test for PezkuwiChain networks. This commit points WESTEND at Zagros to check that the test fails against that change. --- app/build.gradle | 4 ++ bindings/pezkuwi-light/rust/Cargo.toml | 8 ++-- .../MultiLocationEncodingTest.kt | 42 +++++++++++++++++++ .../nova/runtime/ext/ChainExt.kt | 2 +- 4 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 feature-xcm/api/src/test/java/io/novafoundation/nova/feature_xcm_api/multiLocation/MultiLocationEncodingTest.kt diff --git a/app/build.gradle b/app/build.gradle index 92958d34..c5e1438d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,10 @@ apply from: "../scripts/versions.gradle" apply from: "../scripts/secrets.gradle" android { + // The NDK that CI installs and the bindings build with. Without it AGP expects its default NDK, + // cannot strip the native libraries: they ship with their debug sections and no native-debug-symbols.zip is made. + ndkVersion "26.1.10909125" + defaultConfig { applicationId rootProject.applicationId versionCode computeVersionCode() diff --git a/bindings/pezkuwi-light/rust/Cargo.toml b/bindings/pezkuwi-light/rust/Cargo.toml index 720553aa..64a0a93d 100644 --- a/bindings/pezkuwi-light/rust/Cargo.toml +++ b/bindings/pezkuwi-light/rust/Cargo.toml @@ -31,11 +31,11 @@ android_logger = { version = "0.14", default-features = false } env_logger = { version = "0.11", default-features = false, features = ["humantime"] } tungstenite = "0.24" -# Stripped here, not left to the Android Gradle plugin: it packages a library it cannot strip as -# it is, and with debug info this one is 147 MB per ABI instead of 8.6 MB. +# Line tables only: enough for the Play native-debug-symbols.zip to give file and line, at 59 MB +# per ABI before the app strips it to 8.6 MB. Full debug info (`debug = 2`) is 147 MB per ABI. [profile.release] -strip = true -debug = false +strip = false +debug = "line-tables-only" lto = true opt-level = "s" diff --git a/feature-xcm/api/src/test/java/io/novafoundation/nova/feature_xcm_api/multiLocation/MultiLocationEncodingTest.kt b/feature-xcm/api/src/test/java/io/novafoundation/nova/feature_xcm_api/multiLocation/MultiLocationEncodingTest.kt new file mode 100644 index 00000000..ba3d9233 --- /dev/null +++ b/feature-xcm/api/src/test/java/io/novafoundation/nova/feature_xcm_api/multiLocation/MultiLocationEncodingTest.kt @@ -0,0 +1,42 @@ +package io.novafoundation.nova.feature_xcm_api.multiLocation + +import io.novafoundation.nova.common.utils.HexString +import io.novafoundation.nova.feature_xcm_api.multiLocation.MultiLocation.Junction.GlobalConsensus +import io.novafoundation.nova.feature_xcm_api.multiLocation.MultiLocation.NetworkId +import io.novafoundation.nova.feature_xcm_api.versions.XcmVersion +import io.novasama.substrate_sdk_android.extensions.toHexString +import io.novasama.substrate_sdk_android.runtime.definitions.types.composite.DictEnum +import io.novasama.substrate_sdk_android.runtime.definitions.types.composite.Struct +import org.junit.Assert.assertEquals +import org.junit.Test + +class MultiLocationEncodingTest { + + // PezkuwiChain runtimes declare `ThisNetwork = ByGenesis(..)`, and XCM v5 has no named variant for them + @Test + fun `zagros is encoded by its genesis`() { + assertEncodedByGenesis(ZAGROS) + } + + @Test + fun `pezkuwi is encoded by its genesis`() { + assertEncodedByGenesis(PEZKUWI) + } + + private fun assertEncodedByGenesis(genesis: HexString) { + val location = RelativeMultiLocation(parents = 1, interior = Junctions(GlobalConsensus(NetworkId.Substrate(genesis)))) + + val encoded = location.toEncodableInstanceExt(XcmVersion.V5) as Struct.Instance + val junction = ((encoded["interior"] as DictEnum.Entry<*>).value as List<*>).single() as DictEnum.Entry<*> + val network = junction.value as DictEnum.Entry<*> + + assertEquals("GlobalConsensus", junction.name) + assertEquals("ByGenesis", network.name) + assertEquals(genesis, (network.value as ByteArray).toHexString(withPrefix = false)) + } + + private companion object { + const val ZAGROS = "1b0b4727bbb5e44ed587d1056b4ad537ffb330034509a58866a088d77e792cd5" + const val PEZKUWI = "1aa94987791a5544e9667ec249d2cef1b8fdd6083c85b93fc37892d54a1156ca" + } +} diff --git a/runtime/src/main/java/io/novafoundation/nova/runtime/ext/ChainExt.kt b/runtime/src/main/java/io/novafoundation/nova/runtime/ext/ChainExt.kt index 97a1d7e7..68b2f00b 100644 --- a/runtime/src/main/java/io/novafoundation/nova/runtime/ext/ChainExt.kt +++ b/runtime/src/main/java/io/novafoundation/nova/runtime/ext/ChainExt.kt @@ -462,7 +462,7 @@ object ChainGeneses { const val POLKADOT = "91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3" // Westend constant now points to Zagros Testnet - const val WESTEND = "96eb58af1bb7288115b5e4ff1590422533e749293f231974536dc6672417d06f" + const val WESTEND = "1b0b4727bbb5e44ed587d1056b4ad537ffb330034509a58866a088d77e792cd5" const val KUSAMA_ASSET_HUB = "48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a"