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

Commit

Permalink
Register token with inbound fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Jan 23, 2024
1 parent 12c9558 commit cadd771
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ asset-hub-rococo-runtime = { path = "../../../../../runtimes/assets/asset-hub-ro
snowbridge-core = { path = "../../../../../../../../parachain/primitives/core", default-features = false }
snowbridge-router-primitives = { path = "../../../../../../../../parachain/primitives/router", default-features = false }
snowbridge-pallet-system = { path = "../../../../../../../../parachain/pallets/system", default-features = false }
snowbridge-pallet-inbound-queue = { path = "../../../../../../../../parachain/pallets/inbound-queue", default-features = false }
snowbridge-pallet-outbound-queue = { path = "../../../../../../../../parachain/pallets/outbound-queue", default-features = false }
snowbridge-pallet-inbound-queue = { path = "../../../../../../../../parachain/pallets/inbound-queue", features = ["test-helpers"] }
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::*;
use bridge_hub_rococo_runtime::EthereumBeaconClient;
use codec::{Decode, Encode};
use emulated_integration_tests_common::xcm_emulator::ConvertLocation;
use frame_support::pallet_prelude::TypeInfo;
use hex_literal::hex;
use parachains_common::rococo::snowbridge::EthereumNetwork;
use rococo_westend_system_emulated_network::BridgeHubRococoParaSender as BridgeHubRococoSender;
use snowbridge_core::outbound::OperatingMode;
use snowbridge_pallet_inbound_queue::fixtures::make_create_message;
use snowbridge_pallet_system;
use snowbridge_router_primitives::inbound::{
Command, Destination, GlobalConsensusEthereumConvertsFor, MessageV1, VersionedMessage,
Expand Down Expand Up @@ -191,17 +194,24 @@ fn register_weth_token_from_ethereum_to_asset_hub() {

BridgeHubRococo::execute_with(|| {
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
type RuntimeOrigin = <BridgeHubRococo as Chain>::RuntimeOrigin;
type EthereumInboundQueue =
<BridgeHubRococo as BridgeHubRococoPallet>::EthereumInboundQueue;
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE },
});
let (xcm, fee) = EthereumInboundQueue::do_convert(message_id, message).unwrap();

assert_ok!(EthereumInboundQueue::burn_fees(AssetHubRococo::para_id().into(), fee));
let create_message = make_create_message();

let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();
EthereumBeaconClient::store_execution_header(
create_message.message.proof.block_hash,
create_message.execution_header,
0,
H256::default(),
);

EthereumInboundQueue::submit(
RuntimeOrigin::signed(BridgeHubRococoSender::get()),
create_message.message,
)
.unwrap();

assert_expected_events!(
BridgeHubRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ runtime-benchmarks = [
"parachains-common/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"snowbridge-beacon-primitives/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-inbound-queue/runtime-benchmarks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,6 @@ impl pallet_utility::Config for Runtime {
}

// Ethereum Bridge

#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub storage EthereumGatewayAddress: H160 = H160::zero();
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub storage EthereumGatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
}
Expand Down

0 comments on commit cadd771

Please sign in to comment.