Skip to content

Commit 0201992

Browse files
hosseinkarami-devGitHub Actions Bot
andauthored
chore: regenerate client from OpenAPI (#88)
Co-authored-by: GitHub Actions Bot <[email protected]>
1 parent 70a170f commit 0201992

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

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
@@ -983,6 +983,22 @@ class ModelSerializationTests {
983983
}
984984
}
985985

986+
@Test
987+
fun testDynamicReshardingConfigViewEncodeDecode() {
988+
val data = loadMockJson("DynamicReshardingConfigView.json")
989+
assertNotNull(data, "Mock file DynamicReshardingConfigView.json does not exist!")
990+
991+
try {
992+
val decoded = json.decodeFromString(io.github.hosseinkarami_dev.near.rpc.models.DynamicReshardingConfigView.serializer(), data)
993+
val encoded = json.encodeToString(io.github.hosseinkarami_dev.near.rpc.models.DynamicReshardingConfigView.serializer(), decoded)
994+
val decoded2 = json.decodeFromString(io.github.hosseinkarami_dev.near.rpc.models.DynamicReshardingConfigView.serializer(), encoded)
995+
assertEquals(decoded, decoded2)
996+
} catch (e: Exception) {
997+
e.printStackTrace()
998+
fail("Serialization test failed for DynamicReshardingConfigView: ${e.message}")
999+
}
1000+
}
1001+
9861002
@Test
9871003
fun testEpochIdEncodeDecode() {
9881004
val data = loadMockJson("EpochId.json")
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
* * Configuration for dynamic resharding feature
9+
*/
10+
@Serializable
11+
public data class DynamicReshardingConfigView(
12+
/**
13+
* * Maximum number of shards in the network.
14+
*
15+
* See [`CongestionControlConfig`] for more details.
16+
* * Minimum: 0.0
17+
* * Format: uint64
18+
*/
19+
@SerialName("max_number_of_shards")
20+
public val maxNumberOfShards: ULong,
21+
/**
22+
* * Memory threshold over which a shard is marked for a split.
23+
*
24+
* See [`CongestionControlConfig`] for more details.
25+
* * Minimum: 0.0
26+
* * Format: uint64
27+
*/
28+
@SerialName("memory_usage_threshold")
29+
public val memoryUsageThreshold: ULong,
30+
/**
31+
* * Minimum memory usage of a child shard.
32+
*
33+
* See [`CongestionControlConfig`] for more details.
34+
* * Minimum: 0.0
35+
* * Format: uint64
36+
*/
37+
@SerialName("min_child_memory_usage")
38+
public val minChildMemoryUsage: ULong,
39+
/**
40+
* * Minimum number of epochs until next resharding can be scheduled.
41+
*
42+
* See [`CongestionControlConfig`] for more details.
43+
* * Minimum: 0.0
44+
* * Format: uint64
45+
*/
46+
@SerialName("min_epochs_between_resharding")
47+
public val minEpochsBetweenResharding: ULong,
48+
)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public data class RuntimeConfigView(
1818
*/
1919
@SerialName("congestion_control_config")
2020
public val congestionControlConfig: CongestionControlConfigView? = null,
21+
/**
22+
* * Configuration for dynamic resharding feature.
23+
*/
24+
@SerialName("dynamic_resharding_config")
25+
public val dynamicReshardingConfig:
26+
DynamicReshardingConfigView? = DynamicReshardingConfigView(maxNumberOfShards = 999999999999999.toULong(), memoryUsageThreshold = 999999999999999.toULong(), minChildMemoryUsage = 999999999999999.toULong(), minEpochsBetweenResharding = 999999999999999.toULong()),
2127
/**
2228
* * Amount of yN per byte required to have on the account. See
2329
* <https://nomicon.io/Economics/Economics.html#state-stake> for details.

0 commit comments

Comments
 (0)