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

Add CustomDigestItem type #1053

Merged
merged 10 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions parachain/Cargo.lock

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

13 changes: 8 additions & 5 deletions parachain/pallets/outbound-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod mock;
#[cfg(test)]
mod test;

use bridge_hub_common::AggregateMessageOrigin;
use bridge_hub_common::{AggregateMessageOrigin, CustomDigestItem};
use codec::Decode;
use frame_support::{
storage::StorageStreamIter,
Expand All @@ -104,7 +104,10 @@ use snowbridge_core::{
use snowbridge_outbound_queue_merkle_tree::merkle_root;
pub use snowbridge_outbound_queue_merkle_tree::MerkleProof;
use sp_core::{H256, U256};
use sp_runtime::traits::{CheckedDiv, Hash};
use sp_runtime::{
traits::{CheckedDiv, Hash},
DigestItem,
};
use sp_std::prelude::*;
pub use types::{CommittedMessage, FeeConfigRecord, ProcessMessageOriginOf};
pub use weights::WeightInfo;
Expand Down Expand Up @@ -277,10 +280,10 @@ pub mod pallet {
// Create merkle root of messages
let root = merkle_root::<<T as Config>::Hashing, _>(MessageLeaves::<T>::stream_iter());

let digest_item: DigestItem = CustomDigestItem::Snowbridge(root).into();

// Insert merkle root into the header digest
<frame_system::Pallet<T>>::deposit_log(sp_runtime::DigestItem::Other(
root.to_fixed_bytes().into(),
));
<frame_system::Pallet<T>>::deposit_log(digest_item);

Self::deposit_event(Event::MessagesCommitted { root, count });
}
Expand Down
Loading