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

Commit

Permalink
Squashed 'bridges/snowbridge/' changes from 6f9cfdd9796..afc668ef634
Browse files Browse the repository at this point in the history
afc668ef634 Fix penpal smoketest (#1064)
3b3e9c212d3 remove fuzzing out of subtree (#1062)
60ab6cee76f Fix for smoke tests (#1056)
cc17c16bb2c Fix e2e setup (#1061)
4c175e49461 Add CustomDigestItem type (#1053)
09a9253e54a Make base fee configurable from storage. (#1060)
6f14f708282 Audit issue 9: Check if max nonce reached in outbound-queue pallet (#1052)
f7f06d21607 Set gateway on start-up (#1054)
de51fe77b18 Remove obsolete `outbound_fee` parameter from channel governance extrinsics and events (#1051)
455fa0e6458 Bump dependendencies for generating contract bindings (#1049)
99598660e61 Audit issue 6: Use primary governance channel (#1050)

git-subtree-dir: bridges/snowbridge
git-subtree-split: afc668ef634deb0ed6a8e44f7ee75c0c22f80ed1
  • Loading branch information
claravanstaden authored and claravanstaden committed Dec 18, 2023
1 parent b4c9ebb commit 312457c
Show file tree
Hide file tree
Showing 30 changed files with 1,300 additions and 1,633 deletions.
10 changes: 8 additions & 2 deletions contracts/src/Verification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ library Verification {
uint256 public constant DIGEST_ITEM_PRERUNTIME = 6;
uint256 public constant DIGEST_ITEM_RUNTIME_ENVIRONMENT_UPDATED = 8;

/// @dev Enum variant ID for CustomDigestItem::Snowbridge
bytes1 public constant DIGEST_ITEM_OTHER_SNOWBRIDGE = 0x00;

/// @dev Verify the message commitment by applying several proofs
///
/// 1. First check that the commitment is included in the digest items of the parachain header
Expand Down Expand Up @@ -132,8 +135,11 @@ library Verification {
returns (bool)
{
for (uint256 i = 0; i < header.digestItems.length; i++) {
DigestItem memory item = header.digestItems[i];
if (item.kind == DIGEST_ITEM_OTHER && item.data.length == 32 && commitment == bytes32(item.data)) {
if (
header.digestItems[i].kind == DIGEST_ITEM_OTHER && header.digestItems[i].data.length == 33
&& header.digestItems[i].data[0] == DIGEST_ITEM_OTHER_SNOWBRIDGE
&& commitment == bytes32(header.digestItems[i].data[1:])
) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Verification.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ contract VerificationTest is Test {
digestItems[2] = Verification.DigestItem({
kind: 0,
consensusEngineID: 0x00000000,
data: hex"b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"
data: hex"00b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"
});
digestItems[3] = Verification.DigestItem({
kind: 5,
Expand Down
Loading

0 comments on commit 312457c

Please sign in to comment.