Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Encode DigestItem with the prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong authored and vgeddes committed Dec 16, 2023
1 parent 9c5b0f8 commit 46056e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ pub enum CustomDigestItem {
/// Convert custom application digest item into a concrete digest item
impl Into<DigestItem> for CustomDigestItem {
fn into(self) -> DigestItem {
match self {
// For snowbridge, we sidestep SCALE-encoding of `CustomDigestItem`, and insert the
// merkle root directly into the DigestItem::Other payload. This reduces complexity
// and gas costs on the Ethereum side.
//
// Other light clients can discriminate between custom digest items by checking the
// length of the encoded payload. If the length is greater than 32, then its a digest
// item inserted by some application other than Snowbridge.
CustomDigestItem::Snowbridge(merkle_root) =>
DigestItem::Other(merkle_root.to_fixed_bytes().into()),
}
DigestItem::Other(self.encode())
}
}

0 comments on commit 46056e6

Please sign in to comment.