Merge commit 'f9c24ef0db390c355241445af37a5c7999a7dc66' into hc-bump-bridges-subtree-take-2

This commit is contained in:
Hernando Castano
2021-05-04 15:27:09 -04:00
82 changed files with 2056 additions and 816 deletions
@@ -68,7 +68,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", branch = "master
libsecp256k1 = { version = "0.3.4", features = ["hmac"] }
[build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "2.0.0" }
substrate-wasm-builder = "3.0.0"
[features]
default = ["std"]
+2 -3
View File
@@ -14,13 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use wasm_builder_runner::WasmBuilder;
use substrate_wasm_builder::WasmBuilder;
fn main() {
WasmBuilder::new()
.with_current_project()
.with_wasm_builder_from_crates("1.0.11")
.export_heap_base()
.import_memory()
.export_heap_base()
.build()
}
+27 -16
View File
@@ -61,7 +61,7 @@ use sp_version::RuntimeVersion;
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem, Randomness},
traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, IdentityFee, RuntimeDbWeight, Weight},
StorageValue,
};
@@ -409,19 +409,34 @@ impl pallet_session::Config for Runtime {
}
parameter_types! {
// This is a pretty unscientific cap.
//
// Note that once this is hit the pallet will essentially throttle incoming requests down to one
// call per block.
/// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to one
/// call per block.
pub const MaxRequests: u32 = 50;
}
// Number of headers to keep.
//
// Assuming the worst case of every header being finalized, we will keep headers at least for a
// week.
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
/// Number of headers to keep in benchmarks.
///
/// In benchmarks we always populate with full number of `HeadersToKeep` to make sure that
/// pruning is taken into account.
///
/// Note: This is lower than regular value, to speed up benchmarking setup.
pub const HeadersToKeep: u32 = 1024;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
/// Number of headers to keep.
///
/// Assuming the worst case of every header being finalized, we will keep headers at least for a
/// week.
pub const HeadersToKeep: u32 = 7 * bp_rialto::DAYS as u32;
}
pub type MillauGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime {
type BridgedChain = bp_millau::Millau;
type MaxRequests = MaxRequests;
@@ -572,10 +587,6 @@ impl_runtime_apis! {
) -> sp_inherents::CheckInherentsResult {
data.check_extrinsics(&block)
}
fn random_seed() -> <Block as BlockT>::Hash {
RandomnessCollectiveFlip::random_seed().0
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
@@ -874,7 +885,7 @@ impl_runtime_apis! {
params: MessageParams<Self::AccountId>,
) -> (millau_messages::ToMillauMessagePayload, Balance) {
let message_payload = vec![0; params.size as usize];
let dispatch_origin = pallet_bridge_dispatch::CallOrigin::SourceAccount(
let dispatch_origin = bp_message_dispatch::CallOrigin::SourceAccount(
params.sender_account,
);
@@ -944,10 +955,10 @@ impl_runtime_apis! {
make_millau_outbound_lane_data_key,
make_millau_header,
call_weight,
pallet_bridge_dispatch::MessagePayload {
bp_message_dispatch::MessagePayload {
spec_version: VERSION.spec_version,
weight: call_weight,
origin: pallet_bridge_dispatch::CallOrigin::<
origin: bp_message_dispatch::CallOrigin::<
bp_millau::AccountId,
MultiSigner,
Signature,
@@ -31,7 +31,7 @@ use frame_support::{
weights::{DispatchClass, Weight},
RuntimeDebug,
};
use sp_runtime::{FixedPointNumber, FixedU128};
use sp_runtime::{traits::Zero, FixedPointNumber, FixedU128};
use sp_std::{convert::TryFrom, ops::RangeInclusive};
/// Initial value of `MillauToRialtoConversionRate` parameter.
@@ -214,7 +214,9 @@ impl TargetHeaderChain<ToMillauMessagePayload, bp_millau::AccountId> for Millau
fn verify_messages_delivery_proof(
proof: Self::MessagesDeliveryProof,
) -> Result<(LaneId, InboundLaneData<bp_rialto::AccountId>), Self::Error> {
messages::source::verify_messages_delivery_proof::<WithMillauMessageBridge, Runtime>(proof)
messages::source::verify_messages_delivery_proof::<WithMillauMessageBridge, Runtime, crate::MillauGrandpaInstance>(
proof,
)
}
}
@@ -231,7 +233,10 @@ impl SourceHeaderChain<bp_millau::Balance> for Millau {
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message<bp_millau::Balance>>, Self::Error> {
messages::target::verify_messages_proof::<WithMillauMessageBridge, Runtime>(proof, messages_count)
messages::target::verify_messages_proof::<WithMillauMessageBridge, Runtime, crate::MillauGrandpaInstance>(
proof,
messages_count,
)
}
}