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

Commit

Permalink
Remove seal digests from the block
Browse files Browse the repository at this point in the history
  • Loading branch information
athei committed Feb 28, 2022
1 parent c67a219 commit a1e7de8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/rpc/src/chain/chain_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sp_api::{ApiExt, Core, ProvideRuntimeApi};
use sp_blockchain::HeaderBackend;
use sp_core::Encode;
use sp_runtime::{
generic::{BlockId, SignedBlock},
generic::{BlockId, DigestItem, SignedBlock},
traits::{Block as BlockT, Header},
};
use std::{marker::PhantomData, sync::Arc};
Expand Down Expand Up @@ -90,7 +90,9 @@ where
.block(&BlockId::Hash(self.unwrap_or_best(hash)))
.map_err(client_err)?;
if let Some(block) = block {
block.block
let (mut header, body) = block.block.deconstruct();
header.digest_mut().logs.retain(|item| !matches!(item, DigestItem::Seal(_, _)));
Block::new(header, body)
} else {
return Ok(None)
}
Expand All @@ -108,11 +110,10 @@ where
let block_len = block.encoded_size() as u64;
let block_num_extrinsics = block.extrinsics().len() as u64;
let pre_root = *parent_block.header().state_root();
let parent_hash = block.header().parent_hash();
let mut runtime_api = self.client.runtime_api();
runtime_api.record_proof();
runtime_api
.execute_block(&BlockId::Hash(*parent_hash), block)
.execute_block(&BlockId::Hash(parent_block.hash()), block)
.map_err(|err| Error::Client(Box::new(err)))?;
let witness = runtime_api
.extract_proof()
Expand Down
1 change: 1 addition & 0 deletions primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ impl<R> TransactionOutcome<R> {

#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
pub struct BlockStats {
pub witness_len: u64,
pub witness_compact_len: u64,
Expand Down

0 comments on commit a1e7de8

Please sign in to comment.