Skip to content

Commit

Permalink
Merge pull request #2194 from subspace/ER-submission-constraint
Browse files Browse the repository at this point in the history
Enforce the bundles contain ER that derive from the latest domain block
  • Loading branch information
NingLin-P authored Nov 3, 2023
2 parents 05b5ea7 + 6768323 commit d529f02
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 356 deletions.
8 changes: 2 additions & 6 deletions crates/pallet-domains/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ mod benchmarks {

let mut receipt =
BlockTree::<T>::get::<_, DomainBlockNumberFor<T>>(domain_id, Zero::zero())
.first()
.and_then(BlockTreeNodes::<T>::get)
.expect("genesis receipt must exist")
.execution_receipt;
Expand All @@ -59,8 +58,6 @@ mod benchmarks {
// Create ER for the above bundle
let head_receipt_number = HeadReceiptNumber::<T>::get(domain_id);
let parent_domain_block_receipt = BlockTree::<T>::get(domain_id, head_receipt_number)
.first()
.cloned()
.expect("parent receipt must exist");
receipt = ExecutionReceipt::dummy::<DomainHashingFor<T>>(
consensus_block_number,
Expand Down Expand Up @@ -243,9 +240,8 @@ mod benchmarks {
assert_eq!(domain_obj.domain_config, domain_config);
assert_eq!(domain_obj.owner_account_id, creator);
assert!(DomainStakingSummary::<T>::get(domain_id).is_some());
assert_eq!(
BlockTree::<T>::get::<_, DomainBlockNumberFor<T>>(domain_id, Zero::zero()).len(),
1
assert!(
BlockTree::<T>::get::<_, DomainBlockNumberFor<T>>(domain_id, Zero::zero()).is_some(),
);
assert_eq!(NextDomainId::<T>::get(), domain_id + 1.into());
}
Expand Down
Loading

0 comments on commit d529f02

Please sign in to comment.