From da365bdb23a08636f5df40705f95a9d627d03e96 Mon Sep 17 00:00:00 2001 From: Dimitris Apostolou Date: Sat, 18 Jan 2025 16:03:02 +0200 Subject: [PATCH] fix: fix typos --- book/src/dev/rfcs/0006-contextual-difficulty.md | 8 ++++---- zebra-chain/src/amount.rs | 2 +- zebra-chain/src/amount/tests/vectors.rs | 4 ++-- .../common/get_block_template_rpcs/get_block_template.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/book/src/dev/rfcs/0006-contextual-difficulty.md b/book/src/dev/rfcs/0006-contextual-difficulty.md index dc27692adb2..accc8f00332 100644 --- a/book/src/dev/rfcs/0006-contextual-difficulty.md +++ b/book/src/dev/rfcs/0006-contextual-difficulty.md @@ -421,7 +421,7 @@ fn mean_target_difficulty(&self) -> ExpandedDifficulty { ... } Since the `PoWLimit`s are `2^251 − 1` for Testnet, and `2^243 − 1` for Mainnet, the sum of these difficulty thresholds will be less than or equal to `(2^251 − 1)*17 = 2^255 + 2^251 - 17`. Therefore, this calculation can not -overflow a `u256` value. So the function is infalliable. +overflow a `u256` value. So the function is infallible. In Zebra, contextual validation starts after Canopy activation, so we can assume that the relevant chain contains at least 17 blocks. Therefore, the `PoWLimit` @@ -499,7 +499,7 @@ that the relevant chain contains at least 28 blocks. Therefore: * there is always an odd number of blocks in `MedianTime()`, so the median is always the exact middle of the sequence. -Therefore, the function is infalliable. +Therefore, the function is infallible. ### Test network minimum difficulty calculation [test-net-min-difficulty-calculation]: #test-net-min-difficulty-calculation @@ -580,7 +580,7 @@ In Zcash, the Testnet minimum difficulty rule starts at block 299188, and in Zebra, contextual validation starts after Canopy activation. So we can assume that there is always a previous block. -Therefore, this function is infalliable. +Therefore, this function is infallible. ### Block difficulty threshold calculation [block-difficulty-threshold-calculation]: #block-difficulty-threshold-calculation @@ -647,7 +647,7 @@ Note that the multiplication by `ActualTimespanBounded` must happen after the division by `AveragingWindowTimespan`. Performing the multiplication first could overflow. -If implemented in this way, the function is infalliable. +If implemented in this way, the function is infallible. `zcashd` truncates the `MeanTarget` after the mean calculation, and after dividing by `AveragingWindowTimespan`. But as long as there is no overflow, diff --git a/zebra-chain/src/amount.rs b/zebra-chain/src/amount.rs index f4a81c14893..4b10699102a 100644 --- a/zebra-chain/src/amount.rs +++ b/zebra-chain/src/amount.rs @@ -416,7 +416,7 @@ where } } -// TODO: add infalliable impls for NonNegative <-> NegativeOrZero, +// TODO: add infallible impls for NonNegative <-> NegativeOrZero, // when Rust uses trait output types to disambiguate overlapping impls. impl std::ops::Neg for Amount where diff --git a/zebra-chain/src/amount/tests/vectors.rs b/zebra-chain/src/amount/tests/vectors.rs index 933b2824d41..e3b1fb78d47 100644 --- a/zebra-chain/src/amount/tests/vectors.rs +++ b/zebra-chain/src/amount/tests/vectors.rs @@ -180,12 +180,12 @@ fn deserialize_checks_bounds() -> Result<()> { let mut big_bytes = Vec::new(); (&mut big_bytes) .write_u64::(big) - .expect("unexpected serialization failure: vec should be infalliable"); + .expect("unexpected serialization failure: vec should be infallible"); let mut neg_bytes = Vec::new(); (&mut neg_bytes) .write_i64::(neg) - .expect("unexpected serialization failure: vec should be infalliable"); + .expect("unexpected serialization failure: vec should be infallible"); Amount::::zcash_deserialize(big_bytes.as_slice()) .expect_err("deserialization should reject too large values"); diff --git a/zebrad/tests/common/get_block_template_rpcs/get_block_template.rs b/zebrad/tests/common/get_block_template_rpcs/get_block_template.rs index b13c7f04236..a91c500834f 100644 --- a/zebrad/tests/common/get_block_template_rpcs/get_block_template.rs +++ b/zebrad/tests/common/get_block_template_rpcs/get_block_template.rs @@ -34,7 +34,7 @@ use crate::common::{ /// This ensures that a new template can be deserialized and sent to interrupt the /// block proposal requests if the old template is no longer valid in edge-cases where /// an old template becomes invalid right after it's returned. We've seen the getblocktemplate -/// respond within ~50ms of a request locallly, and this test is run on GCP compute instances +/// respond within ~50ms of a request locally, and this test is run on GCP compute instances /// that should offer comparable latency in CI. pub const EXTRA_LONGPOLL_WAIT_TIME: Duration = Duration::from_millis(150);