Skip to content

Commit

Permalink
Fix mandatory parameter in health endpoints (#869)
Browse files Browse the repository at this point in the history
* write serde(default) for scalar health parameter
* fix clippy
  • Loading branch information
bragov4ik authored May 8, 2024
1 parent 7af10d2 commit a345d35
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub async fn upsert_many<C: ConnectionTrait>(

fn compute_id(height: u64, commitment: &[u8]) -> Vec<u8> {
// commitment is not unique, but the combination of the height and commitment is
Sha3_256::digest([&height.to_be_bytes()[..], &commitment].concat())
Sha3_256::digest([&height.to_be_bytes()[..], commitment].concat())
.as_slice()
.to_vec()
}
4 changes: 4 additions & 0 deletions da-indexer/da-indexer-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ fn compile(
.bytes(["."])
.btree_map(["."])
.type_attribute(".", "#[actix_prost_macros::serde]")
.field_attribute(
".blockscout.daIndexer.v1.HealthCheckRequest.service",
"#[serde(default)]"
)
// .field_attribute(
// ".blockscout.daIndexer.v1.<MessageName>.<DefaultFieldName>",
// "#[serde(default)]"
Expand Down
4 changes: 4 additions & 0 deletions sig-provider/sig-provider-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ fn compile(
.protoc_arg("grpc_api_configuration=proto/api_config_http.yaml,output_format=yaml,allow_merge=true,merge_file_name=sig-provider")
.bytes(["."])
.type_attribute(".", "#[actix_prost_macros::serde]")
.field_attribute(
".blockscout.sig_provider.v1.HealthCheckRequest.service",
"#[serde(default)]"
)
.message_attribute(".", "#[derive(Eq, Hash)]");
config.compile_protos(protos, includes)?;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ fn compile(
.bytes(["."])
.btree_map(["."])
.type_attribute(".", "#[actix_prost_macros::serde]")
.field_attribute(
".blockscout.smartContractVerifier.v2.HealthCheckRequest.service",
"#[serde(default)]"
)
.field_attribute(
".blockscout.smartContractVerifier.v2.VerifyVyperMultiPartRequest.interfaces",
"#[serde(default)]"
Expand Down
4 changes: 4 additions & 0 deletions stats/stats-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ fn compile(
.protoc_arg("grpc_api_configuration=proto/api_config_http.yaml,output_format=yaml,allow_merge=true,merge_file_name=stats")
.bytes(["."])
.type_attribute(".", "#[actix_prost_macros::serde]")
.field_attribute(
".blockscout.stats.v1.HealthCheckRequest.service",
"#[serde(default)]"
)
.field_attribute(".blockscout.stats.v1.Point.is_approximate", "#[serde(skip_serializing_if = \"std::ops::Not::not\")]")
.field_attribute(".blockscout.stats.v1.Point.is_approximate", "#[serde(default)]");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn flatten_geth_trace(root: CallFrame) -> Vec<CommonCallTrace> {
}
if let Some(calls) = &frame.calls {
if calls.len() > idx {
path.push((&frame, idx + 1));
path.push((frame, idx + 1));
path.push((&calls[idx], 0));
}
}
Expand Down
4 changes: 4 additions & 0 deletions user-ops-indexer/user-ops-indexer-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ fn compile(
.protoc_arg("grpc_api_configuration=proto/api_config_http.yaml,output_format=yaml,allow_merge=true,merge_file_name=user-ops-indexer,json_names_for_fields=false")
.bytes(["."])
.type_attribute(".", "#[actix_prost_macros::serde(rename_all=\"snake_case\")]")
.field_attribute(
".blockscout.userOpsIndexer.v1.HealthCheckRequest.service",
"#[serde(default)]"
)
.field_attribute(".blockscout.userOpsIndexer.v1.UserOp.raw", "#[serde(rename=\"raw\")]");

config.compile_protos(protos, includes)?;
Expand Down

0 comments on commit a345d35

Please sign in to comment.