mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 03:01:02 +00:00
Reduce provisioner work (#12749)
* Move create_inherent_data call to use side * Make provide_inherent_data async * Fix tests * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * Log errors * Fix test * Fix test * fix * Deduplicate test code * fix * flag * Update client/consensus/slots/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Revert "Deduplicate test code" This reverts commit ba46adbe089329c78cd69ccdb08e27ed67bd77cf. * Fix test * remove commented out code * minor to start CI run * start CI * Update client/consensus/slots/src/lib.rs Co-authored-by: Marcin S. <marcin@bytedude.com> * Apply PR suggestions * Apply PR suggestions * Update client/consensus/slots/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * minor * kickoff CI * PR suggestions * Compute remaining duration instead of using slot_info.duration * Don't rely on sub implementation for Instant * Apply PR suggestions * Use saturating_duration_since Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Marcin S. <marcin@bytedude.com> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -83,16 +83,16 @@ pub trait InherentDataProvider: Send + Sync {
|
||||
/// Convenience function for creating [`InherentData`].
|
||||
///
|
||||
/// Basically maps around [`Self::provide_inherent_data`].
|
||||
fn create_inherent_data(&self) -> Result<InherentData, Error> {
|
||||
async fn create_inherent_data(&self) -> Result<InherentData, Error> {
|
||||
let mut inherent_data = InherentData::new();
|
||||
self.provide_inherent_data(&mut inherent_data)?;
|
||||
self.provide_inherent_data(&mut inherent_data).await?;
|
||||
Ok(inherent_data)
|
||||
}
|
||||
|
||||
/// Provide inherent data that should be included in a block.
|
||||
///
|
||||
/// The data should be stored in the given `InherentData` structure.
|
||||
fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error>;
|
||||
async fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error>;
|
||||
|
||||
/// Convert the given encoded error to a string.
|
||||
///
|
||||
@@ -108,8 +108,8 @@ pub trait InherentDataProvider: Send + Sync {
|
||||
#[async_trait::async_trait]
|
||||
impl InherentDataProvider for Tuple {
|
||||
for_tuples!( where #( Tuple: Send + Sync )* );
|
||||
fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error> {
|
||||
for_tuples!( #( Tuple.provide_inherent_data(inherent_data)?; )* );
|
||||
async fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error> {
|
||||
for_tuples!( #( Tuple.provide_inherent_data(inherent_data).await?; )* );
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user