Skip to content

Commit 3bba61d

Browse files
authored
Merge pull request #3632 from autonomys/allow-1-segment-diff-in-solution
Allow 1 segment diff in solution when checking for future history
2 parents fc7532f + 2d321d9 commit 3bba61d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • crates/subspace-verification/src

crates/subspace-verification/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use alloc::string::String;
1818
use alloc::vec::Vec;
1919
use core::mem;
2020
#[cfg(feature = "kzg")]
21+
use core::num::NonZeroU64;
22+
#[cfg(feature = "kzg")]
2123
use core::simd::Simd;
2224
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
2325
use schnorrkel::SignatureError;
@@ -263,7 +265,12 @@ where
263265
sector_expiration_check_segment_commitment,
264266
}) = piece_check_params
265267
{
266-
if &solution.history_size > current_history_size {
268+
// `+1` here is due to the possibility of plotting a sector that was just archived and whose
269+
// segment root is just being included in this very block we're checking (parent block,
270+
// which is where `current_history_size` comes from doesn't know about this block yet)
271+
if NonZeroU64::from(solution.history_size).get()
272+
> NonZeroU64::from(*current_history_size).get() + 1
273+
{
267274
return Err(Error::FutureHistorySize {
268275
current: *current_history_size,
269276
solution: solution.history_size,

0 commit comments

Comments
 (0)