forked from Snowfork/snowbridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring Inbound fixture (Snowfork#1125)
* Refactoring Inbound fixture * Add a separate crate for the fixtures * Fix zepter * Update sdk * Regenerate inbound fixture * Fix generate execution update * Regenerate inbound fixture * Rename as register_token * Revert to wait by default * Refactoring with const & fix the template * Fix breaking test * Add license header * Remove the alias type * Improve error handling * Update sdk * Change recipient to BOB * Update Cargo.lock
- Loading branch information
Showing
21 changed files
with
349 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ extend-exclude = [ | |
"lodestar/**", | ||
"go-ethereum/**", | ||
"go.work.sum", | ||
"parachain/Cargo.toml", | ||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[package] | ||
name = "snowbridge-pallet-inbound-queue-fixtures" | ||
description = "Snowbridge Inbound Queue Test Fixtures" | ||
version = "0.9.0" | ||
authors = ["Snowfork <[email protected]>"] | ||
edition.workspace = true | ||
repository.workspace = true | ||
license = "Apache-2.0" | ||
categories = ["cryptography::cryptocurrencies"] | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
hex-literal = { version = "0.4.1" } | ||
sp-core = { path = "../../../../polkadot-sdk/substrate/primitives/core", default-features = false } | ||
sp-std = { path = "../../../../polkadot-sdk/substrate/primitives/std", default-features = false } | ||
frame-benchmarking = { path = "../../../../polkadot-sdk/substrate/frame/benchmarking", default-features = false, optional = true } | ||
frame-support = { path = "../../../../polkadot-sdk/substrate/frame/support", default-features = false } | ||
frame-system = { path = "../../../../polkadot-sdk/substrate/frame/system", default-features = false } | ||
snowbridge-core = { path = "../../../primitives/core", default-features = false } | ||
snowbridge-beacon-primitives = { path = "../../../primitives/beacon", default-features = false } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"frame-benchmarking/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"snowbridge-beacon-primitives/std", | ||
"snowbridge-core/std", | ||
"sp-core/std", | ||
"sp-std/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"snowbridge-core/runtime-benchmarks", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use snowbridge_beacon_primitives::CompactExecutionHeader; | ||
use snowbridge_core::inbound::Message; | ||
use sp_core::RuntimeDebug; | ||
|
||
pub mod register_token; | ||
pub mod send_token; | ||
|
||
#[derive(Clone, RuntimeDebug)] | ||
pub struct InboundQueueFixture { | ||
pub execution_header: CompactExecutionHeader, | ||
pub message: Message, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
// Generated, do not edit! | ||
// See ethereum client README.md for instructions to generate | ||
|
||
use crate::InboundQueueFixture; | ||
use hex_literal::hex; | ||
use snowbridge_beacon_primitives::CompactExecutionHeader; | ||
use snowbridge_core::inbound::{Log, Message, Proof}; | ||
use sp_std::vec; | ||
|
||
pub struct InboundQueueTest { | ||
pub execution_header: CompactExecutionHeader, | ||
pub message: Message, | ||
} | ||
|
||
pub fn make_create_message() -> InboundQueueTest { | ||
InboundQueueTest { | ||
pub fn make_register_token_message() -> InboundQueueFixture { | ||
InboundQueueFixture { | ||
execution_header: CompactExecutionHeader{ | ||
parent_hash: hex!("d82ec63f5c5e6ba61d62f09c188f158e6449b94bdcc31941e68639eec3c4cf7a").into(), | ||
block_number: 215, | ||
state_root: hex!("8b65545fe5f3216b47b6339b9c91ca2b7f1032a970b04246d9e9fb4460ee34c3").into(), | ||
parent_hash: hex!("d5de3dd02c96dbdc8aaa4db70a1e9fdab5ded5f4d52f18798acd56a3d37d1ad6").into(), | ||
block_number: 772, | ||
state_root: hex!("49cba2a79b23ad74cefe80c3a96699825d1cda0f75bfceb587c5549211c86245").into(), | ||
receipts_root: hex!("7b1f61b9714c080ef0be014e01657a15f45f0304b477beebc7ca5596c8033095").into(), | ||
}, | ||
message: Message { | ||
|
@@ -29,7 +28,7 @@ pub fn make_create_message() -> InboundQueueTest { | |
data: hex!("00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002e00a736aa00000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7d00e40b54020000000000000000000000000000000000000000000000000000000000").into(), | ||
}, | ||
proof: Proof { | ||
block_hash: hex!("48498dbfbcfae53a7f4c289ee00747aceea925f6260c50ead5a33e1c55c40f98").into(), | ||
block_hash: hex!("392182a385b3a417e8ddea8b252953ee81e6ec0fb09d9056c96c89fbeb703a3f").into(), | ||
tx_index: 0, | ||
data: (vec![ | ||
hex!("7b1f61b9714c080ef0be014e01657a15f45f0304b477beebc7ca5596c8033095").to_vec(), | ||
|
41 changes: 41 additions & 0 deletions
41
parachain/pallets/inbound-queue/fixtures/src/send_token.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
// Generated, do not edit! | ||
// See ethereum client README.md for instructions to generate | ||
|
||
use crate::InboundQueueFixture; | ||
use hex_literal::hex; | ||
use snowbridge_beacon_primitives::CompactExecutionHeader; | ||
use snowbridge_core::inbound::{Log, Message, Proof}; | ||
use sp_std::vec; | ||
|
||
pub fn make_send_token_message() -> InboundQueueFixture { | ||
InboundQueueFixture { | ||
execution_header: CompactExecutionHeader{ | ||
parent_hash: hex!("920cecde45d428e3a77590b70f8533cf4c2c36917b8a7b74c915e7fa3dae7075").into(), | ||
block_number: 1148, | ||
state_root: hex!("bbc6ba0e9940d641afecbbaf3f97abd2b9ffaf2f6bd4879c4a71e659eca89978").into(), | ||
receipts_root: hex!("9f3340b57eddc1f86de30776db57faeca80269a3dd459031741988dec240ce34").into(), | ||
}, | ||
message: Message { | ||
event_log: Log { | ||
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(), | ||
topics: vec![ | ||
hex!("7153f9357c8ea496bba60bf82e67143e27b64462b49041f8e689e1b05728f84f").into(), | ||
hex!("c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539").into(), | ||
hex!("c8eaf22f2cb07bac4679df0a660e7115ed87fcfd4e32ac269f6540265bbbd26f").into(), | ||
], | ||
data: hex!("00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005f00a736aa00000000000187d1f7fdfee7f651fabc8bfcb6e086c278b77a7d008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48000064a7b3b6e00d000000000000000000e40b5402000000000000000000000000").into(), | ||
}, | ||
proof: Proof { | ||
block_hash: hex!("d3c155f123c3cbff22f3d7869283e02179edea9ffa7a5e9a4d8414c2a6b8991f").into(), | ||
tx_index: 0, | ||
data: (vec![ | ||
hex!("9f3340b57eddc1f86de30776db57faeca80269a3dd459031741988dec240ce34").to_vec(), | ||
], vec![ | ||
hex!("f90451822080b9044b02f90447018301bcb9b9010000800000000000000000000020000000000000000000004000000000000000000400000000000000000000001000000010000000000000000000000008000000200000000000000001000008000000000000000000000000000000008000080000000000200000000000000000000000000100000000000000000011000000000000020200000000000000000000000000003000000040080008000000000000000000040044000021000000002000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000200800000000000f9033cf89b9487d1f7fdfee7f651fabc8bfcb6e086c278b77a7df863a0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa000000000000000000000000090a987b944cb1dcce5564e5fdecd7a54d3de27fea000000000000000000000000057a2d4ff0c3866d96556884bf09fecdd7ccd530ca00000000000000000000000000000000000000000000000000de0b6b3a7640000f9015d94eda338e4dc46038493b885327842fd3e301cab39f884a024c5d2de620c6e25186ae16f6919eba93b6e2c1a33857cc419d9f3a00d6967e9a000000000000000000000000090a987b944cb1dcce5564e5fdecd7a54d3de27fea000000000000000000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7da000000000000000000000000000000000000000000000000000000000000003e8b8c000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000208eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48f9013c94eda338e4dc46038493b885327842fd3e301cab39f863a07153f9357c8ea496bba60bf82e67143e27b64462b49041f8e689e1b05728f84fa0c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539a0c8eaf22f2cb07bac4679df0a660e7115ed87fcfd4e32ac269f6540265bbbd26fb8c000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005f00a736aa00000000000187d1f7fdfee7f651fabc8bfcb6e086c278b77a7d008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48000064a7b3b6e00d000000000000000000e40b5402000000000000000000000000").to_vec(), | ||
]), | ||
}, | ||
}, | ||
} | ||
} |
Oops, something went wrong.