Skip to content
Merged

Dev #123

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [[Unreleased]]

- missing network_id member added to server info response
- server_state_duration_us in server info type changed to str

## [[v0.5.0]]

- add missing NFT request models
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ name = "xrpl"
crate-type = ["lib"]

[dependencies]
xrpl-rust-macros = { path = "xrpl-rust-macros" }

lazy_static = "1.4.0"
sha2 = { version = "0.10.2", default-features = false }
rand_hc = "0.3.1"
Expand Down
86 changes: 39 additions & 47 deletions src/asynch/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
const REQUIRED_NETWORKID_VERSION: &str = "1.11.0";
const LEDGER_OFFSET: u8 = 20;

pub fn sign<'a, T, F>(transaction: &mut T, wallet: &Wallet, multisign: bool) -> XRPLHelperResult<()>

Check warning on line 51 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:51:81 | 51 | pub fn sign<'a, T, F>(transaction: &mut T, wallet: &Wallet, multisign: bool) -> XRPLHelperResult<()> | ^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
where
F: IntoEnumIterator + Serialize + Debug + PartialEq,
T: Transaction<'a, F> + Model + Serialize + DeserializeOwned + Clone + Debug,
Expand All @@ -61,9 +61,9 @@
let serialized_bytes = hex::decode(serialized_for_signing)?;
let signature = keypairs_sign(&serialized_bytes, &wallet.private_key)?;
let signer = Signer::new(
wallet.classic_address.clone().into(),

Check warning on line 64 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `alloc::string::String`

warning: useless conversion to the same type: `alloc::string::String` --> src/asynch/transaction/mod.rs:64:13 | 64 | wallet.classic_address.clone().into(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `wallet.classic_address.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion = note: `#[warn(clippy::useless_conversion)]` on by default
signature.into(),

Check warning on line 65 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `alloc::string::String`

warning: useless conversion to the same type: `alloc::string::String` --> src/asynch/transaction/mod.rs:65:13 | 65 | signature.into(), | ^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `signature` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
wallet.public_key.clone().into(),

Check warning on line 66 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

useless conversion to the same type: `alloc::string::String`

warning: useless conversion to the same type: `alloc::string::String` --> src/asynch/transaction/mod.rs:66:13 | 66 | wallet.public_key.clone().into(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `wallet.public_key.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
);
transaction.get_mut_common_fields().signers = Some(vec![signer]);

Expand Down Expand Up @@ -235,7 +235,7 @@
fn calculate_base_fee_for_escrow_finish<'a: 'b, 'b>(
net_fee: XRPAmount<'a>,
fulfillment: Option<Cow<str>>,
) -> XRPLHelperResult<XRPAmount<'b>> {

Check warning on line 238 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:238:6 | 238 | ) -> XRPLHelperResult<XRPAmount<'b>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
if let Some(fulfillment) = fulfillment {
calculate_based_on_fulfillment(fulfillment, net_fee)
} else {
Expand All @@ -246,7 +246,7 @@
fn calculate_based_on_fulfillment<'a>(
fulfillment: Cow<str>,
net_fee: XRPAmount<'_>,
) -> XRPLHelperResult<XRPAmount<'a>> {

Check warning on line 249 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:249:6 | 249 | ) -> XRPLHelperResult<XRPAmount<'a>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
let fulfillment_bytes: Vec<u8> = fulfillment.chars().map(|c| c as u8).collect();
let net_fee_f64: f64 = net_fee.try_into()?;
let base_fee_string =
Expand All @@ -259,7 +259,7 @@
.into())
}

fn txn_needs_network_id(common_fields: CommonFields<'_>) -> XRPLHelperResult<bool> {

Check warning on line 262 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:262:61 | 262 | fn txn_needs_network_id(common_fields: CommonFields<'_>) -> XRPLHelperResult<bool> { | ^^^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
let is_higher_restricted_networks = if let Some(network_id) = common_fields.network_id {
network_id > RESTRICTED_NETWORKS as u32
} else {
Expand All @@ -278,7 +278,7 @@
}
}

fn is_not_later_rippled_version(source: String, target: String) -> XRPLHelperResult<bool> {

Check warning on line 281 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:281:68 | 281 | fn is_not_later_rippled_version(source: String, target: String) -> XRPLHelperResult<bool> { | ^^^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
if source == target {
Ok(true)
} else {
Expand Down Expand Up @@ -379,7 +379,7 @@
}
}

fn prepare_transaction<'a, T, F>(transaction: &mut T, wallet: &Wallet) -> XRPLHelperResult<()>

Check warning on line 382 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:382:75 | 382 | fn prepare_transaction<'a, T, F>(transaction: &mut T, wallet: &Wallet) -> XRPLHelperResult<()> | ^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
where
F: IntoEnumIterator + Serialize + Debug + PartialEq,
T: Transaction<'a, F> + Serialize + DeserializeOwned + Clone,
Expand All @@ -406,7 +406,7 @@
fn validate_account_xaddress<'a, T, F>(
prepared_transaction: &mut T,
account_field: AccountFieldType,
) -> XRPLHelperResult<()>

Check warning on line 409 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:409:6 | 409 | ) -> XRPLHelperResult<()> | ^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
where
F: IntoEnumIterator + Serialize + Debug + PartialEq,
T: Transaction<'a, F> + Serialize + DeserializeOwned + Clone,
Expand Down Expand Up @@ -460,7 +460,7 @@
fn convert_to_classic_address<'a, T, F>(
transaction: &mut T,
field_name: &str,
) -> XRPLHelperResult<()>

Check warning on line 463 in src/asynch/transaction/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the `Err`-variant returned from this function is very large

warning: the `Err`-variant returned from this function is very large --> src/asynch/transaction/mod.rs:463:6 | 463 | ) -> XRPLHelperResult<()> | ^^^^^^^^^^^^^^^^^^^^ | ::: src/asynch/exceptions.rs:50:5 | 50 | XRPLClientError(#[from] XRPLClientException), | -------------------------------------------- the largest variant contains at least 136 bytes | = help: try reducing the size of `asynch::exceptions::XRPLHelperException`, for example by boxing large elements or replacing it with `Box<asynch::exceptions::XRPLHelperException>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
where
F: IntoEnumIterator + Serialize + Debug + PartialEq,
T: Transaction<'a, F> + Serialize + DeserializeOwned + Clone,
Expand Down Expand Up @@ -539,41 +539,34 @@
#[cfg(test)]
mod test_sign {
use alloc::borrow::Cow;
use core::time::Duration;

use crate::{
asynch::{
clients::AsyncJsonRpcClient,
transaction::{autofill_and_sign, sign},
wallet::generate_faucet_wallet,
},
models::transactions::{account_set::AccountSet, Transaction},
models::transactions::{
account_set::AccountSet, CommonFields, Transaction, TransactionType,
},
wallet::Wallet,
};

#[tokio::test]
async fn test_sign() {
let wallet = Wallet::new("sEdT7wHTCLzDG7ueaw4hroSTBvH7Mk5", 0).unwrap();
let mut tx = AccountSet::new(
Cow::from(wallet.classic_address.clone()),
None,
Some("10".into()),
None,
None,
None,
Some(227234),
None,
None,
None,
None,
Some("6578616d706c652e636f6d".into()), // "example.com"
None,
None,
None,
None,
None,
None,
);
let mut tx = AccountSet {
common_fields: CommonFields::from_account(&wallet.classic_address)
.with_transaction_type(TransactionType::AccountSet)
.with_fee("10".into())
.with_sequence(227234),
domain: Some("6578616d706c652e636f6d".into()), // "example.com"
..Default::default()
};

sign(&mut tx, &wallet, false).unwrap();

let expected_signature: Cow<str> =
"C3F435CFBFAE996FE297F3A71BEAB68FF5322CBF039E41A9615BC48A59FB4EC\
5A55F8D4EC0225D47056E02ECCCDF7E8FF5F8B7FAA1EBBCBF7D0491FCB2D98807"
Expand All @@ -585,32 +578,31 @@
#[tokio::test]
async fn test_autofill_and_sign() {
let client = AsyncJsonRpcClient::connect("https://testnet.xrpl-labs.com/".parse().unwrap());
let wallet = generate_faucet_wallet(&client, None, None, None, None)
.await
.unwrap();
let mut tx = AccountSet::new(
Cow::from(wallet.classic_address.clone()),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some("6578616d706c652e636f6d".into()), // "example.com"
None,
None,
None,
None,
None,
None,
);
autofill_and_sign(&mut tx, &client, &wallet, true)
.await
.unwrap();
// Add timeout and better error handling for wallet generation
let wallet = tokio::time::timeout(
Duration::from_secs(30),
generate_faucet_wallet(&client, None, None, None, None),
)
.await
.expect("Wallet generation timed out")
.expect("Failed to generate faucet wallet");

let mut tx = AccountSet {
common_fields: CommonFields::from_account(&wallet.classic_address)
.with_transaction_type(TransactionType::AccountSet),
domain: Some("6578616d706c652e636f6d".into()),
..Default::default()
};

// Add timeout for autofill_and_sign
tokio::time::timeout(
Duration::from_secs(30),
autofill_and_sign(&mut tx, &client, &wallet, true),
)
.await
.expect("Autofill and sign timed out")
.expect("Failed to autofill and sign transaction");

assert!(tx.get_common_fields().sequence.is_some());
assert!(tx.get_common_fields().txn_signature.is_some());
}
Expand Down
57 changes: 29 additions & 28 deletions src/asynch/transaction/submit_and_wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,41 +185,42 @@ where
feature = "tokio-rt"
))]
#[cfg(test)]
mod test_submit_and_wait {
mod tests {
use core::time::Duration;

use super::*;
use crate::{
asynch::{clients::AsyncJsonRpcClient, wallet::generate_faucet_wallet},
models::transactions::account_set::AccountSet,
models::transactions::{account_set::AccountSet, CommonFields, TransactionType},
};

#[tokio::test]
async fn test_submit_and_wait() {
let client = AsyncJsonRpcClient::connect("https://testnet.xrpl-labs.com/".parse().unwrap());
let wallet = generate_faucet_wallet(&client, None, None, None, None)
.await
.unwrap();
let mut tx = AccountSet::new(
Cow::from(wallet.classic_address.clone()),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some("6578616d706c652e636f6d".into()), // "example.com"
None,
None,
None,
None,
None,
None,
);
submit_and_wait(&mut tx, &client, Some(&wallet), Some(true), Some(true))
.await
.unwrap();

// Add timeout and better error handling for wallet generation
let wallet = tokio::time::timeout(
Duration::from_secs(30),
generate_faucet_wallet(&client, None, None, None, None),
)
.await
.expect("Wallet generation timed out")
.expect("Failed to generate faucet wallet");

let mut tx = AccountSet {
common_fields: CommonFields::from_account(&wallet.classic_address)
.with_transaction_type(TransactionType::AccountSet),
domain: Some("6578616d706c652e636f6d".into()),
..Default::default()
};

// Add timeout for submit_and_wait
tokio::time::timeout(
Duration::from_secs(60),
submit_and_wait(&mut tx, &client, Some(&wallet), Some(true), Some(true)),
)
.await
.expect("Submit and wait timed out")
.expect("Failed to submit and wait for transaction");
}
}
3 changes: 2 additions & 1 deletion src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ pub const MAX_URI_LENGTH: usize = 512;
pub const MAX_DOMAIN_LENGTH: usize = 256;

/// Represents the supported cryptography algorithms.
#[derive(Debug, PartialEq, Eq, Clone, EnumIter, Display, Deserialize, Serialize)]
#[derive(Debug, PartialEq, Eq, Clone, EnumIter, Display, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum CryptoAlgorithm {
#[default]
ED25519,
SECP256K1,
}
8 changes: 7 additions & 1 deletion src/models/amount/issued_currency_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ pub struct IssuedCurrencyAmount<'a> {
pub value: Cow<'a, str>,
}

impl<'a> Model for IssuedCurrencyAmount<'a> {}
impl<'a> Model for IssuedCurrencyAmount<'a> {
fn get_errors(&self) -> XRPLModelResult<()> {
self.value.parse::<f64>()?;

Ok(())
}
}

impl<'a> IssuedCurrencyAmount<'a> {
pub fn new(currency: Cow<'a, str>, issuer: Cow<'a, str>, value: Cow<'a, str>) -> Self {
Expand Down
9 changes: 8 additions & 1 deletion src/models/amount/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ impl<'a> TryInto<BigDecimal> for Amount<'a> {
}
}

impl<'a> Model for Amount<'a> {}
impl<'a> Model for Amount<'a> {
fn get_errors(&self) -> XRPLModelResult<()> {
match self {
Amount::IssuedCurrencyAmount(amount) => amount.get_errors(),
Amount::XRPAmount(amount) => amount.get_errors(),
}
}
}

impl<'a> Default for Amount<'a> {
fn default() -> Self {
Expand Down
8 changes: 7 additions & 1 deletion src/models/amount/xrp_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ use serde_json::Value;
#[derive(Debug, PartialEq, Eq, Clone, Serialize)]
pub struct XRPAmount<'a>(pub Cow<'a, str>);

impl<'a> Model for XRPAmount<'a> {}
impl<'a> Model for XRPAmount<'a> {
fn get_errors(&self) -> XRPLModelResult<()> {
self.0.parse::<u32>()?;

Ok(())
}
}

impl Default for XRPAmount<'_> {
fn default() -> Self {
Expand Down
9 changes: 8 additions & 1 deletion src/models/currency/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ pub enum Currency<'a> {
XRP(XRP<'a>),
}

impl<'a> Model for Currency<'a> {}
impl<'a> Model for Currency<'a> {
fn get_errors(&self) -> crate::models::XRPLModelResult<()> {
match self {
Currency::IssuedCurrency(issued_currency) => issued_currency.get_errors(),
Currency::XRP(xrp) => xrp.get_errors(),
}
}
}

impl<'a> Default for Currency<'a> {
fn default() -> Self {
Expand Down
18 changes: 15 additions & 3 deletions src/models/currency/xrp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::models::amount::XRPAmount;
use crate::models::currency::ToAmount;
use crate::models::Model;
use crate::models::{amount::XRPAmount, XRPLModelException};
use crate::models::{Model, XRPLModelResult};
use alloc::borrow::Cow;
use serde::{Deserialize, Serialize};

Expand All @@ -9,7 +9,19 @@ pub struct XRP<'a> {
pub currency: Cow<'a, str>,
}

impl<'a> Model for XRP<'a> {}
impl<'a> Model for XRP<'a> {
fn get_errors(&self) -> XRPLModelResult<()> {
if self.currency != "XRP" {
Err(XRPLModelException::InvalidValue {
field: "currency".into(),
expected: "XRP".into(),
found: self.currency.clone().into(),
})
} else {
Ok(())
}
}
}

impl<'a> ToAmount<'a, XRPAmount<'a>> for XRP<'a> {
fn to_amount(&self, value: Cow<'a, str>) -> XRPAmount<'a> {
Expand Down
6 changes: 6 additions & 0 deletions src/models/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ pub enum XRPLModelException {
ValueZero(String),
#[error("If the field `{field1:?}` is defined, the field `{field2:?}` must also be defined")]
FieldRequiresField { field1: String, field2: String },
#[error("The value of the field `{field:?}` is not a valid value (expected: {expected:?}, found: {found:?})")]
InvalidValue {
field: String,
expected: String,
found: String,
},

#[error("Expected field `{0}` is missing")]
MissingField(String),
Expand Down
7 changes: 7 additions & 0 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ pub struct XChainBridge<'a> {
fn default_false() -> Option<bool> {
Some(false)
}

/// Trait for validating currencies in models. This is needed to use xrpl-rust-macros for deriving validation methods.
/// This trait is implemented by models that contain fields of type `Amount`, `XRPAmount`, `IssuedCurrencyAmount`, `Currency`, `XRP`, or `IssuedCurrency`.
/// It provides a method `validate_currencies` that checks if the provided values are valid according to the XRPL specifications.
pub trait ValidateCurrencies {
fn validate_currencies(&self) -> crate::models::XRPLModelResult<()>;
}
13 changes: 10 additions & 3 deletions src/models/results/server_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub struct Info<'a> {
pub load_factor_fee_queue: Option<u32>,
/// Transaction cost multiplier excluding open ledger
pub load_factor_server: Option<u32>,
/// Network id for ledger
pub network_id: Option<u32>,
/// Number of connected peer servers
pub peers: u32,
/// List of ports listening for API commands
Expand All @@ -60,7 +62,7 @@ pub struct Info<'a> {
/// Current server state
pub server_state: Cow<'a, str>,
/// Microseconds in current state
pub server_state_duration_us: Option<u64>,
pub server_state_duration_us: Option<Cow<'a, str>>,
/// Server state accounting information
pub state_accounting: Option<Value>,
/// Current UTC time according to server
Expand Down Expand Up @@ -155,6 +157,7 @@ mod tests {
"proposers": 35
},
"load_factor": 1,
"network_id": 10,
"peers": 22,
"ports": [
{
Expand All @@ -176,7 +179,7 @@ mod tests {
],
"pubkey_node": "n9KQK8yvTDcZdGyhu2EGdDnFPEBSsY5wEGpU5GgpygTgLFsjQyPt",
"server_state": "full",
"server_state_duration_us": 91758491912,
"server_state_duration_us": "91758491912",
"time": "2023-Sep-13 22:12:31.377492 UTC",
"uptime": 91948,
"validated_ledger": {
Expand All @@ -202,13 +205,17 @@ mod tests {
assert_eq!(result.info.last_close.converge_time_s, 3);
assert_eq!(result.info.last_close.proposers, 35);
assert_eq!(result.info.load_factor, 1);
assert_eq!(result.info.network_id, Some(10));
assert_eq!(result.info.peers, 22);
assert_eq!(
result.info.pubkey_node,
"n9KQK8yvTDcZdGyhu2EGdDnFPEBSsY5wEGpU5GgpygTgLFsjQyPt"
);
assert_eq!(result.info.server_state, "full");
assert_eq!(result.info.server_state_duration_us, Some(91758491912));
assert_eq!(
result.info.server_state_duration_us,
Some("91758491912".into())
);
assert_eq!(
result.info.time,
Some("2023-Sep-13 22:12:31.377492 UTC".into())
Expand Down
Loading
Loading