Skip to content

Commit

Permalink
Specify index of digest item (Snowfork#1078)
Browse files Browse the repository at this point in the history
* Test for encode digest_item

* Update sdk

* Update sdk

* Update sdk
  • Loading branch information
yrong authored Dec 21, 2023
1 parent c481b54 commit 9e33df1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion parachain/pallets/outbound-queue/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fn convert_local_currency() {
}

#[test]
fn encode_digest_item() {
fn encode_digest_item_with_correct_index() {
new_tester().execute_with(|| {
let digest_item: DigestItem = CustomDigestItem::Snowbridge(H256::default()).into();
let enum_prefix = match digest_item {
Expand All @@ -249,3 +249,20 @@ fn encode_digest_item() {
assert_eq!(enum_prefix, 0);
});
}

#[test]
fn encode_digest_item() {
new_tester().execute_with(|| {
let digest_item: DigestItem = CustomDigestItem::Snowbridge([5u8; 32].into()).into();
let digest_item_raw = digest_item.encode();
assert_eq!(digest_item_raw[0], 0); // DigestItem::Other
assert_eq!(digest_item_raw[2], 0); // CustomDigestItem::Snowbridge
assert_eq!(
digest_item_raw,
[
0, 132, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5
]
);
});
}
2 changes: 1 addition & 1 deletion polkadot-sdk

0 comments on commit 9e33df1

Please sign in to comment.