@dashevo/dapi-grpc 4.1.1 → 4.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -26,12 +26,30 @@ tenderdash-proto = []
26
26
  # Client support.
27
27
  client = ["platform"]
28
28
 
29
+ # Networked tonic client: `connect()` on generated clients, TLS roots.
30
+ # Deliberately NOT in the default set: cargo features are not target-scoped,
31
+ # so a default-on transport would force tonic's transport stack onto wasm32
32
+ # consumers riding defaults, where it does not build. Without this feature
33
+ # the crate provides message types and transport-generic client stubs only.
34
+ # Tonic's codegen graph still includes tokio-stream and a minimal Tokio
35
+ # slice, but its hyper/rustls transport stack is not enabled. Native
36
+ # networked consumers enable this explicitly (rs-dapi-client does so through
37
+ # its non-wasm dependency); the wasm codegen path never emits `connect()`.
38
+ transport = [
39
+ "tonic/channel",
40
+ "tonic/transport",
41
+ "tonic/tls-native-roots",
42
+ "tonic/tls-webpki-roots",
43
+ "tonic/tls-ring",
44
+ ]
45
+
29
46
  # Build tonic server code. Includes all client features and adds server-specific dependencies.
30
47
  server = [
31
48
  "platform",
32
49
  "tenderdash-proto/server",
33
50
  "client",
34
51
  "drive",
52
+ "transport",
35
53
  "tonic/router",
36
54
  ]
37
55
 
@@ -39,7 +57,7 @@ serde = ["dep:serde", "dep:serde_bytes", "tenderdash-proto/serde"]
39
57
  mocks = ["serde", "dep:serde_json"]
40
58
 
41
59
  [dependencies]
42
- tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.5.1", default-features = false }
60
+ tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.8.0", default-features = false }
43
61
 
44
62
  prost = { version = "0.14" }
45
63
  futures-core = "0.3.30"
@@ -55,14 +73,7 @@ tonic = { version = "0.14.2", features = ["codegen"], default-features = false }
55
73
  getrandom = { version = "0.2", features = ["js"] }
56
74
 
57
75
  [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
58
- tonic = { version = "0.14.2", features = [
59
- "codegen",
60
- "channel",
61
- "transport",
62
- "tls-native-roots",
63
- "tls-webpki-roots",
64
- "tls-ring",
65
- ], default-features = false }
76
+ tonic = { version = "0.14.2", features = ["codegen"], default-features = false }
66
77
 
67
78
  [build-dependencies]
68
79
  tonic-prost-build = { version = "0.14.2" }
package/build.rs CHANGED
@@ -10,6 +10,7 @@ use tonic_prost_build::Builder;
10
10
  const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#;
11
11
  const SERDE_WITH_BASE64: &str =
12
12
  r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::vec_base64string"))]"#;
13
+ const SERDE_DEFAULT: &str = r#"#[cfg_attr(feature = "serde", serde(default))]"#;
13
14
  const SERDE_WITH_STRING: &str =
14
15
  r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#;
15
16
 
@@ -69,6 +70,7 @@ fn generate_code(typ: ImplType, output_base: &Path) {
69
70
 
70
71
  println!("cargo:rerun-if-changed=./protos");
71
72
  println!("cargo:rerun-if-env-changed=CARGO_FEATURE_SERDE");
73
+ println!("cargo:rerun-if-env-changed=CARGO_FEATURE_TRANSPORT");
72
74
  println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH");
73
75
  println!("cargo:rerun-if-env-changed=DAPI_GRPC_OUT_DIR");
74
76
  }
@@ -84,10 +86,15 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
84
86
  // Derive features for versioned messages
85
87
  //
86
88
  // "GetConsensusParamsRequest" is excluded as this message does not support proofs
87
- const VERSIONED_REQUESTS: [&str; 56] = [
89
+ const VERSIONED_REQUESTS: [&str; 62] = [
90
+ "GetContractGroupInfoRequest",
91
+ "GetContractGroupMembersRequest",
92
+ "GetContractGroupsForContractRequest",
88
93
  "GetDataContractHistoryRequest",
94
+ "GetDataContractsLatestVersionsRequest",
89
95
  "GetDataContractRequest",
90
96
  "GetDataContractsRequest",
97
+ "GetDataContractsByRangeRequest",
91
98
  "GetDocumentHistoryRequest",
92
99
  "GetDocumentsRequest",
93
100
  "GetIdentitiesByPublicKeyHashesRequest",
@@ -95,6 +102,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
95
102
  "GetIdentitiesBalancesRequest",
96
103
  "GetIdentityNonceRequest",
97
104
  "GetIdentityContractNonceRequest",
105
+ "GetIdentityKeysRemainingBudgetsRequest",
98
106
  "GetIdentityBalanceAndRevisionRequest",
99
107
  "GetIdentityBalanceRequest",
100
108
  "GetIdentityByNonUniquePublicKeyHashRequest",
@@ -155,8 +163,12 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
155
163
  // - "GetIdentityByNonUniquePublicKeyHashResponse"
156
164
  //
157
165
  // "GetEvonodesProposedEpochBlocksResponse" is used for 2 Requests
158
- const VERSIONED_RESPONSES: [&str; 54] = [
166
+ const VERSIONED_RESPONSES: [&str; 59] = [
167
+ "GetContractGroupInfoResponse",
168
+ "GetContractGroupMembersResponse",
169
+ "GetContractGroupsForContractResponse",
159
170
  "GetDataContractHistoryResponse",
171
+ "GetDataContractsLatestVersionsResponse",
160
172
  "GetDataContractResponse",
161
173
  "GetDataContractsResponse",
162
174
  "GetDocumentHistoryResponse",
@@ -168,6 +180,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
168
180
  "GetIdentityBalanceResponse",
169
181
  "GetIdentityNonceResponse",
170
182
  "GetIdentityContractNonceResponse",
183
+ "GetIdentityKeysRemainingBudgetsResponse",
171
184
  "GetIdentityByPublicKeyHashResponse",
172
185
  "GetIdentityKeysResponse",
173
186
  "GetIdentityResponse",
@@ -334,6 +347,16 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
334
347
  .field_attribute("id", SERDE_WITH_BYTES)
335
348
  .field_attribute("identity_id", SERDE_WITH_BYTES)
336
349
  .field_attribute("ids", SERDE_WITH_BASE64)
350
+ // Wire-format compat for mock vectors captured before the chained
351
+ // surface existed: the field deserializes to its default when
352
+ // absent (same pattern DocumentQuery's own serde defaults follow
353
+ // for pre-SQL-surface fixtures).
354
+ .field_attribute("GetDocumentsRequestV1.chained", SERDE_DEFAULT)
355
+ .field_attribute("GetDocumentsRequestV1.sub_queries", SERDE_DEFAULT)
356
+ // Same compat rule for the typed IN_TIME_RANGE operand: mock
357
+ // vectors captured while the operand still rode `value` carry no
358
+ // `time_range` key.
359
+ .field_attribute("GetDocumentsRequest.WhereClause.time_range", SERDE_DEFAULT)
337
360
  .field_attribute("ResponseMetadata.height", SERDE_WITH_STRING)
338
361
  .field_attribute("ResponseMetadata.time_ms", SERDE_WITH_STRING)
339
362
  .field_attribute("start_at_ms", SERDE_WITH_STRING)
@@ -416,15 +439,23 @@ enum ImplType {
416
439
  impl ImplType {
417
440
  // Configure the builder based on the implementation type.
418
441
  pub fn configure(&self, builder: Builder) -> Builder {
442
+ // The `transport` cargo feature controls whether generated clients get
443
+ // the `connect()` convenience impls over tonic's own channel. Without
444
+ // it, clients are still generated but stay generic over the caller's
445
+ // transport. Never enabled for wasm32, where tonic transport does not
446
+ // build. Note: cfg!(target_arch) in a build script reflects the HOST,
447
+ // so the target must be read from CARGO_CFG_TARGET_ARCH.
448
+ let transport = std::env::var("CARGO_FEATURE_TRANSPORT").is_ok()
449
+ && std::env::var("CARGO_CFG_TARGET_ARCH").map(|arch| arch != "wasm32") == Ok(true);
419
450
  match self {
420
451
  Self::Server => builder
421
452
  .build_client(true)
422
453
  .build_server(true)
423
- .build_transport(true),
454
+ .build_transport(transport),
424
455
  Self::Client => builder
425
456
  .build_client(true)
426
457
  .build_server(false)
427
- .build_transport(true),
458
+ .build_transport(transport),
428
459
  Self::Wasm => builder
429
460
  .build_client(true)
430
461
  .build_server(false)