mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-11-04 01:41:12 +00:00
* Add pezkuwi-light: embedded PezkuwiChain light client binding A JNI binding around the PezkuwiChain fork of smoldot (pezkuwichain/smoldot), which verifies PezkuwiChain blocks under the chain's sovereign constants. Upstream smoldot cannot. The wallet reaches its chains through JSON-RPC WebSockets, so the light client is served the same way: a WebSocket server bound to 127.0.0.1 on a random port. Every path carries a random per-process token: ws://127.0.0.1:<port>/<token>/<chain key>. - A wrong token, a missing token or an unregistered chain is refused during the handshake with 404. - Each connection adds its own smoldot chain instance. smoldot shares the sync between instances of the same chain. - Each registered chain's finalized state is written to disk every minute, through a temporary file and a rename. The next start resumes from it. Kotlin surface: PezkuwiLight.start(dir), addChain(key, spec, relayKey), chainUrl(base, key). The module is not yet a dependency of the app. Tested against the live Zagros testnet, with the relay chain and People specs: - dks.kurd resolves through NavnisanApi_resolve to the same bytes the full node returns. - An unregistered name returns 0x00. - The saved state lets a new client resolve. - Reverting the token check turns the routing test red. The library builds for arm, arm64, x86 and x86_64 with 16 KB aligned LOAD segments (0x4000). * pezkuwi-light: secure WebSockets and the app's resolver for peers smoldot's DefaultPlatform cannot open wss connections and resolves names through the system resolver. Where our domains are blocked, both fail: a poisoned DNS answer decides where the client connects, and plain libp2p TCP is recognisable on the wire. PezkuwiPlatform replaces it: - Opens /dns/<host>/tcp/<port>/wss over TLS, using rustls with the ring provider and the Mozilla roots, so a connection looks like any HTTPS WebSocket. - Resolves every name through a Resolve trait. On Android this is the app's HostResolver, called over JNI, so the light client follows the same DNS policy as the rest of the app (EncryptedFirstDns: DoH first, system resolver last). - Tries IPv4 before IPv6, and gives up on an address after 10 s. - With setSecureOnly(true) it opens nothing but secure WebSockets. Peers found through the DHT advertise plain TCP too, and none of them is used. The peer's identity is still checked end to end by libp2p Noise. Tested against live Zagros with only the /wss boot nodes in the specs and secure-only on: relay and People sync and dks.kurd resolves to the full node's bytes. Nail: with secure-only on and the specs' plain TCP boot nodes, nothing syncs and the test times out red. * pezkuwi-light: measure a start from the saved database in its own process An app launch resumes from the database in a fresh process. The in-process warm measurement ran beside a client that was still syncing, so it did not show that case. The new ignored test resolves dks.kurd after a start from the database in PEZKUWI_LIGHT_DB_DIR. On the first run, when no database exists yet, it syncs and waits for a save. The tests also log through env_logger, so RUST_LOG shows smoldot's own timeline when a measurement needs explaining. * Fall back to the embedded light client when every Zagros RPC node fails ChainConnection stays on RPC first. A light client loads the peer-to-peer nodes, and those nodes have a fixed number of light client slots, so RPC is the default. When every RPC node of a supported chain has failed in a row, the connection moves to the light client, served at ws://127.0.0.1:<port>/<token>/<genesis>. RPC is retried after one minute. The wait doubles up to 15 minutes while RPC keeps failing. The connection returns to RPC as soon as a retry connects. If the light client cannot start, or its own connection fails, the connection stays on RPC. LightFallbackPolicy holds these rules. Its tests cover each one, and five mutations of the policy each turn a test red. ChainConnection handles RPC node changes, socket states and a 15 s tick as one event stream, one event at a time, so a node change and a fallback cannot race. LightClients starts the client on first use. A wallet whose RPC answers never runs it. LightClients registers Zagros and Zagros People, the chains the fork can verify, from specifications bundled at build time from pezkuwi-wallet-utils light-client/: the genesis state root, the /wss boot nodes on 443 first, and the relay checkpoint. Peer names resolve through EncryptedFirstDns, which CommonApi now exposes to the runtime module. * pezkuwi-light: strip in the cargo profile The Android Gradle plugin packages a native library it cannot strip as it is. With debug info, libpezkuwi_light.so is 147 MB per ABI. Stripped it is 8.6 MB. The first CI build of this library ran out of disk: four targets with debug info filled the runner. Stripping in the release profile, with debug info off, fixes both: - The library is 8.6 MB for arm64 and keeps its three JNI symbols. - The build directory is 389 MB per target. * Log the light client fallback's decisions Each RPC failure the fallback sees, the light client URL it got, and each RPC retry are logged under LightFallback. The first device run on a blocked Zagros RPC showed no fallback and no trace of where it stopped.
65 lines
2.0 KiB
Groovy
65 lines
2.0 KiB
Groovy
include ':feature-crowdloan-impl'
|
|
include ':feature-crowdloan-api'
|
|
include ':feature-staking-impl'
|
|
include ':feature-staking-api'
|
|
include ':feature-wallet-impl'
|
|
include ':feature-wallet-api'
|
|
include ':feature-onboarding-impl'
|
|
include ':feature-onboarding-api'
|
|
include ':app', ':test-shared', ':common', ':feature-splash', 'core-db', 'core-api'
|
|
include ':runtime'
|
|
include ':feature-account-api'
|
|
include ':feature-account-impl'
|
|
include ':feature-dapp-api'
|
|
include ':feature-dapp-impl'
|
|
include ':feature-assets'
|
|
include ':feature-nft-api'
|
|
include ':feature-nft-impl'
|
|
include ':feature-ledger-api'
|
|
include ':feature-ledger-impl'
|
|
include ':feature-currency-api'
|
|
include ':feature-currency-impl'
|
|
include ':feature-governance-api'
|
|
include ':feature-governance-impl'
|
|
include ':feature-vote'
|
|
include ':feature-versions-impl'
|
|
include ':feature-versions-api'
|
|
include ':web3names'
|
|
include ':caip'
|
|
include ':feature-external-sign-api'
|
|
include ':feature-external-sign-impl'
|
|
include ':feature-wallet-connect-api'
|
|
include ':feature-wallet-connect-impl'
|
|
include ':feature-settings-api'
|
|
include ':feature-settings-impl'
|
|
include ':feature-swap-api'
|
|
include ':feature-swap-impl'
|
|
include ':feature-buy-api'
|
|
include ':feature-buy-impl'
|
|
include ':bindings:hydra-dx-math'
|
|
include ':bindings:sr25519-bizinikiwi'
|
|
include ':bindings:pezkuwi-light'
|
|
include ':feature-proxy-impl'
|
|
include ':feature-proxy-api'
|
|
include ':feature-push-notifications'
|
|
include ':feature-deep-linking'
|
|
include ':feature-cloud-backup-api'
|
|
include ':feature-cloud-backup-impl'
|
|
include ':feature-cloud-backup-test'
|
|
include ':bindings:metadata_shortener'
|
|
include ':feature-ledger-core'
|
|
include ':feature-swap-core'
|
|
include ':feature-swap-core:api'
|
|
include ':feature-xcm:api'
|
|
include ':feature-xcm:impl'
|
|
include ':feature-banners-api'
|
|
include ':feature-banners-impl'
|
|
include ':feature-account-migration'
|
|
include ':feature-multisig:operations'
|
|
include ':feature-ahm-api'
|
|
include ':feature-ahm-impl'
|
|
include ':feature-gift-api'
|
|
include ':feature-gift-impl'
|
|
include ':feature-bridge-api'
|
|
include ':feature-bridge-impl'
|