Skip to content

Commit 7f33b8e

Browse files
hosseinkarami-devGitHub Actions Bot
andauthored
chore: regenerate client from OpenAPI (#102)
Co-authored-by: GitHub Actions Bot <automation@github.com>
1 parent 6be5f59 commit 7f33b8e

3 files changed

Lines changed: 59 additions & 0 deletions

File tree

client/src/test/kotlin/io/github/hosseinkarami_dev/near/rpc/client/ModelSerializationTests.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5015,6 +5015,22 @@ class ModelSerializationTests {
50155015
}
50165016
}
50175017

5018+
@Test
5019+
fun testTrieSplitEncodeDecode() {
5020+
val data = loadMockJson("TrieSplit.json")
5021+
assertNotNull(data, "Mock file TrieSplit.json does not exist!")
5022+
5023+
try {
5024+
val decoded = json.decodeFromString(io.github.hosseinkarami_dev.near.rpc.models.TrieSplit.serializer(), data)
5025+
val encoded = json.encodeToString(io.github.hosseinkarami_dev.near.rpc.models.TrieSplit.serializer(), decoded)
5026+
val decoded2 = json.decodeFromString(io.github.hosseinkarami_dev.near.rpc.models.TrieSplit.serializer(), encoded)
5027+
assertEquals(decoded, decoded2)
5028+
} catch (e: Exception) {
5029+
e.printStackTrace()
5030+
fail("Serialization test failed for TrieSplit: ${e.message}")
5031+
}
5032+
}
5033+
50185034
@Test
50195035
fun testTxExecutionErrorEncodeDecode() {
50205036
val data = loadMockJson("TxExecutionError.json")

models/src/main/kotlin/io/github/hosseinkarami_dev/near/rpc/models/ChunkHeaderView.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public data class ChunkHeaderView(
5050
public val prevBlockHash: CryptoHash,
5151
@SerialName("prev_state_root")
5252
public val prevStateRoot: CryptoHash,
53+
/**
54+
* * Proposed trie split for dynamic resharding
55+
* `None`: field missing (`ShardChunkHeaderInnerV4` or earlier)
56+
* `Some(None)`: field present, but not set (`ChunkHeaderInnerV5` or later)
57+
* `Some(Some(split))`: field present and set
58+
*/
59+
@SerialName("proposed_split")
60+
public val proposedSplit: TrieSplit? = null,
5361
/**
5462
* * TODO(2271): deprecated.
5563
*/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package io.github.hosseinkarami_dev.near.rpc.models
2+
3+
import kotlin.ULong
4+
import kotlinx.serialization.SerialName
5+
import kotlinx.serialization.Serializable
6+
7+
/**
8+
* * The result of splitting a memtrie into two possibly even parts, according to `memory_usage`
9+
* stored in the trie nodes.
10+
*
11+
* **NOTE: This is an artificial value calculated according to `TRIE_COST`. Hence, it does not
12+
* represent actual memory allocation, but the split ratio should be roughly consistent with that.**
13+
*/
14+
@Serializable
15+
public data class TrieSplit(
16+
/**
17+
* * Account ID representing the split path
18+
*/
19+
@SerialName("boundary_account")
20+
public val boundaryAccount: AccountId,
21+
/**
22+
* * Total `memory_usage` of the left part (excluding the split path)
23+
* * Minimum: 0.0
24+
* * Format: uint64
25+
*/
26+
@SerialName("left_memory")
27+
public val leftMemory: ULong,
28+
/**
29+
* * Total `memory_usage` of the right part (including the split path)
30+
* * Minimum: 0.0
31+
* * Format: uint64
32+
*/
33+
@SerialName("right_memory")
34+
public val rightMemory: ULong,
35+
)

0 commit comments

Comments
 (0)