mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 14:17:56 +00:00
committed by
Bastian Köcher
parent
133934df7c
commit
d04b018630
@@ -327,18 +327,16 @@ pub mod source {
|
||||
frame_system::RawOrigin<AccountIdOf<ThisChain<B>>>,
|
||||
OriginOf<ThisChain<B>>,
|
||||
> = submitter.clone().into();
|
||||
match raw_origin_or_err {
|
||||
Ok(raw_origin) =>
|
||||
pallet_bridge_dispatch::verify_message_origin(&raw_origin, payload)
|
||||
.map(drop)
|
||||
.map_err(|_| BAD_ORIGIN)?,
|
||||
Err(_) => {
|
||||
// so what it means that we've failed to convert origin to the
|
||||
// `frame_system::RawOrigin`? now it means that the custom pallet origin has
|
||||
// been used to send the message. Do we need to verify it? The answer is no,
|
||||
// because pallet may craft any origin (e.g. root) && we can't verify whether it
|
||||
// is valid, or not.
|
||||
},
|
||||
if let Ok(raw_origin) = raw_origin_or_err {
|
||||
pallet_bridge_dispatch::verify_message_origin(&raw_origin, payload)
|
||||
.map(drop)
|
||||
.map_err(|_| BAD_ORIGIN)?;
|
||||
} else {
|
||||
// so what it means that we've failed to convert origin to the
|
||||
// `frame_system::RawOrigin`? now it means that the custom pallet origin has
|
||||
// been used to send the message. Do we need to verify it? The answer is no,
|
||||
// because pallet may craft any origin (e.g. root) && we can't verify whether it
|
||||
// is valid, or not.
|
||||
};
|
||||
|
||||
let minimal_fee_in_this_tokens = estimate_message_dispatch_and_delivery_fee::<B>(
|
||||
|
||||
@@ -166,7 +166,7 @@ pub mod pallet {
|
||||
try_enact_authority_change::<T, I>(&finality_target, set_id)?;
|
||||
<RequestCount<T, I>>::mutate(|count| *count += 1);
|
||||
insert_header::<T, I>(*finality_target, hash);
|
||||
log::info!(target: "runtime::bridge-grandpa", "Succesfully imported finalized header with hash {:?}!", hash);
|
||||
log::info!(target: "runtime::bridge-grandpa", "Successfully imported finalized header with hash {:?}!", hash);
|
||||
|
||||
// mandatory header is a header that changes authorities set. The pallet can't go
|
||||
// further without importing this header. So every bridge MUST import mandatory headers.
|
||||
|
||||
@@ -198,7 +198,7 @@ impl SenderOrigin<AccountId> for Origin {
|
||||
fn linked_account(&self) -> Option<AccountId> {
|
||||
match self.caller {
|
||||
OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) =>
|
||||
Some(submitter.clone()),
|
||||
Some(*submitter),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ pub struct OutboundLane<S> {
|
||||
}
|
||||
|
||||
impl<S: OutboundLaneStorage> OutboundLane<S> {
|
||||
/// Create new inbound lane backed by given storage.
|
||||
/// Create new outbound lane backed by given storage.
|
||||
pub fn new(storage: S) -> Self {
|
||||
OutboundLane { storage }
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ where
|
||||
// check if authority has already voted in the same round.
|
||||
//
|
||||
// there's a lot of code in `validate_commit` and `import_precommit` functions inside
|
||||
// `finality-grandpa` crate (mostly related to reporing equivocations). But the only thing
|
||||
// `finality-grandpa` crate (mostly related to reporting equivocations). But the only thing
|
||||
// that we care about is that only first vote from the authority is accepted
|
||||
if !votes.insert(signed.id.clone()) {
|
||||
continue
|
||||
@@ -121,11 +121,11 @@ where
|
||||
|
||||
// everything below this line can't just `continue`, because state is already altered
|
||||
|
||||
// all precommits must be for block higher than the target
|
||||
// precommits aren't allowed for block lower than the target
|
||||
if signed.precommit.target_number < justification.commit.target_number {
|
||||
return Err(Error::PrecommitIsNotCommitDescendant)
|
||||
}
|
||||
// all precommits must be for target block descendents
|
||||
// all precommits must be descendants of target block
|
||||
chain = chain
|
||||
.ensure_descendant(&justification.commit.target_hash, &signed.precommit.target_hash)?;
|
||||
// since we know now that the precommit target is the descendant of the justification
|
||||
@@ -193,8 +193,8 @@ impl<Header: HeaderT> AncestryChain<Header> {
|
||||
AncestryChain { parents, unvisited }
|
||||
}
|
||||
|
||||
/// Returns `Err(_)` if `precommit_target` is a descendant of the `commit_target` block and
|
||||
/// `Ok(_)` otherwise.
|
||||
/// Returns `Ok(_)` if `precommit_target` is a descendant of the `commit_target` block and
|
||||
/// `Err(_)` otherwise.
|
||||
pub fn ensure_descendant(
|
||||
mut self,
|
||||
commit_target: &Header::Hash,
|
||||
@@ -213,7 +213,7 @@ impl<Header: HeaderT> AncestryChain<Header> {
|
||||
// `Some(parent_hash)` means that the `current_hash` is in the `parents`
|
||||
// container `is_visited_before` means that it has been visited before in
|
||||
// some of previous calls => since we assume that previous call has finished
|
||||
// with `true`, this also will be finished with `true`
|
||||
// with `true`, this also will be finished with `true`
|
||||
return Ok(self)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// RuntimeApi generated functions
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
// Generated by `DecodeLimit::decode_with_depth_limit`
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use bitvec::prelude::*;
|
||||
use bp_runtime::messages::DispatchFeePayment;
|
||||
@@ -42,7 +40,7 @@ pub use frame_support::weights::Weight;
|
||||
pub enum OperatingMode {
|
||||
/// Normal mode, when all operations are allowed.
|
||||
Normal,
|
||||
/// The pallet is not accepting outbound messages. Inbound messages and receival proofs
|
||||
/// The pallet is not accepting outbound messages. Inbound messages and receiving proofs
|
||||
/// are still accepted.
|
||||
///
|
||||
/// This mode may be used e.g. when bridged chain expects upgrade. Then to avoid dispatch
|
||||
@@ -226,7 +224,7 @@ impl DeliveredMessages {
|
||||
/// dispatch result.
|
||||
pub fn new(nonce: MessageNonce, dispatch_result: bool) -> Self {
|
||||
let mut dispatch_results = BitVec::with_capacity(1);
|
||||
dispatch_results.push(if dispatch_result { true } else { false });
|
||||
dispatch_results.push(dispatch_result);
|
||||
DeliveredMessages { begin: nonce, end: nonce, dispatch_results }
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ pub trait Chain: Send + Sync + 'static {
|
||||
type Balance: AtLeast32BitUnsigned
|
||||
+ FixedPointOperand
|
||||
+ Parameter
|
||||
+ Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Clone
|
||||
|
||||
@@ -178,7 +178,7 @@ impl ReinitBridge {
|
||||
(current_number + 1, target_number),
|
||||
)
|
||||
.await?;
|
||||
let latest_andatory_header_number = headers_to_submit.last().map(|(h, _)| h.number());
|
||||
let latest_mandatory_header_number = headers_to_submit.last().map(|(h, _)| h.number());
|
||||
log::info!(
|
||||
target: "bridge",
|
||||
"Missing {} mandatory {} headers at {}",
|
||||
@@ -281,13 +281,13 @@ impl ReinitBridge {
|
||||
ensure_pallet_operating_mode(&finality_target, is_last_batch).await?;
|
||||
}
|
||||
|
||||
if let Some(latest_andatory_header_number) = latest_andatory_header_number {
|
||||
if let Some(latest_mandatory_header_number) = latest_mandatory_header_number {
|
||||
log::info!(
|
||||
target: "bridge",
|
||||
"Successfully updated best {} header at {} to {}. Pallet is now operational",
|
||||
Source::NAME,
|
||||
Target::NAME,
|
||||
latest_andatory_header_number,
|
||||
latest_mandatory_header_number,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ where
|
||||
genesis_hash,
|
||||
signer: transaction_params.signer,
|
||||
era: TransactionEra::new(best_block_id, transaction_params.mortality),
|
||||
unsigned: UnsignedTransaction::new(call.into(), transaction_nonce).into(),
|
||||
unsigned: UnsignedTransaction::new(call.into(), transaction_nonce),
|
||||
})?
|
||||
.encode(),
|
||||
))
|
||||
|
||||
@@ -192,7 +192,7 @@ where
|
||||
.inbound_lane_data(id)
|
||||
.await?
|
||||
.map(|data| data.relayers)
|
||||
.unwrap_or_else(|| VecDeque::new());
|
||||
.unwrap_or_else(VecDeque::new);
|
||||
let unrewarded_relayers_state = bp_messages::UnrewardedRelayersState {
|
||||
unrewarded_relayer_entries: relayers.len() as _,
|
||||
messages_in_oldest_entry: relayers
|
||||
|
||||
Reference in New Issue
Block a user