mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-04-29 12:27:59 +00:00
Prepare for Play Store release: simplify dashboard, clean debug logs
- Simplify dashboard card: remove referral/staking/perwerde fields (not yet on-chain), keep roles + trust score + action button - Remove all debug Log.d/e/w calls added during development (PEZ_STAKE, RuntimeFactory, ExtrinsicBuilder, etc.) - Change Play Store track from beta to production - Add release notes (whatsnew-en-US)
This commit is contained in:
+17
-37
@@ -22,7 +22,6 @@ import io.novafoundation.nova.runtime.multiNetwork.ChainWithAsset
|
||||
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
|
||||
import io.novafoundation.nova.runtime.multiNetwork.chain.model.ChainId
|
||||
import io.novafoundation.nova.runtime.repository.TotalIssuanceRepository
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.emitAll
|
||||
@@ -64,12 +63,9 @@ class StakingSharedComputation(
|
||||
|
||||
return computationalCache.useSharedFlow(key, scope) {
|
||||
flow {
|
||||
Log.d("PEZ_STAKE", "activeEraFlow: fetching remote activeEra for chainId=$chainId")
|
||||
val era = stakingRepository.getActiveEraIndex(chainId)
|
||||
Log.d("PEZ_STAKE", "activeEraFlow: got remote activeEra=$era")
|
||||
emit(era)
|
||||
|
||||
Log.d("PEZ_STAKE", "activeEraFlow: starting local observation for chainId=$chainId")
|
||||
emitAll(stakingRepository.observeActiveEraIndex(chainId))
|
||||
}
|
||||
}
|
||||
@@ -80,15 +76,8 @@ class StakingSharedComputation(
|
||||
|
||||
return computationalCache.useSharedFlow(key, scope) {
|
||||
activeEraFlow(chainId, scope).map { eraIndex ->
|
||||
Log.d("PEZ_STAKE", "electedExposures: fetching validators for chainId=$chainId, era=$eraIndex")
|
||||
try {
|
||||
val exposures = stakingRepository.getElectedValidatorsExposure(chainId, eraIndex)
|
||||
Log.d("PEZ_STAKE", "electedExposures: got ${exposures.size} validators for chainId=$chainId")
|
||||
exposures to eraIndex
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "electedExposures: FAILED for chainId=$chainId, era=$eraIndex", e)
|
||||
throw e
|
||||
}
|
||||
val exposures = stakingRepository.getElectedValidatorsExposure(chainId, eraIndex)
|
||||
exposures to eraIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,32 +87,23 @@ class StakingSharedComputation(
|
||||
|
||||
return computationalCache.useSharedFlow(key, scope) {
|
||||
electedExposuresWithActiveEraFlow(chainId, scope).map { (exposures, activeEraIndex) ->
|
||||
Log.d("PEZ_STAKE", "activeEraInfo: calculating minStake for chainId=$chainId, era=$activeEraIndex, validators=${exposures.size}")
|
||||
try {
|
||||
val minBond = stakingRepository.minimumNominatorBond(chainId)
|
||||
Log.d("PEZ_STAKE", "activeEraInfo: minBond=$minBond")
|
||||
val bagListLocator = bagListRepository.bagListLocatorOrNull(chainId)
|
||||
val totalIssuance = totalIssuanceRepository.getTotalIssuance(chainId)
|
||||
val bagListScoreConverter = BagListScoreConverter.U128(totalIssuance)
|
||||
val maxElectingVoters = bagListRepository.maxElectingVotes(chainId)
|
||||
val bagListSize = bagListRepository.bagListSize(chainId)
|
||||
Log.d("PEZ_STAKE", "activeEraInfo: bagListSize=$bagListSize, maxElectingVoters=$maxElectingVoters")
|
||||
val minBond = stakingRepository.minimumNominatorBond(chainId)
|
||||
val bagListLocator = bagListRepository.bagListLocatorOrNull(chainId)
|
||||
val totalIssuance = totalIssuanceRepository.getTotalIssuance(chainId)
|
||||
val bagListScoreConverter = BagListScoreConverter.U128(totalIssuance)
|
||||
val maxElectingVoters = bagListRepository.maxElectingVotes(chainId)
|
||||
val bagListSize = bagListRepository.bagListSize(chainId)
|
||||
|
||||
val minStake = minimumStake(
|
||||
exposures = exposures.values,
|
||||
minimumNominatorBond = minBond,
|
||||
bagListLocator = bagListLocator,
|
||||
bagListScoreConverter = bagListScoreConverter,
|
||||
bagListSize = bagListSize,
|
||||
maxElectingVoters = maxElectingVoters
|
||||
)
|
||||
Log.d("PEZ_STAKE", "activeEraInfo: minStake=$minStake")
|
||||
val minStake = minimumStake(
|
||||
exposures = exposures.values,
|
||||
minimumNominatorBond = minBond,
|
||||
bagListLocator = bagListLocator,
|
||||
bagListScoreConverter = bagListScoreConverter,
|
||||
bagListSize = bagListSize,
|
||||
maxElectingVoters = maxElectingVoters
|
||||
)
|
||||
|
||||
ActiveEraInfo(activeEraIndex, exposures, minStake)
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "activeEraInfo: FAILED for chainId=$chainId", e)
|
||||
throw e
|
||||
}
|
||||
ActiveEraInfo(activeEraIndex, exposures, minStake)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -29,7 +29,6 @@ import io.novafoundation.nova.feature_wallet_api.data.network.blockhain.types.Ba
|
||||
import io.novafoundation.nova.feature_wallet_api.domain.model.Asset
|
||||
import io.novafoundation.nova.feature_wallet_api.domain.validation.sufficientBalance
|
||||
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
class DirectStakingPropertiesFactory(
|
||||
@@ -102,10 +101,7 @@ private class DirectStakingProperties(
|
||||
private val stakingChainId = stakingOption.chain.parentId ?: stakingOption.chain.id
|
||||
|
||||
override suspend fun minStake(): Balance {
|
||||
Log.d("PEZ_STAKE", "DirectStaking.minStake() called, stakingChainId=$stakingChainId")
|
||||
val result = stakingSharedComputation.minStake(stakingChainId, scope)
|
||||
Log.d("PEZ_STAKE", "DirectStaking.minStake() returned: $result")
|
||||
return result
|
||||
return stakingSharedComputation.minStake(stakingChainId, scope)
|
||||
}
|
||||
|
||||
private fun StartMultiStakingValidationSystemBuilder.noConflictingStaking() {
|
||||
|
||||
+2
-24
@@ -8,7 +8,6 @@ import io.novafoundation.nova.feature_staking_impl.domain.recommendations.settin
|
||||
import io.novafoundation.nova.feature_staking_impl.domain.staking.start.common.selection.StartMultiStakingSelection
|
||||
import io.novafoundation.nova.feature_staking_impl.domain.staking.start.setupAmount.SingleStakingRecommendation
|
||||
import io.novafoundation.nova.feature_wallet_api.data.network.blockhain.types.Balance
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.async
|
||||
|
||||
@@ -21,42 +20,21 @@ class DirectStakingRecommendation(
|
||||
) : SingleStakingRecommendation {
|
||||
|
||||
private val recommendator = scope.async {
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: creating validator recommender...")
|
||||
try {
|
||||
val result = validatorRecommenderFactory.create(scope)
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: validator recommender created")
|
||||
result
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "DirectRecommendation: validator recommender FAILED", e)
|
||||
throw e
|
||||
}
|
||||
validatorRecommenderFactory.create(scope)
|
||||
}
|
||||
|
||||
private val recommendationSettingsProvider = scope.async {
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: creating settings provider...")
|
||||
try {
|
||||
val result = recommendationSettingsProviderFactory.create(scope)
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: settings provider created")
|
||||
result
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "DirectRecommendation: settings provider FAILED", e)
|
||||
throw e
|
||||
}
|
||||
recommendationSettingsProviderFactory.create(scope)
|
||||
}
|
||||
|
||||
override suspend fun recommendedSelection(stake: Balance): StartMultiStakingSelection {
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: awaiting settings provider...")
|
||||
val provider = recommendationSettingsProvider.await()
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: got settings provider")
|
||||
val stakingChainId = stakingOption.chain.parentId ?: stakingOption.chain.id
|
||||
val maximumValidatorsPerNominator = stakingConstantsRepository.maxValidatorsPerNominator(stakingChainId, stake)
|
||||
val recommendationSettings = provider.recommendedSettings(maximumValidatorsPerNominator)
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: awaiting recommender...")
|
||||
val recommendator = recommendator.await()
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: got recommender, getting recommendations...")
|
||||
|
||||
val recommendedValidators = recommendator.recommendations(recommendationSettings)
|
||||
Log.d("PEZ_STAKE", "DirectRecommendation: got ${recommendedValidators.size} recommended validators")
|
||||
|
||||
return DirectStakingSelection(
|
||||
validators = recommendedValidators,
|
||||
|
||||
+2
-16
@@ -5,7 +5,6 @@ import io.novafoundation.nova.feature_staking_impl.domain.nominationPools.pools.
|
||||
import io.novafoundation.nova.feature_staking_impl.domain.staking.start.common.selection.StartMultiStakingSelection
|
||||
import io.novafoundation.nova.feature_staking_impl.domain.staking.start.setupAmount.SingleStakingRecommendation
|
||||
import io.novafoundation.nova.feature_wallet_api.data.network.blockhain.types.Balance
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.async
|
||||
|
||||
@@ -16,24 +15,11 @@ class NominationPoolRecommendation(
|
||||
) : SingleStakingRecommendation {
|
||||
|
||||
private val recommendator = scope.async {
|
||||
Log.d("PEZ_STAKE", "NomPoolRecommendation: creating recommender...")
|
||||
try {
|
||||
val result = nominationPoolRecommenderFactory.create(stakingOption, scope)
|
||||
Log.d("PEZ_STAKE", "NomPoolRecommendation: recommender created successfully")
|
||||
result
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "NomPoolRecommendation: recommender creation FAILED", e)
|
||||
throw e
|
||||
}
|
||||
nominationPoolRecommenderFactory.create(stakingOption, scope)
|
||||
}
|
||||
|
||||
override suspend fun recommendedSelection(stake: Balance): StartMultiStakingSelection? {
|
||||
Log.d("PEZ_STAKE", "NomPoolRecommendation: awaiting recommender...")
|
||||
val recommendedPool = recommendator.await().recommendedPool() ?: run {
|
||||
Log.d("PEZ_STAKE", "NomPoolRecommendation: no recommended pool found")
|
||||
return null
|
||||
}
|
||||
Log.d("PEZ_STAKE", "NomPoolRecommendation: recommended pool=${recommendedPool.id}")
|
||||
val recommendedPool = recommendator.await().recommendedPool() ?: return null
|
||||
|
||||
return NominationPoolSelection(recommendedPool, stakingOption, stake)
|
||||
}
|
||||
|
||||
+3
-17
@@ -13,7 +13,6 @@ import io.novafoundation.nova.feature_staking_impl.domain.staking.start.setupAmo
|
||||
import io.novafoundation.nova.feature_wallet_api.data.network.blockhain.types.Balance
|
||||
import io.novafoundation.nova.feature_wallet_api.data.repository.BalanceLocksRepository
|
||||
import io.novafoundation.nova.feature_wallet_api.domain.model.Asset
|
||||
import android.util.Log
|
||||
import kotlin.coroutines.cancellation.CancellationException
|
||||
|
||||
class AutomaticMultiStakingSelectionType(
|
||||
@@ -46,14 +45,8 @@ class AutomaticMultiStakingSelectionType(
|
||||
}
|
||||
|
||||
override suspend fun updateSelectionFor(stake: Balance) {
|
||||
Log.d("PEZ_STAKE", "updateSelectionFor: stake=$stake")
|
||||
val stakingProperties = typePropertiesFor(stake)
|
||||
Log.d("PEZ_STAKE", "updateSelectionFor: got properties type=${stakingProperties.stakingType}")
|
||||
val candidates = stakingProperties.recommendation.recommendedSelection(stake) ?: run {
|
||||
Log.d("PEZ_STAKE", "updateSelectionFor: recommendedSelection returned null, returning")
|
||||
return
|
||||
}
|
||||
Log.d("PEZ_STAKE", "updateSelectionFor: got recommended selection")
|
||||
val candidates = stakingProperties.recommendation.recommendedSelection(stake) ?: return
|
||||
|
||||
val recommendableSelection = RecommendableMultiStakingSelection(
|
||||
source = SelectionTypeSource.Automatic,
|
||||
@@ -62,25 +55,18 @@ class AutomaticMultiStakingSelectionType(
|
||||
)
|
||||
|
||||
selectionStore.updateSelection(recommendableSelection)
|
||||
Log.d("PEZ_STAKE", "updateSelectionFor: selection updated successfully")
|
||||
}
|
||||
|
||||
private suspend fun typePropertiesFor(stake: Balance): SingleStakingProperties {
|
||||
Log.d("PEZ_STAKE", "typePropertiesFor: trying ${candidates.size} candidates")
|
||||
for ((index, candidate) in candidates.withIndex()) {
|
||||
Log.d("PEZ_STAKE", "typePropertiesFor: checking candidate $index type=${candidate.stakingType}")
|
||||
for (candidate in candidates) {
|
||||
try {
|
||||
val minStake = candidate.minStake()
|
||||
Log.d("PEZ_STAKE", "typePropertiesFor: candidate $index minStake=$minStake, stake=$stake, allows=${minStake <= stake}")
|
||||
if (minStake <= stake) return candidate
|
||||
} catch (e: CancellationException) {
|
||||
Log.d("PEZ_STAKE", "typePropertiesFor: candidate $index cancelled, rethrowing")
|
||||
throw e
|
||||
} catch (e: Exception) {
|
||||
Log.e("PEZ_STAKE", "typePropertiesFor: candidate $index minStake() threw", e)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
Log.d("PEZ_STAKE", "typePropertiesFor: no candidate allows, finding minimum")
|
||||
return candidates.findWithMinimumStake()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user