Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate weight of this block extrinsics #54

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
142 changes: 71 additions & 71 deletions Cargo.lock

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

4 changes: 1 addition & 3 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,16 +452,14 @@ where
// verify that all extrinsics can be executed in single block
let max = System::BlockWeights::get();
let mut all: frame_system::ConsumedWeight = Default::default();
for tx in extrinsics.iter() {
for tx in curr_block_txs.clone() {
let info = tx.clone().get_dispatch_info();
all = frame_system::calculate_consumed_weight::<CallOf<Block::Extrinsic, Context>>(max.clone(), all, &info)
.expect("sum of extrinsics should fit into single block");
}

let curr_block_inherents = curr_block_txs.clone().filter(|e| !e.is_signed().unwrap());

let curr_block_txs_count = curr_block_txs.count();
let curr_block_inherents_count = curr_block_inherents.clone().count();
let prev_block_extrinsics = prev_block_txs.filter(|e| e.is_signed().unwrap());
let tx_to_be_executed = curr_block_inherents.chain(prev_block_extrinsics).cloned().collect::<Vec<_>>();

Expand Down