Skip to content

Commit

Permalink
Merge pull request #718 from soramitsu/staging
Browse files Browse the repository at this point in the history
staging
  • Loading branch information
PankraSerg authored Oct 26, 2022
2 parents 1132031 + a866f45 commit c19725f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ android {
}
staging {
initWith debug
signingConfig signingConfigs.ci
matchingFallbacks = ['debug']
versionNameSuffix '-staging'
applicationIdSuffix '.staging'
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '2.0.11'
versionCode = 72
versionName = '2.0.12'
versionCode = 73

// SDK and tools
compileSdkVersion = 31
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class StakingUpdatersModule {
accountValidatorPrefsUpdater,
accountNominationsUpdater,
rewardDestinationUpdater,
historyDepthUpdater,
// historyDepthUpdater,
historicalUpdateMediator,
accountControllerBalanceUpdater,
minBondUpdater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,32 @@ class StakingRelayChainScenarioRepository(
chainId = chainId
)

suspend fun getHistoryDepth(chainId: ChainId): BigInteger = localStorage.queryNonNull(
suspend fun getHistoryDepth(chainId: ChainId): BigInteger {
return try {
// for runtime version < 9290
remoteStorage.queryNonNull(
keyBuilder = { it.metadata.staking().storage("HistoryDepth").storageKey() },
binding = ::bindHistoryDepth,
chainId = chainId
)
} catch (e: NoSuchElementException) {
// for runtime version >= 9290
getHistoryDepthFromConstants(chainId)
}
}

@Deprecated("Will be removed in runtime version 9290")
suspend fun getHistoryDepthFromStorage(chainId: ChainId): BigInteger = localStorage.queryNonNull(
keyBuilder = { it.metadata.staking().storage("HistoryDepth").storageKey() },
binding = ::bindHistoryDepth,
chainId = chainId
)

suspend fun getHistoryDepthFromConstants(chainId: ChainId): BigInteger {
val runtime = runtimeFor(chainId)
return runtime.metadata.staking().numberConstant("HistoryDepth", runtime)
}

fun observeActiveEraIndex(chainId: String): Flow<BigInteger> {
return localStorage.observeNonNull(
chainId = chainId,
Expand Down

0 comments on commit c19725f

Please sign in to comment.