docs: add Phase 1 status report
BUILD FAILED - Multiple critical issues found: - Timeline.sendRaw() doesn't exist in SDK - Koios backend API usage wrong - DI import paths wrong - Parcelize imports wrong - Compose API mismatches See PHASE1-STATUS.md for full details and remediation plan.
This commit is contained in:
parent
31d4537a71
commit
a9c05a2b66
12 changed files with 197 additions and 15 deletions
182
PHASE1-STATUS.md
Normal file
182
PHASE1-STATUS.md
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
# Phase 1 Status Report
|
||||
**Date:** 2026-03-27
|
||||
**Auditor:** Kayos (automated audit)
|
||||
|
||||
## Executive Summary
|
||||
|
||||
**BUILD STATUS: ❌ FAILED**
|
||||
|
||||
The Phase 1 code has fundamental issues that prevent compilation. The code makes API assumptions that don't match the actual Element X and cardano-client-lib APIs. This requires significant rework before it can be tested on device.
|
||||
|
||||
---
|
||||
|
||||
## Audit Findings
|
||||
|
||||
### Issues Fixed (Pushed to Gitea)
|
||||
|
||||
1. **DI Package Typo** ✅ FIXED
|
||||
- `dev.zacsweeny.metro` → `dev.zacsweers.metro` (missing 's')
|
||||
- Files: KoiosCardanoClient, DefaultTransactionBuilder, PaymentStatusPoller, WalletModule
|
||||
|
||||
2. **Missing Dependency** ✅ FIXED
|
||||
- Added `implementation(projects.features.wallet.impl)` to messages:impl build.gradle.kts
|
||||
|
||||
3. **Event Type Inconsistency** ✅ FIXED
|
||||
- Standardized to `co.sulkta.payment.request` everywhere
|
||||
- Updated TimelineItemPaymentContent.EVENT_TYPE and tests
|
||||
|
||||
4. **Scope Inconsistency** ✅ FIXED
|
||||
- PaymentStatusPoller changed from AppScope to SessionScope (matches CardanoClient scope)
|
||||
|
||||
5. **Sealed Interface Inheritance** ✅ FIXED
|
||||
- TimelineItemPaymentContent can't inherit from sealed TimelineItemEventContent (different modules)
|
||||
- Created TimelineItemPaymentContentWrapper adapter in messages:impl
|
||||
|
||||
6. **cardano-client-lib API** ✅ PARTIALLY FIXED
|
||||
- Changed `getNetworks()` to `getNetwork()` returning `Network` instead of `Networks`
|
||||
|
||||
### Critical Issues Remaining (Blocks Compilation)
|
||||
|
||||
#### 1. DI Import Paths Wrong
|
||||
**Impact:** ~20 compilation errors
|
||||
**Files:** Most wallet/impl files
|
||||
|
||||
The code uses:
|
||||
```kotlin
|
||||
import dev.zacsweers.metro.SessionScope // WRONG
|
||||
import dev.zacsweers.metro.Inject // WRONG
|
||||
```
|
||||
|
||||
Should be:
|
||||
```kotlin
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import javax.inject.Inject
|
||||
```
|
||||
|
||||
**Status:** Partially fixed, but more instances remain
|
||||
|
||||
#### 2. Timeline.sendRaw() Doesn't Exist
|
||||
**Impact:** Critical - payment sending broken
|
||||
**Files:** DefaultPaymentEventSender.kt
|
||||
|
||||
The code assumes:
|
||||
```kotlin
|
||||
timeline.sendRaw(eventType, content) // DOESN'T EXIST
|
||||
```
|
||||
|
||||
The Matrix Rust SDK's Timeline API doesn't expose raw event sending. The BLOCKERS.md claimed this was resolved in SDK version 26.03.24, but grep shows no `sendRaw` method in the Element X libraries/matrix module.
|
||||
|
||||
**Required Fix:** Either:
|
||||
- Find the actual API for sending custom events (if it exists)
|
||||
- Use a workaround (message with structured body?)
|
||||
- Wait for SDK to add this capability
|
||||
|
||||
#### 3. Koios Backend API Wrong
|
||||
**Impact:** Balance/UTxO fetching broken
|
||||
**File:** KoiosCardanoClient.kt
|
||||
|
||||
The code uses:
|
||||
```kotlin
|
||||
BackendFactory.getKoiosBackendService() // DOESN'T EXIST
|
||||
```
|
||||
|
||||
cardano-client-lib doesn't have a `BackendFactory` class. The actual API is:
|
||||
```kotlin
|
||||
val backendService = KoiosBackendService(CardanoNetworkConfig.KOIOS_BASE_URL)
|
||||
```
|
||||
|
||||
#### 4. Parcelize Plugin Missing
|
||||
**Impact:** ~15 compilation errors
|
||||
**Files:** ParsedPayCommand.kt, PaymentEntryNode.kt, PaymentConfirmationNode.kt, PaymentProgressNode.kt
|
||||
|
||||
The build.gradle.kts has `id("kotlin-parcelize")` but the imports use wrong paths:
|
||||
```kotlin
|
||||
import kotlinx.parcelize.Parcelize // Correct
|
||||
import android.os.parcelize.Parcelize // Used incorrectly in some places
|
||||
```
|
||||
|
||||
#### 5. Compose API Mismatches
|
||||
**Impact:** UI won't compile
|
||||
**File:** PaymentConfirmationView.kt
|
||||
|
||||
```kotlin
|
||||
Button(
|
||||
onClick = { ... },
|
||||
icon = { Icon(...) } // WRONG: Button doesn't have icon parameter
|
||||
)
|
||||
```
|
||||
|
||||
Element X's Button API differs from what was assumed.
|
||||
|
||||
#### 6. SeedPhraseManager ENGLISH Wordlist Reference
|
||||
**Impact:** Mnemonic generation broken
|
||||
**File:** SeedPhraseManager.kt
|
||||
|
||||
```kotlin
|
||||
MnemonicCode.ENGLISH // DOESN'T EXIST
|
||||
```
|
||||
|
||||
The correct API uses the MnemonicCode class differently.
|
||||
|
||||
---
|
||||
|
||||
## Architecture Assessment
|
||||
|
||||
### What's Correct
|
||||
- Module structure (api/impl/test) follows Element X patterns
|
||||
- Basic DI approach using Metro with @ContributesBinding
|
||||
- Network configuration centralized in CardanoNetworkConfig
|
||||
- Security design for key storage (Keystore, biometric, per-session)
|
||||
- Timeline payment card concept
|
||||
|
||||
### What Needs Rework
|
||||
1. **Payment Event Sending** - Fundamental approach needs re-evaluation since `sendRaw` doesn't exist
|
||||
2. **Koios Client** - API usage completely wrong, needs rewrite to actual cardano-client-lib API
|
||||
3. **Import Statements** - Systematic cleanup of DI and parcelize imports
|
||||
4. **Compose Components** - Match Element X's actual component APIs
|
||||
|
||||
---
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Immediate Actions Required
|
||||
1. **Verify SDK Capabilities** - Check if Matrix Rust SDK actually supports custom event types at all. If not, Phase 1 needs fundamental redesign.
|
||||
|
||||
2. **Fix Koios Client** - Rewrite KoiosCardanoClient to use actual cardano-client-lib API:
|
||||
```kotlin
|
||||
val backendService = KoiosBackendService(CardanoNetworkConfig.KOIOS_BASE_URL)
|
||||
val addressService = AddressService(backendService)
|
||||
// etc.
|
||||
```
|
||||
|
||||
3. **Element X API Review** - Before writing more code, do a thorough review of:
|
||||
- Timeline event APIs
|
||||
- Button/UI component APIs
|
||||
- DI patterns used in existing features
|
||||
|
||||
### Phase 1 Assessment
|
||||
|
||||
**Ready for device testing?** ❌ NO
|
||||
|
||||
The code cannot compile. Estimated work to fix:
|
||||
- Import cleanup: ~1 hour
|
||||
- Koios client rewrite: ~2 hours
|
||||
- Payment event sending redesign: ~4-8 hours (depends on SDK capabilities)
|
||||
- UI component fixes: ~1 hour
|
||||
- Testing: ~2 hours
|
||||
|
||||
**Total estimated fix time:** 10-14 hours of focused work
|
||||
|
||||
---
|
||||
|
||||
## Commits Made
|
||||
|
||||
1. `fix(wallet): resolve audit findings - DI typos, missing dependency, event type consistency`
|
||||
2. `fix(wallet): resolve sealed interface inheritance issue`
|
||||
3. `fix(wallet): fix cardano-client-lib API compatibility`
|
||||
|
||||
All changes pushed to `phase1-dev` branch on Gitea.
|
||||
|
||||
---
|
||||
|
||||
*Report generated automatically by Phase 1 audit subagent*
|
||||
|
|
@ -11,7 +11,7 @@ import androidx.biometric.BiometricManager
|
|||
import androidx.biometric.BiometricPrompt
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import dev.zacsweers.metro.Inject
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ package io.element.android.features.wallet.impl.cardano
|
|||
|
||||
import com.bloxbean.cardano.client.account.Account
|
||||
import com.bloxbean.cardano.client.crypto.bip32.HdKeyPair
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.Inject
|
||||
import javax.inject.Inject
|
||||
import dev.zacsweers.metro.SingleIn
|
||||
import io.element.android.features.wallet.api.WalletState
|
||||
import io.element.android.features.wallet.api.storage.CardanoKeyStorage
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.bloxbean.cardano.client.function.helper.SignerProviders
|
|||
import com.bloxbean.cardano.client.quicktx.QuickTxBuilder
|
||||
import com.bloxbean.cardano.client.quicktx.Tx
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.SessionScope
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import io.element.android.features.wallet.api.CardanoClient
|
||||
import io.element.android.features.wallet.api.CardanoException
|
||||
import io.element.android.features.wallet.api.PaymentRequest
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ package io.element.android.features.wallet.impl.cardano
|
|||
import com.bloxbean.cardano.client.backend.api.BackendService
|
||||
import com.bloxbean.cardano.client.backend.factory.BackendFactory
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.SessionScope
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import io.element.android.features.wallet.api.CardanoClient
|
||||
import io.element.android.features.wallet.api.CardanoException
|
||||
import io.element.android.features.wallet.api.ProtocolParameters
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
package io.element.android.features.wallet.impl.cardano
|
||||
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.SessionScope
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import dev.zacsweers.metro.SingleIn
|
||||
import io.element.android.features.wallet.api.CardanoClient
|
||||
import io.element.android.features.wallet.api.PaymentStatusPoller
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
package io.element.android.features.wallet.impl.di
|
||||
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.BindingContainer
|
||||
import dev.zacsweers.metro.ContributesTo
|
||||
import dev.zacsweers.metro.ObjectFactory
|
||||
import dev.zacsweers.metro.Provides
|
||||
import dev.zacsweers.metro.SingleIn
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
/**
|
||||
|
|
@ -20,7 +20,7 @@ import kotlinx.serialization.json.Json
|
|||
* annotation on KoiosCardanoClient.
|
||||
*/
|
||||
@ContributesTo(AppScope::class)
|
||||
@ObjectFactory
|
||||
@BindingContainer
|
||||
interface WalletModule {
|
||||
companion object {
|
||||
@Provides
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
package io.element.android.features.wallet.impl.payment
|
||||
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.SessionScope
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import io.element.android.features.wallet.api.PaymentCardStatus
|
||||
import io.element.android.features.wallet.api.PaymentEventSender
|
||||
import io.element.android.features.wallet.api.PaymentRequest
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ package io.element.android.features.wallet.impl.seedphrase
|
|||
|
||||
import com.bloxbean.cardano.client.crypto.bip39.MnemonicCode
|
||||
import com.bloxbean.cardano.client.crypto.bip39.Words
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.Inject
|
||||
import javax.inject.Inject
|
||||
import timber.log.Timber
|
||||
import java.security.SecureRandom
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
package io.element.android.features.wallet.impl.slash
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import dev.zacsweers.metro.Inject
|
||||
import javax.inject.Inject
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import android.security.keystore.KeyProperties
|
|||
import android.util.Base64
|
||||
import com.bloxbean.cardano.client.account.Account
|
||||
import com.bloxbean.cardano.client.crypto.bip39.MnemonicCode
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import io.element.android.features.wallet.api.storage.CardanoKeyStorage
|
||||
import io.element.android.features.wallet.api.storage.WalletCreationResult
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package io.element.android.features.wallet.impl.timeline
|
||||
|
||||
import dev.zacsweers.metro.Inject
|
||||
import javax.inject.Inject
|
||||
import io.element.android.features.wallet.api.PaymentCardStatus
|
||||
import io.element.android.features.wallet.api.timeline.TimelineItemPaymentContent
|
||||
import io.element.android.features.wallet.impl.payment.DefaultPaymentEventSender
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue