File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ use cumulus_pallet_parachain_system::relay_state_snapshot::RelayChainStateProof;
24
24
use cumulus_primitives_core:: ParaId ;
25
25
use cumulus_primitives_parachain_inherent:: ParachainInherentData ;
26
26
27
- use sugondat_primitives:: opaque:: { Block , Header } ;
27
+ use sugondat_primitives:: {
28
+ opaque:: { Block , Header } ,
29
+ MAX_SKIPPED_BLOCKS ,
30
+ } ;
28
31
29
32
use std:: sync:: Arc ;
30
33
use std:: time:: Duration ;
@@ -116,15 +119,6 @@ where
116
119
} ;
117
120
let relay_block_number = paras_inherent_data. validation_data . relay_parent_number ;
118
121
119
- // TODO: Change 3600 to 7200 (half a day)
120
- // and `n_skipped_blocks = relay_parent_distance.saturating_sub(1)`
121
- // when updating to asynchronous backing
122
- // https://github.com/thrumdev/blobs/issues/166
123
-
124
- // The accepted error is less than 10^(-2) for an expected
125
- // maximum of 3600 skipped blocks (half a day)
126
- const MAX_SKIPPED_BLOCKS : u32 = 3600 ;
127
-
128
122
let relay_parent_distance = relay_block_number. saturating_sub ( last_relay_block_number) ;
129
123
let n_skipped_blocks = relay_parent_distance. saturating_sub ( 2 ) / 2 ;
130
124
n_skipped_blocks >= MAX_SKIPPED_BLOCKS
Original file line number Diff line number Diff line change @@ -8,6 +8,22 @@ use sp_runtime::{
8
8
// Maximum Length of the Block in bytes
9
9
pub const MAXIMUM_BLOCK_LENGTH : u32 = 5 * 1024 * 1024 ;
10
10
11
+ /// The maximum acceptable number of skipped parachain blocks.
12
+ ///
13
+ /// This is not a hard limit, but it should be respected by block proposers
14
+ /// in order to ensure that the error in fee calculations does not exceed
15
+ /// 10^(-2). Blob runtimes use an imperfect approximation of e^x when updating fee
16
+ /// levels after long periods of inactivity. This approximation loses
17
+ /// fidelity when many blocks are skipped.
18
+ /// (https://github.com/thrumdev/blobs/issues/165)
19
+ ///
20
+ /// The value of 3600 has been chosen as it is half a day's worth of blocks
21
+ /// at a 12-second block interval.
22
+ // TODO: Change 3600 to 7200 (half a day)
23
+ // when updating to asynchronous backing
24
+ // https://github.com/thrumdev/blobs/issues/166
25
+ pub const MAX_SKIPPED_BLOCKS : BlockNumber = 3600 ;
26
+
11
27
/// An index to a block.
12
28
pub type BlockNumber = u32 ;
13
29
You can’t perform that action at this time.
0 commit comments