Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 807fedc

Browse files
authored
Merge branch 'main' into fix/db/base-token-activity-query
2 parents c036bc4 + 2e7d63b commit 807fedc

File tree

6 files changed

+65
-43
lines changed

6 files changed

+65
-43
lines changed

Cargo.lock

Lines changed: 45 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ eyre = { version = "0.6", default-features = false, features = [ "track-caller",
3232
futures = { version = "0.3", default-features = false }
3333
humantime = { version = "2.1.0", default-features = false }
3434
humantime-serde = { version = "1.1", default-features = false }
35-
mongodb = { version = "2.2", default-features = false, features = [ "tokio-runtime" ] }
35+
mongodb = { version = "2.3", default-features = false, features = [ "tokio-runtime" ] }
3636
pin-project = { version = "1.0", default-features = false }
3737
prefix-hex = { version = "0.5.0", default-features = false, features = [ "primitive-types" ] }
3838
primitive-types = { version = "0.12", default-features = false }

src/bin/inx-chronicle/api/stardust/core/responses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2022 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use iota_types::api::response as iota;
4+
use iota_types::{api::response as iota, block::protocol::dto::ProtocolParametersDto};
55
use serde::{Deserialize, Serialize};
66

77
use crate::api::responses::impl_success_response;
@@ -13,7 +13,7 @@ pub struct InfoResponse {
1313
pub name: String,
1414
pub version: String,
1515
pub status: iota::StatusResponse,
16-
pub protocol: iota::ProtocolResponse,
16+
pub protocol: ProtocolParametersDto,
1717
pub base_token: iota::BaseTokenResponse,
1818
}
1919

src/bin/inx-chronicle/api/stardust/core/routes.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ use iota_types::{
3434
dto::ReceiptDto,
3535
response::{
3636
self as iota, BaseTokenResponse, BlockMetadataResponse, ConfirmedMilestoneResponse,
37-
LatestMilestoneResponse, OutputMetadataResponse, OutputWithMetadataResponse, ProtocolResponse,
38-
ReceiptsResponse, RentStructureResponse, StatusResponse, TreasuryResponse, UtxoChangesResponse,
37+
LatestMilestoneResponse, OutputMetadataResponse, OutputWithMetadataResponse, ReceiptsResponse,
38+
StatusResponse, TreasuryResponse, UtxoChangesResponse,
3939
},
4040
},
4141
block::{
42+
output::dto::RentStructureDto,
4243
payload::{dto::MilestonePayloadDto, milestone::option::dto::MilestoneOptionDto},
44+
protocol::dto::ProtocolParametersDto,
4345
BlockDto,
4446
},
4547
};
@@ -168,13 +170,13 @@ pub async fn info(database: Extension<MongoDb>) -> ApiResult<InfoResponse> {
168170
confirmed_milestone,
169171
pruning_index: oldest_milestone.milestone_index.0 - 1,
170172
},
171-
protocol: ProtocolResponse {
172-
version: protocol.version,
173+
protocol: ProtocolParametersDto {
174+
protocol_version: protocol.version,
173175
network_name: protocol.network_name,
174176
below_max_depth: protocol.below_max_depth,
175177
bech32_hrp: protocol.bech32_hrp,
176178
min_pow_score: protocol.min_pow_score,
177-
rent_structure: RentStructureResponse {
179+
rent_structure: RentStructureDto {
178180
v_byte_cost: protocol.rent_structure.v_byte_cost,
179181
v_byte_factor_data: protocol.rent_structure.v_byte_factor_data,
180182
v_byte_factor_key: protocol.rent_structure.v_byte_factor_key,

src/types/ledger/output_metadata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ fn compute_rent_structure(output: &iota_types::block::output::Output) -> RentStr
6969
output.rent_cost(
7070
&RentStructureBuilder::new()
7171
.byte_cost(byte_cost)
72-
.data_factor(data_factor)
73-
.key_factor(key_factor)
72+
.byte_factor_data(data_factor)
73+
.byte_factor_key(key_factor)
7474
.finish(),
7575
)
7676
};
@@ -153,9 +153,9 @@ mod test {
153153
for output in outputs {
154154
let rent = compute_rent_structure(&output);
155155
assert_eq!(
156-
(rent.num_data_bytes * protocol_params.rent_structure().v_byte_factor_data as u64
157-
+ rent.num_key_bytes * protocol_params.rent_structure().v_byte_factor_key as u64)
158-
* protocol_params.rent_structure().v_byte_cost as u64,
156+
(rent.num_data_bytes * protocol_params.rent_structure().byte_factor_data() as u64
157+
+ rent.num_key_bytes * protocol_params.rent_structure().byte_factor_key() as u64)
158+
* protocol_params.rent_structure().byte_cost() as u64,
159159
output.rent_cost(protocol_params.rent_structure())
160160
);
161161
}

src/types/tangle/protocol.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ pub struct RentStructure {
1717
impl From<&iota::output::RentStructure> for RentStructure {
1818
fn from(value: &iota::output::RentStructure) -> Self {
1919
Self {
20-
v_byte_cost: value.v_byte_cost,
21-
v_byte_factor_data: value.v_byte_factor_data,
22-
v_byte_factor_key: value.v_byte_factor_key,
20+
v_byte_cost: value.byte_cost(),
21+
v_byte_factor_data: value.byte_factor_data(),
22+
v_byte_factor_key: value.byte_factor_key(),
2323
}
2424
}
2525
}
@@ -28,8 +28,8 @@ impl From<RentStructure> for iota::output::RentStructure {
2828
fn from(value: RentStructure) -> Self {
2929
Self::build()
3030
.byte_cost(value.v_byte_cost)
31-
.data_factor(value.v_byte_factor_data)
32-
.key_factor(value.v_byte_factor_key)
31+
.byte_factor_data(value.v_byte_factor_data)
32+
.byte_factor_key(value.v_byte_factor_key)
3333
.finish()
3434
}
3535
}

0 commit comments

Comments
 (0)