Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Reduce provisioner work #12749

Merged
32 commits merged into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7b82edf
Move create_inherent_data call to use side
Nov 18, 2022
4512834
Make provide_inherent_data async
Nov 20, 2022
207d38f
Fix tests
Nov 20, 2022
db7da78
Apply suggestions from code review
Nov 20, 2022
b547ac3
Log errors
Nov 20, 2022
2d99f79
Merge branch 'alexg/reduce_provisioner_work_v2' of github.com:parityt…
Nov 20, 2022
9ec8b85
Fix test
Nov 21, 2022
be84136
Fix test
Nov 21, 2022
7afe2db
fix
Nov 21, 2022
ba46adb
Deduplicate test code
Nov 21, 2022
7f02482
fix
Nov 21, 2022
f7d687b
flag
Nov 21, 2022
f374a2f
Update client/consensus/slots/src/lib.rs
Nov 22, 2022
7267c54
Revert "Deduplicate test code"
Nov 22, 2022
38e8c30
Fix test
Nov 22, 2022
63da7f9
Merge branch 'master' into alexg/reduce_provisioner_work_v2
Nov 22, 2022
23af207
remove commented out code
Nov 23, 2022
c09f968
minor to start CI run
Nov 23, 2022
c8b5abd
start CI
Nov 23, 2022
0810c4c
Update client/consensus/slots/src/lib.rs
Nov 23, 2022
f615d60
Apply PR suggestions
Nov 25, 2022
245e0b0
Merge branch 'alexg/reduce_provisioner_work_v2' of github.com:parityt…
Nov 25, 2022
439945d
Apply PR suggestions
Nov 25, 2022
8a69c39
Update client/consensus/slots/src/lib.rs
Nov 25, 2022
ba700bc
minor
Nov 25, 2022
d8a4571
kickoff CI
Nov 26, 2022
c3c168e
PR suggestions
Nov 26, 2022
a4059fb
Compute remaining duration instead of using slot_info.duration
Nov 26, 2022
bc720d8
Don't rely on sub implementation for Instant
Nov 26, 2022
dfe3d29
Apply PR suggestions
Nov 27, 2022
e4b1de1
Use saturating_duration_since
Nov 27, 2022
2673e99
Merge remote-tracking branch 'origin/master' into alexg/reduce_provis…
Nov 29, 2022
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
Prev Previous commit
Next Next commit
PR suggestions
  • Loading branch information
alexgparity committed Nov 26, 2022
commit c3c168edefe31516bd1736179ec85cd1ea0b7d8a
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/consensus/slots/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
async-std = "1.11.0"
This conversation was marked as resolved.
Show resolved Hide resolved
async-trait = "0.1.57"
codec = { package = "parity-scale-codec", version = "3.0.0" }
futures = "0.3.21"
Expand Down
35 changes: 21 additions & 14 deletions client/consensus/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ mod slots;
pub use aux_schema::{check_equivocation, MAX_SLOT_CAPACITY, PRUNING_BOUND};
pub use slots::SlotInfo;
use slots::Slots;
use std::time::Instant;

use async_std::prelude::FutureExt;
use futures::{future::Either, Future, TryFutureExt};
use futures_timer::Delay;
use log::{debug, info, warn};
Expand Down Expand Up @@ -251,29 +251,36 @@ pub trait SimpleSlotWorker<B: BlockT> {
slot_info: &SlotInfo<B>,
logging_target: &str,
) -> Option<sp_inherents::InherentData> {
let inherent_data = match slot_info.create_inherent_data.create_inherent_data().await {
Ok(data) => data,
Err(err) => {
let inherent_data = match slot_info
.create_inherent_data
.create_inherent_data()
.timeout(slot_info.duration)
.await
{
Ok(Ok(data)) => data,
Ok(Err(err)) => {
warn!(
target: logging_target,
"Unable to create inherent data for block {:?}: {}",
slot_info.chain_head.hash(),
err,
);

return None
},
};

if Instant::now() > slot_info.ends_at {
warn!(
target: "slots",
"Creating inherent data took more time than we had left for slot {} for block {:?}.",
slot_info.slot,
slot_info.chain_head.hash(),
);
Err(err) => {
warn!(
target: logging_target,
"Creating inherent data for slot {} for block {:?} timed out: {}.",
slot_info.slot,
slot_info.chain_head.hash(),
err,
);

return None
}
return None
},
};

Some(inherent_data)
}
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/slots/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ impl<B: BlockT> SlotInfo<B> {
/// `ends_at` is calculated using `timestamp` and `duration`.
pub fn new(
slot: Slot,
inherent_data: Box<dyn InherentDataProvider>,
create_inherent_data: Box<dyn InherentDataProvider>,
duration: Duration,
chain_head: B::Header,
block_size_limit: Option<usize>,
) -> Self {
Self {
slot,
create_inherent_data: inherent_data,
create_inherent_data,
duration,
chain_head,
block_size_limit,
Expand Down