Skip to content

Commit

Permalink
Merge pull request #233 from sora-xor/fix/JNI_crash_on_account_creation
Browse files Browse the repository at this point in the history
fix account generation error
  • Loading branch information
arvifox authored Oct 17, 2023
2 parents e3cf779 + 5bc154c commit 7775de8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ buildscript {
xserializationjson : '1.5.1',
ktor : '2.3.1',
xbackup : '1.0.0',
xcrypto : '1.0.2',
xsubstrate : '1.0.1'
xcrypto : '1.0.3',
xsubstrate : '1.0.2'
]

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsReposito
import jp.co.soramitsu.feature_blockexplorer_api.data.SoraConfigManager
import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager
import jp.co.soramitsu.sora.substrate.runtime.SubstrateOptionsProvider
import jp.co.soramitsu.sora.substrate.substrate.deriveSeed32
import jp.co.soramitsu.xcrypto.util.fromHex
import jp.co.soramitsu.xcrypto.util.toHexString
import jp.co.soramitsu.xsubstrate.encrypt.keypair.substrate.Sr25519Keypair
Expand Down Expand Up @@ -81,7 +82,7 @@ class CredentialsRepositoryImpl constructor(
}

private suspend fun generateEntropyAndKeysFromMnemonic(mnemonic: Mnemonic): String {
val derivationResult = SubstrateSeedFactory.deriveSeed(mnemonic.words, null)
val derivationResult = SubstrateSeedFactory.deriveSeed32(mnemonic.words, null)
val keyPair = SubstrateKeypairFactory.generate(
SubstrateOptionsProvider.encryptionType,
derivationResult.seed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ class CredentialsRepositoryTest {
every { SubstrateKeypairFactory.generate(any(), any()) } returns keypair
every { SubstrateKeypairFactory.generate(any(), any(), any()) } returns keypair
every { FirebaseWrapper.log("Keys were created") } just runs
every { derivationResult.seed } returns "seed".toByteArray()
every { derivationResult.seed } returns "seedseedseedseedseedseedseedseedseedseedseedseedseedseed".toByteArray()
every { derivationResult.mnemonic } returns Mnemonic(
"",
emptyList(),
ByteArray(1) { 1 })

credentialsRepository = CredentialsRepositoryImpl(
datasource,
cryptoAssistant,
Expand Down

0 comments on commit 7775de8

Please sign in to comment.