Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
Emit event for >5MiB PoV blocks
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Jan 17, 2023
commit a0769f718a7c81f705bfb0222c8abfa677a69e9d
45 changes: 38 additions & 7 deletions frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,33 @@ pub mod pallet {
#[pallet::event]
pub enum Event<T: Config> {
/// An extrinsic completed successfully.
ExtrinsicSuccess { dispatch_info: DispatchInfo },
ExtrinsicSuccess {
dispatch_info: DispatchInfo,
},
/// An extrinsic failed.
ExtrinsicFailed { dispatch_error: DispatchError, dispatch_info: DispatchInfo },
ExtrinsicFailed {
dispatch_error: DispatchError,
dispatch_info: DispatchInfo,
},
/// `:code` was updated.
CodeUpdated,
/// A new account was created.
NewAccount { account: T::AccountId },
NewAccount {
account: T::AccountId,
},
/// An account was reaped.
KilledAccount { account: T::AccountId },
KilledAccount {
account: T::AccountId,
},
/// On on-chain remark happened.
Remarked { sender: T::AccountId, hash: T::Hash },
Remarked {
sender: T::AccountId,
hash: T::Hash,
},
PovSoftLimitExceeded {
limit: u64,
consumed: u64,
},
}

/// Error for the System pallet
Expand Down Expand Up @@ -1338,7 +1354,22 @@ impl<T: Config> Pallet<T> {
/// Remove temporary "environment" entries in storage, compute the storage root and return the
/// resulting header for this block.
pub fn finalize() -> T::Header {
log::debug!(
// Check the soft weight limit.
let consumed = BlockWeight::<T>::get();
if consumed.total().proof_size() > 5 * 1024 * 1024 {
log::warn!(
target: LOG_TARGET,
"Block {:?} consumed more than 5MiB of proof size",
Self::block_number()
);
// emit an event
Self::deposit_event(Event::PovSoftLimitExceeded {
limit: 5 * 1024 * 1024,
consumed: consumed.total().proof_size(),
});
}

/*log::debug!(
target: LOG_TARGET,
"[{:?}] {} extrinsics, length: {} (normal {}%, op: {}%, mandatory {}%) / normal weight:\
{} ({}%) op weight {} ({}%) / mandatory weight {} ({}%)",
Expand Down Expand Up @@ -1372,7 +1403,7 @@ impl<T: Config> Pallet<T> {
Self::block_weight().get(DispatchClass::Mandatory).ref_time(),
T::BlockWeights::get().get(DispatchClass::Mandatory).max_total.unwrap_or(Bounded::max_value()).ref_time()
).deconstruct(),
);
);*/
ExecutionPhase::<T>::kill();
AllExtrinsicsLen::<T>::kill();

Expand Down