Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab14b90
HRMP: Update the impl guide
pepyakin Oct 28, 2020
c318044
HRMP: Incorporate the channel notifications into the guide
pepyakin Sep 30, 2020
130accb
HRMP: Renaming in the impl guide
pepyakin Oct 28, 2020
e1e4eb0
HRMP: Constrain the maximum number of HRMP messages per candidate
pepyakin Oct 28, 2020
8ef66ec
XCM: Introduce HRMP related message types
pepyakin Sep 30, 2020
196c4a4
HRMP: Data structures and plumbing
pepyakin Sep 14, 2020
71bb7a6
HRMP: Configuration
pepyakin Sep 19, 2020
3dacd77
HRMP: Data layout
pepyakin Oct 6, 2020
6e7979b
HRMP: Acceptance & Enactment
pepyakin Sep 23, 2020
8363874
HRMP: Test base logic
pepyakin Nov 4, 2020
e6a84dc
Update adder collator
pepyakin Nov 2, 2020
19f01ac
HRMP: Runtime API for accessing inbound messages
pepyakin Nov 3, 2020
d61440b
HRMP: Add diagnostic logging in acceptance criteria
pepyakin Nov 3, 2020
71aa0bb
HRMP: Additional tests
pepyakin Nov 4, 2020
f4b03ce
Self-review fixes
pepyakin Nov 5, 2020
0fe6c9a
save test refactorings for the next time
pepyakin Nov 5, 2020
0dce9f8
Missed a return statement.
pepyakin Nov 5, 2020
3555327
a formatting blip
pepyakin Nov 5, 2020
af77075
Add missing logic for appending HRMP digests
pepyakin Nov 5, 2020
1b2368b
Remove the channel contents vectors which became empty
pepyakin Nov 5, 2020
02945d9
Tighten HRMP channel digests invariants.
pepyakin Nov 5, 2020
8448078
Apply suggestions from code review
pepyakin Nov 6, 2020
ee5078f
Remove a note about sorting for channel id
pepyakin Nov 6, 2020
37c1fdd
Add missing rustdocs to the configuration
pepyakin Nov 6, 2020
be1013c
Clarify and update the invariant for HrmpChannelDigests
pepyakin Nov 6, 2020
e546c3c
Make the onboarding invariant less sloppy
pepyakin Nov 6, 2020
9e6e3c2
Make `CandidateCheckContext` use T::BlockNumber for hrmp_watermark
pepyakin Nov 6, 2020
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
Add missing logic for appending HRMP digests
  • Loading branch information
pepyakin committed Nov 5, 2020
commit af7707519104d600118ea9c89328a1fdc0b8e4c1
25 changes: 25 additions & 0 deletions runtime/parachains/src/router/hrmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,31 @@ impl<T: Trait> Module<T> {
<Self as Store>::HrmpChannels::insert(&channel_id, channel);
<Self as Store>::HrmpChannelContents::append(&channel_id, inbound);

// The digests are sorted in ascending by block number order. Assuming absence of
// contextual execution, there are only two possible scenarios here:
//
// (a) It's the first time anybody sends a message to this recipient within this block.
// In this case, the digest vector would be empty or the block number of the latest
// entry is smaller than the current.
//
// (b) Somebody has already sent a message within the current block. That means that
// the block number of the latest entry is equal to the current.
//
// Note that having the latest entry greater than the current block number is a logical
// error.
let mut recipient_digest =
<Self as Store>::HrmpChannelDigests::get(&channel_id.recipient);
if let Some(cur_block_digest) = recipient_digest
.last_mut()
.filter(|(block_no, _)| *block_no == now)
.map(|(_, ref mut d)| d)
{
cur_block_digest.push(sender);
} else {
recipient_digest.push((now, vec![sender]));
}
<Self as Store>::HrmpChannelDigests::insert(&channel_id.recipient, recipient_digest);

weight += T::DbWeight::get().reads_writes(2, 2);
}

Expand Down