-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update types for EVM bridge * Updated bridge channel * Fix warnings * Fix warnings * Fix warnings * Fix clippy * Remove Native asset kind * Refactoring
- Loading branch information
Showing
11 changed files
with
2,367 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[package] | ||
name = "bridge-channel" | ||
description = "Bridge Channel" | ||
version = "0.1.1" | ||
edition = "2021" | ||
authors = ['Polka Biome Ltd. <[email protected]>'] | ||
repository = "https://github.com/sora-xor/sora2-common" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
serde = { version = "1.0.101", optional = true } | ||
codec = { version = "3", package = "parity-scale-codec", default-features = false, features = [ | ||
"derive", | ||
] } | ||
scale-info = { version = "2", default-features = false, features = ["derive"] } | ||
hex-literal = { version = "0.4.1", optional = true } | ||
rlp = { version = "0.5", default-features = false, optional = true } | ||
|
||
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false, optional = true } | ||
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
pallet-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } | ||
|
||
bridge-types = { path = "../types", default-features = false } | ||
ethabi = { git = "https://github.com/sora-xor/ethabi.git", branch = "sora-v1.6.0", default-features = false } | ||
once_cell = { version = "1.5.2", default-features = false, features = [ | ||
'alloc', | ||
'unstable', | ||
] } | ||
|
||
[dev-dependencies] | ||
pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38" } | ||
tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.38", package = "orml-tokens" } | ||
traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.38", package = "orml-traits" } | ||
currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", branch = "polkadot-v0.9.38", package = "orml-currencies" } | ||
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38" } | ||
rlp = { version = "0.5" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"serde", | ||
"codec/std", | ||
"scale-info/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"sp-core/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
"sp-io/std", | ||
"bridge-types/std", | ||
"ethabi/std", | ||
] | ||
runtime-benchmarks = [ | ||
"bridge-types/runtime-benchmarks", | ||
"frame-benchmarking", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"hex-literal", | ||
"rlp", | ||
] | ||
|
||
try-runtime = ["frame-support/try-runtime"] |
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,74 @@ | ||
// This file is part of the SORA network and Polkaswap app. | ||
|
||
// Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved. | ||
// SPDX-License-Identifier: BSD-4-Clause | ||
|
||
// Redistribution and use in source and binary forms, with or without modification, | ||
// are permitted provided that the following conditions are met: | ||
|
||
// Redistributions of source code must retain the above copyright notice, this list | ||
// of conditions and the following disclaimer. | ||
// Redistributions in binary form must reproduce the above copyright notice, this | ||
// list of conditions and the following disclaimer in the documentation and/or other | ||
// materials provided with the distribution. | ||
// | ||
// All advertising materials mentioning features or use of this software must display | ||
// the following acknowledgement: This product includes software developed by Polka Biome | ||
// Ltd., SORA, and Polkaswap. | ||
// | ||
// Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used | ||
// to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
// THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY | ||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
//! BridgeInboundChannel pallet benchmarking | ||
use super::*; | ||
use bridge_types::GenericNetworkId; | ||
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; | ||
use frame_system::{self, RawOrigin}; | ||
use sp_std::prelude::*; | ||
|
||
const BASE_NETWORK_ID: GenericNetworkId = GenericNetworkId::Sub(SubNetworkId::Mainnet); | ||
|
||
#[allow(unused_imports)] | ||
use crate::inbound::Pallet as BridgeInboundChannel; | ||
|
||
// This collection of benchmarks should include a benchmark for each | ||
// call dispatched by the channel, i.e. each "app" pallet function | ||
// that can be invoked by MessageDispatch. The most expensive call | ||
// should be used in the `submit` benchmark. | ||
// | ||
// We rely on configuration via chain spec of the app pallets because | ||
// we don't have access to their storage here. | ||
benchmarks! { | ||
// Benchmark `submit` extrinsic under worst case conditions: | ||
// * `submit` dispatches the DotApp::unlock call | ||
// * `unlock` call successfully unlocks DOT | ||
submit { | ||
let messages = vec![]; | ||
let commitment = bridge_types::GenericCommitment::Sub( | ||
bridge_types::substrate::Commitment { | ||
messages: messages.try_into().unwrap(), | ||
nonce: 1u64, | ||
} | ||
); | ||
let proof = T::Verifier::valid_proof().unwrap(); | ||
}: _(RawOrigin::None, BASE_NETWORK_ID, commitment, proof) | ||
verify { | ||
assert_eq!(1, <ChannelNonces<T>>::get(BASE_NETWORK_ID)); | ||
} | ||
} | ||
|
||
impl_benchmark_test_suite!( | ||
BridgeInboundChannel, | ||
crate::inbound::test::new_tester(), | ||
crate::inbound::test::Test, | ||
); |
Oops, something went wrong.