ton-community / ton-kotlin

Kotlin/Multiplatform SDK for The Open Network
Apache License 2.0
112 stars 23 forks source link

First depth mismatch in Testnet #84

Open 90K2 opened 1 year ago

90K2 commented 1 year ago

!!! TESTNET !!!

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ActiveProfiles
import org.ton.api.liteclient.config.LiteClientConfigGlobal
import org.ton.api.liteserver.LiteServerDesc
import org.ton.api.pub.PublicKeyEd25519
import org.ton.api.tonnode.TonNodeBlockId
import org.ton.api.validator.config.ValidatorConfigGlobal
import org.ton.crypto.base64
import org.ton.lite.client.LiteClient

class Test {

    @Test
    fun `get block`() {
        val liteClient = LiteClient(
                coroutineContext = Dispatchers.Default,
                liteClientConfigGlobal = LiteClientConfigGlobal(
                        liteServers = listOf(
                                LiteServerDesc(id = PublicKeyEd25519(base64("p2tSiaeSqX978BxE5zLxuTQM06WVDErf5/15QToxMYA=")), ip = 1097649206, port = 29296)
                        )
                )
        )
        runBlocking {
            liteClient.getLastBlockId().let {
                liteClient.getBlock(it)
            }
        }
    }
}

We are getting next exception and coroutine does not closing

Exception in thread "DefaultDispatcher-worker-7 @coroutine#13" java.lang.IllegalStateException: First depth mismatch in merkle update cell:
merkle depth: -64
 child depth: 32
       data: 041f689bbd35a85569a7002be10a7879e618c8681ef017d8482a81e3cd9533619395432bd79c5e7e3515aae485948c0355d91c15f7b4dbd3fb5113dafc79513ef101c001c0
    at org.ton.cell.CellImpl$Companion.of(CellImpl.kt:163)
    at org.ton.cell.Cell$Companion.of(Cell.kt:118)
    at org.ton.boc.BagOfCellsUtilsKt$createCell$2.invokeSuspend(BagOfCellsUtils.kt:338)
    (Coroutine boundary)
    at org.ton.boc.BagOfCellsUtilsKt$readBagOfCell$3$1$1.invokeSuspend(BagOfCellsUtils.kt:137)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [CoroutineId(11), "coroutine#11":StandaloneCoroutine{Cancelling}@139c1847, Dispatchers.Default]
Caused by: java.lang.IllegalStateException: First depth mismatch in merkle update cell:
merkle depth: -64
 child depth: 32
       data: 041f689bbd35a85569a7002be10a7879e618c8681ef017d8482a81e3cd9533619395432bd79c5e7e3515aae485948c0355d91c15f7b4dbd3fb5113dafc79513ef101c001c0
    at org.ton.cell.CellImpl$Companion.of(CellImpl.kt:163)
    at org.ton.cell.Cell$Companion.of(Cell.kt:118)
    at org.ton.boc.BagOfCellsUtilsKt$createCell$2.invokeSuspend(BagOfCellsUtils.kt:338)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)