Fix spelling mistakes across the whole repository (#3808)

**Update:** Pushed additional changes based on the review comments.

**This pull request fixes various spelling mistakes in this
repository.**

Most of the changes are contained in the first **3** commits:

- `Fix spelling mistakes in comments and docs`

- `Fix spelling mistakes in test names`

- `Fix spelling mistakes in error messages, panic messages, logs and
tracing`

Other source code spelling mistakes are separated into individual
commits for easier reviewing:

- `Fix the spelling of 'authority'`

- `Fix the spelling of 'REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY'`

- `Fix the spelling of 'prev_enqueud_messages'`

- `Fix the spelling of 'endpoint'`

- `Fix the spelling of 'children'`

- `Fix the spelling of 'PenpalSiblingSovereignAccount'`

- `Fix the spelling of 'PenpalSudoAccount'`

- `Fix the spelling of 'insufficient'`

- `Fix the spelling of 'PalletXcmExtrinsicsBenchmark'`

- `Fix the spelling of 'subtracted'`

- `Fix the spelling of 'CandidatePendingAvailability'`

- `Fix the spelling of 'exclusive'`

- `Fix the spelling of 'until'`

- `Fix the spelling of 'discriminator'`

- `Fix the spelling of 'nonexistent'`

- `Fix the spelling of 'subsystem'`

- `Fix the spelling of 'indices'`

- `Fix the spelling of 'committed'`

- `Fix the spelling of 'topology'`

- `Fix the spelling of 'response'`

- `Fix the spelling of 'beneficiary'`

- `Fix the spelling of 'formatted'`

- `Fix the spelling of 'UNKNOWN_PROOF_REQUEST'`

- `Fix the spelling of 'succeeded'`

- `Fix the spelling of 'reopened'`

- `Fix the spelling of 'proposer'`

- `Fix the spelling of 'InstantiationNonce'`

- `Fix the spelling of 'depositor'`

- `Fix the spelling of 'expiration'`

- `Fix the spelling of 'phantom'`

- `Fix the spelling of 'AggregatedKeyValue'`

- `Fix the spelling of 'randomness'`

- `Fix the spelling of 'defendant'`

- `Fix the spelling of 'AquaticMammal'`

- `Fix the spelling of 'transactions'`

- `Fix the spelling of 'PassingTracingSubscriber'`

- `Fix the spelling of 'TxSignaturePayload'`

- `Fix the spelling of 'versioning'`

- `Fix the spelling of 'descendant'`

- `Fix the spelling of 'overridden'`

- `Fix the spelling of 'network'`

Let me know if this structure is adequate.

**Note:** The usage of the words `Merkle`, `Merkelize`, `Merklization`,
`Merkelization`, `Merkleization`, is somewhat inconsistent but I left it
as it is.

~~**Note:** In some places the term `Receival` is used to refer to
message reception, IMO `Reception` is the correct word here, but I left
it as it is.~~

~~**Note:** In some places the term `Overlayed` is used instead of the
more acceptable version `Overlaid` but I also left it as it is.~~

~~**Note:** In some places the term `Applyable` is used instead of the
correct version `Applicable` but I also left it as it is.~~

**Note:** Some usage of British vs American english e.g. `judgement` vs
`judgment`, `initialise` vs `initialize`, `optimise` vs `optimize` etc.
are both present in different places, but I suppose that's
understandable given the number of contributors.

~~**Note:** There is a spelling mistake in `.github/CODEOWNERS` but it
triggers errors in CI when I make changes to it, so I left it as it
is.~~
This commit is contained in:
Dcompoze
2024-03-26 13:57:57 +00:00
committed by GitHub
parent b839c995c0
commit 002d9260f9
463 changed files with 1119 additions and 1017 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
# - Multiple owners are supported.
# - Either handle (e.g, @github_user or @github/team) or email can be used. Keep in mind,
# that handles might work better because they are more recognizable on GitHub,
# eyou can use them for mentioning unlike an email.
# you can use them for mentioning unlike an email.
# - The latest matching rule, if multiple, takes precedence.
# CI
+1 -1
View File
@@ -237,7 +237,7 @@ fetch_release_artifacts() {
popd > /dev/null
}
# Fetch the release artifacts like binary and sigantures from S3. Assumes the ENV are set:
# Fetch the release artifacts like binary and signatures from S3. Assumes the ENV are set:
# - RELEASE_ID
# - GITHUB_TOKEN
# - REPO in the form paritytech/polkadot
+1 -1
View File
@@ -350,7 +350,7 @@ build-runtimes-polkavm:
- .run-immediately
# - .collect-artifact
variables:
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
# this variable gets overridden by "rusty-cachier environment inject", use the value as default
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
before_script:
- mkdir -p ./artifacts/subkey
+1 -1
View File
@@ -15,7 +15,7 @@
#
# The steps of this script:
# 1. Check that all required dependencies are installed.
# 2. Check that all rules are fullfilled for the whole workspace. If not:
# 2. Check that all rules are fulfilled for the whole workspace. If not:
# 4. Check all crates to find the offending ones.
# 5. Print all offending crates and exit with code 1.
#
@@ -14,7 +14,7 @@
// 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/>.
//! Helpers for implementing various message-related runtime API mthods.
//! Helpers for implementing various message-related runtime API methods.
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
@@ -248,7 +248,7 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
sender_and_lane: &SenderAndLane,
enqueued_messages: MessageNonce,
) {
// skip if we dont want to handle congestion
// skip if we don't want to handle congestion
if !H::supports_congestion_detection() {
return
}
+1 -1
View File
@@ -379,7 +379,7 @@ impl Chain for BridgedUnderlyingChain {
impl ChainWithGrandpa for BridgedUnderlyingChain {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = "";
const MAX_AUTHORITIES_COUNT: u32 = 16;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 8;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 8;
const MAX_MANDATORY_HEADER_SIZE: u32 = 256;
const AVERAGE_HEADER_SIZE: u32 = 64;
}
@@ -163,7 +163,7 @@ mod integrity_tests {
{
// just an estimation of extra transaction bytes that are added to every transaction
// (including signature, signed extensions extra and etc + in our case it includes
// all call arguments extept the proof itself)
// all call arguments except the proof itself)
let base_tx_size = 512;
// let's say we are relaying similar small messages and for every message we add more trie
// nodes to the proof (x0.5 because we expect some nodes to be reused)
@@ -1538,7 +1538,7 @@ mod tests {
}
#[test]
fn validate_boosts_priority_of_message_delivery_transactons() {
fn validate_boosts_priority_of_message_delivery_transactions() {
run_test(|| {
initialize_environment(100, 100, 100);
@@ -1568,7 +1568,7 @@ mod tests {
}
#[test]
fn validate_does_not_boost_priority_of_message_delivery_transactons_with_too_many_messages() {
fn validate_does_not_boost_priority_of_message_delivery_transactions_with_too_many_messages() {
run_test(|| {
initialize_environment(100, 100, 100);
+2 -2
View File
@@ -53,8 +53,8 @@ impl Chain for Kusama {
impl ChainWithGrandpa for Kusama {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_KUSAMA_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
@@ -43,7 +43,7 @@ use sp_runtime::{traits::DispatchInfoOf, transaction_validity::TransactionValidi
pub use bp_polkadot_core::{
AccountAddress, AccountId, Balance, Block, BlockNumber, Hash, Hasher, Header, Nonce, Signature,
SignedBlock, UncheckedExtrinsic, AVERAGE_HEADER_SIZE, EXTRA_STORAGE_PROOF_SIZE,
MAX_MANDATORY_HEADER_SIZE, REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY,
MAX_MANDATORY_HEADER_SIZE, REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY,
};
/// Maximal number of GRANDPA authorities at Polkadot Bulletin chain.
@@ -62,7 +62,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(90);
// Re following constants - we are using the same values at Cumulus parachains. They are limited
// by the maximal transaction weight/size. Since block limits at Bulletin Chain are larger than
// at the Cumulus Bridgeg Hubs, we could reuse the same values.
// at the Cumulus Bridge Hubs, we could reuse the same values.
/// Maximal number of unrewarded relayer entries at inbound lane for Cumulus-based parachains.
pub const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = 1024;
@@ -207,8 +207,8 @@ impl Chain for PolkadotBulletin {
impl ChainWithGrandpa for PolkadotBulletin {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_POLKADOT_BULLETIN_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
+2 -2
View File
@@ -55,8 +55,8 @@ impl Chain for Polkadot {
impl ChainWithGrandpa for Polkadot {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_POLKADOT_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
+2 -2
View File
@@ -53,8 +53,8 @@ impl Chain for Rococo {
impl ChainWithGrandpa for Rococo {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_ROCOCO_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
+2 -2
View File
@@ -53,8 +53,8 @@ impl Chain for Westend {
impl ChainWithGrandpa for Westend {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_WESTEND_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 = MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = AVERAGE_HEADER_SIZE;
}
+1 -1
View File
@@ -10,7 +10,7 @@ It is used by the parachains light client (bridge parachains pallet) and by mess
## A Brief Introduction into GRANDPA Finality
You can find detailed information on GRANDPA, by exploring its [repository](https://github.com/paritytech/finality-grandpa).
Here is the minimal reqiuired GRANDPA information to understand how pallet works.
Here is the minimal required GRANDPA information to understand how pallet works.
Any Substrate chain may use different block authorship algorithms (like BABE or Aura) to determine block producers and
generate blocks. This has nothing common with finality, though - the task of block authorship is to coordinate
+4 -4
View File
@@ -205,7 +205,7 @@ pub(crate) fn submit_finality_proof_info_from_args<T: Config<I>, I: 'static>(
// as an extra weight.
let votes_ancestries_len = justification.votes_ancestries.len().saturated_into();
let extra_weight =
if votes_ancestries_len > T::BridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY {
if votes_ancestries_len > T::BridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY {
T::WeightInfo::submit_finality_proof(precommits_len, votes_ancestries_len)
} else {
Weight::zero()
@@ -396,11 +396,11 @@ mod tests {
let finality_target = test_header(1);
let mut justification_params = JustificationGeneratorParams {
header: finality_target.clone(),
ancestors: TestBridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY,
ancestors: TestBridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY,
..Default::default()
};
// when there are `REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY` headers => no refund
// when there are `REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY` headers => no refund
let justification = make_justification_for_header(justification_params.clone());
let call = RuntimeCall::Grandpa(crate::Call::submit_finality_proof_ex {
finality_target: Box::new(finality_target.clone()),
@@ -409,7 +409,7 @@ mod tests {
});
assert_eq!(call.submit_finality_proof_info().unwrap().extra_weight, Weight::zero());
// when there are `REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY + 1` headers => full refund
// when there are `REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY + 1` headers => full refund
justification_params.ancestors += 1;
let justification = make_justification_for_header(justification_params);
let call_weight = <TestRuntime as Config>::WeightInfo::submit_finality_proof(
+2 -2
View File
@@ -935,7 +935,7 @@ mod tests {
}
#[test]
fn succesfully_imports_header_with_valid_finality() {
fn successfully_imports_header_with_valid_finality() {
run_test(|| {
initialize_substrate_bridge();
@@ -1192,7 +1192,7 @@ mod tests {
header.digest = change_log(0);
let justification = make_justification_for_header(JustificationGeneratorParams {
header: header.clone(),
ancestors: TestBridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY + 1,
ancestors: TestBridgedChain::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY + 1,
..Default::default()
});
+1 -1
View File
@@ -87,7 +87,7 @@ impl Chain for TestBridgedChain {
impl ChainWithGrandpa for TestBridgedChain {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = "";
const MAX_AUTHORITIES_COUNT: u32 = MAX_BRIDGED_AUTHORITIES;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 8;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 8;
const MAX_MANDATORY_HEADER_SIZE: u32 = 256;
const AVERAGE_HEADER_SIZE: u32 = 64;
}
+20 -20
View File
@@ -21,7 +21,7 @@ use crate::Config;
use bp_messages::{
target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch},
DeliveredMessages, InboundLaneData, LaneId, MessageKey, MessageNonce, OutboundLaneData,
ReceivalResult, UnrewardedRelayer,
ReceptionResult, UnrewardedRelayer,
};
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
use frame_support::traits::Get;
@@ -170,21 +170,21 @@ impl<S: InboundLaneStorage> InboundLane<S> {
relayer_at_bridged_chain: &S::Relayer,
nonce: MessageNonce,
message_data: DispatchMessageData<Dispatch::DispatchPayload>,
) -> ReceivalResult<Dispatch::DispatchLevelResult> {
) -> ReceptionResult<Dispatch::DispatchLevelResult> {
let mut data = self.storage.get_or_init_data();
if Some(nonce) != data.last_delivered_nonce().checked_add(1) {
return ReceivalResult::InvalidNonce
return ReceptionResult::InvalidNonce
}
// if there are more unrewarded relayer entries than we may accept, reject this message
if data.relayers.len() as MessageNonce >= self.storage.max_unrewarded_relayer_entries() {
return ReceivalResult::TooManyUnrewardedRelayers
return ReceptionResult::TooManyUnrewardedRelayers
}
// if there are more unconfirmed messages than we may accept, reject this message
let unconfirmed_messages_count = nonce.saturating_sub(data.last_confirmed_nonce);
if unconfirmed_messages_count > self.storage.max_unconfirmed_messages() {
return ReceivalResult::TooManyUnconfirmedMessages
return ReceptionResult::TooManyUnconfirmedMessages
}
// then, dispatch message
@@ -207,7 +207,7 @@ impl<S: InboundLaneStorage> InboundLane<S> {
};
self.storage.set_data(data);
ReceivalResult::Dispatched(dispatch_result)
ReceptionResult::Dispatched(dispatch_result)
}
}
@@ -235,7 +235,7 @@ mod tests {
nonce,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
}
@@ -362,7 +362,7 @@ mod tests {
10,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::InvalidNonce
ReceptionResult::InvalidNonce
);
assert_eq!(lane.storage.get_or_init_data().last_delivered_nonce(), 0);
});
@@ -381,7 +381,7 @@ mod tests {
current_nonce,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
}
// Fails to dispatch new message from different than latest relayer.
@@ -391,7 +391,7 @@ mod tests {
max_nonce + 1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::TooManyUnrewardedRelayers,
ReceptionResult::TooManyUnrewardedRelayers,
);
// Fails to dispatch new messages from latest relayer. Prevents griefing attacks.
assert_eq!(
@@ -400,7 +400,7 @@ mod tests {
max_nonce + 1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::TooManyUnrewardedRelayers,
ReceptionResult::TooManyUnrewardedRelayers,
);
});
}
@@ -417,7 +417,7 @@ mod tests {
current_nonce,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
}
// Fails to dispatch new message from different than latest relayer.
@@ -427,7 +427,7 @@ mod tests {
max_nonce + 1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::TooManyUnconfirmedMessages,
ReceptionResult::TooManyUnconfirmedMessages,
);
// Fails to dispatch new messages from latest relayer.
assert_eq!(
@@ -436,7 +436,7 @@ mod tests {
max_nonce + 1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::TooManyUnconfirmedMessages,
ReceptionResult::TooManyUnconfirmedMessages,
);
});
}
@@ -451,7 +451,7 @@ mod tests {
1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
assert_eq!(
lane.receive_message::<TestMessageDispatch>(
@@ -459,7 +459,7 @@ mod tests {
2,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
assert_eq!(
lane.receive_message::<TestMessageDispatch>(
@@ -467,7 +467,7 @@ mod tests {
3,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
assert_eq!(
lane.storage.get_or_init_data().relayers,
@@ -490,7 +490,7 @@ mod tests {
1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::Dispatched(dispatch_result(0))
ReceptionResult::Dispatched(dispatch_result(0))
);
assert_eq!(
lane.receive_message::<TestMessageDispatch>(
@@ -498,7 +498,7 @@ mod tests {
1,
inbound_message_data(REGULAR_PAYLOAD)
),
ReceivalResult::InvalidNonce,
ReceptionResult::InvalidNonce,
);
});
}
@@ -524,7 +524,7 @@ mod tests {
1,
inbound_message_data(payload)
),
ReceivalResult::Dispatched(dispatch_result(1))
ReceptionResult::Dispatched(dispatch_result(1))
);
});
}
+15 -15
View File
@@ -47,7 +47,7 @@ pub use weights_ext::{
use crate::{
inbound_lane::{InboundLane, InboundLaneStorage},
outbound_lane::{OutboundLane, OutboundLaneStorage, ReceivalConfirmationError},
outbound_lane::{OutboundLane, OutboundLaneStorage, ReceptionConfirmationError},
};
use bp_messages::{
@@ -90,7 +90,7 @@ pub const LOG_TARGET: &str = "runtime::bridge-messages";
#[frame_support::pallet]
pub mod pallet {
use super::*;
use bp_messages::{ReceivalResult, ReceivedMessages};
use bp_messages::{ReceivedMessages, ReceptionResult};
use bp_runtime::RangeInclusiveExt;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
@@ -376,13 +376,13 @@ pub mod pallet {
// delivery transaction cost anyway. And base cost covers everything except
// dispatch, so we have a balance here.
let unspent_weight = match &receival_result {
ReceivalResult::Dispatched(dispatch_result) => {
ReceptionResult::Dispatched(dispatch_result) => {
valid_messages += 1;
dispatch_result.unspent_weight
},
ReceivalResult::InvalidNonce |
ReceivalResult::TooManyUnrewardedRelayers |
ReceivalResult::TooManyUnconfirmedMessages => message_dispatch_weight,
ReceptionResult::InvalidNonce |
ReceptionResult::TooManyUnrewardedRelayers |
ReceptionResult::TooManyUnconfirmedMessages => message_dispatch_weight,
};
lane_messages_received_status.push(message.key.nonce, receival_result);
@@ -455,7 +455,7 @@ pub mod pallet {
last_delivered_nonce,
&lane_data.relayers,
)
.map_err(Error::<T, I>::ReceivalConfirmation)?;
.map_err(Error::<T, I>::ReceptionConfirmation)?;
if let Some(confirmed_messages) = confirmed_messages {
// emit 'delivered' event
@@ -563,7 +563,7 @@ pub mod pallet {
/// The message someone is trying to work with (i.e. increase fee) is not yet sent.
MessageIsNotYetSent,
/// Error confirming messages receival.
ReceivalConfirmation(ReceivalConfirmationError),
ReceptionConfirmation(ReceptionConfirmationError),
/// Error generated by the `OwnedBridgeModule` trait.
BridgeModule(bp_runtime::OwnedBridgeModuleError),
}
@@ -923,7 +923,7 @@ mod tests {
PAYLOAD_REJECTED_BY_TARGET_CHAIN, REGULAR_PAYLOAD, TEST_LANE_ID, TEST_LANE_ID_2,
TEST_LANE_ID_3, TEST_RELAYER_A, TEST_RELAYER_B,
},
outbound_lane::ReceivalConfirmationError,
outbound_lane::ReceptionConfirmationError,
};
use bp_messages::{
source_chain::MessagesBridge, BridgeMessagesCall, UnrewardedRelayer,
@@ -950,11 +950,11 @@ mod tests {
let outbound_lane = outbound_lane::<TestRuntime, ()>(lane_id);
let message_nonce = outbound_lane.data().latest_generated_nonce + 1;
let prev_enqueud_messages = outbound_lane.data().queued_messages().saturating_len();
let prev_enqueued_messages = outbound_lane.data().queued_messages().saturating_len();
let valid_message = Pallet::<TestRuntime, ()>::validate_message(lane_id, &REGULAR_PAYLOAD)
.expect("validate_message has failed");
let artifacts = Pallet::<TestRuntime, ()>::send_message(valid_message);
assert_eq!(artifacts.enqueued_messages, prev_enqueud_messages + 1);
assert_eq!(artifacts.enqueued_messages, prev_enqueued_messages + 1);
// check event with assigned nonce
assert_eq!(
@@ -1541,7 +1541,7 @@ mod tests {
}
#[test]
fn actual_dispatch_weight_does_not_overlow() {
fn actual_dispatch_weight_does_not_overflow() {
run_test(|| {
let message1 = message(1, message_payload(0, u64::MAX / 2));
let message2 = message(2, message_payload(0, u64::MAX / 2));
@@ -1775,7 +1775,7 @@ mod tests {
// returns `last_confirmed_nonce`;
// 3) it means that we're going to confirm delivery of messages 1..=1;
// 4) so the number of declared messages (see `UnrewardedRelayersState`) is `0` and
// numer of actually confirmed messages is `1`.
// number of actually confirmed messages is `1`.
assert_noop!(
Pallet::<TestRuntime>::receive_messages_delivery_proof(
RuntimeOrigin::signed(1),
@@ -1785,8 +1785,8 @@ mod tests {
))),
UnrewardedRelayersState { last_delivered_nonce: 1, ..Default::default() },
),
Error::<TestRuntime, ()>::ReceivalConfirmation(
ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected
Error::<TestRuntime, ()>::ReceptionConfirmation(
ReceptionConfirmationError::TryingToConfirmMoreMessagesThanExpected
),
);
});
+15 -15
View File
@@ -53,7 +53,7 @@ pub type StoredMessagePayload<T, I> = BoundedVec<u8, <T as Config<I>>::MaximalOu
/// Result of messages receival confirmation.
#[derive(Encode, Decode, RuntimeDebug, PartialEq, Eq, PalletError, TypeInfo)]
pub enum ReceivalConfirmationError {
pub enum ReceptionConfirmationError {
/// Bridged chain is trying to confirm more messages than we have generated. May be a result
/// of invalid bridged chain storage.
FailedToConfirmFutureMessages,
@@ -103,7 +103,7 @@ impl<S: OutboundLaneStorage> OutboundLane<S> {
max_allowed_messages: MessageNonce,
latest_delivered_nonce: MessageNonce,
relayers: &VecDeque<UnrewardedRelayer<RelayerId>>,
) -> Result<Option<DeliveredMessages>, ReceivalConfirmationError> {
) -> Result<Option<DeliveredMessages>, ReceptionConfirmationError> {
let mut data = self.storage.data();
let confirmed_messages = DeliveredMessages {
begin: data.latest_received_nonce.saturating_add(1),
@@ -113,7 +113,7 @@ impl<S: OutboundLaneStorage> OutboundLane<S> {
return Ok(None)
}
if confirmed_messages.end > data.latest_generated_nonce {
return Err(ReceivalConfirmationError::FailedToConfirmFutureMessages)
return Err(ReceptionConfirmationError::FailedToConfirmFutureMessages)
}
if confirmed_messages.total_messages() > max_allowed_messages {
// that the relayer has declared correct number of messages that the proof contains (it
@@ -127,7 +127,7 @@ impl<S: OutboundLaneStorage> OutboundLane<S> {
confirmed_messages.total_messages(),
max_allowed_messages,
);
return Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected)
return Err(ReceptionConfirmationError::TryingToConfirmMoreMessagesThanExpected)
}
ensure_unrewarded_relayers_are_correct(confirmed_messages.end, relayers)?;
@@ -176,24 +176,24 @@ impl<S: OutboundLaneStorage> OutboundLane<S> {
fn ensure_unrewarded_relayers_are_correct<RelayerId>(
latest_received_nonce: MessageNonce,
relayers: &VecDeque<UnrewardedRelayer<RelayerId>>,
) -> Result<(), ReceivalConfirmationError> {
) -> Result<(), ReceptionConfirmationError> {
let mut expected_entry_begin = relayers.front().map(|entry| entry.messages.begin);
for entry in relayers {
// unrewarded relayer entry must have at least 1 unconfirmed message
// (guaranteed by the `InboundLane::receive_message()`)
if entry.messages.end < entry.messages.begin {
return Err(ReceivalConfirmationError::EmptyUnrewardedRelayerEntry)
return Err(ReceptionConfirmationError::EmptyUnrewardedRelayerEntry)
}
// every entry must confirm range of messages that follows previous entry range
// (guaranteed by the `InboundLane::receive_message()`)
if expected_entry_begin != Some(entry.messages.begin) {
return Err(ReceivalConfirmationError::NonConsecutiveUnrewardedRelayerEntries)
return Err(ReceptionConfirmationError::NonConsecutiveUnrewardedRelayerEntries)
}
expected_entry_begin = entry.messages.end.checked_add(1);
// entry can't confirm messages larger than `inbound_lane_data.latest_received_nonce()`
// (guaranteed by the `InboundLane::receive_message()`)
if entry.messages.end > latest_received_nonce {
return Err(ReceivalConfirmationError::FailedToConfirmFutureMessages)
return Err(ReceptionConfirmationError::FailedToConfirmFutureMessages)
}
}
@@ -228,7 +228,7 @@ mod tests {
fn assert_3_messages_confirmation_fails(
latest_received_nonce: MessageNonce,
relayers: &VecDeque<UnrewardedRelayer<TestRelayer>>,
) -> Result<Option<DeliveredMessages>, ReceivalConfirmationError> {
) -> Result<Option<DeliveredMessages>, ReceptionConfirmationError> {
run_test(|| {
let mut lane = outbound_lane::<TestRuntime, _>(TEST_LANE_ID);
lane.send_message(outbound_message_data(REGULAR_PAYLOAD));
@@ -299,7 +299,7 @@ mod tests {
fn confirm_delivery_rejects_nonce_larger_than_last_generated() {
assert_eq!(
assert_3_messages_confirmation_fails(10, &unrewarded_relayers(1..=10),),
Err(ReceivalConfirmationError::FailedToConfirmFutureMessages),
Err(ReceptionConfirmationError::FailedToConfirmFutureMessages),
);
}
@@ -314,7 +314,7 @@ mod tests {
.chain(unrewarded_relayers(3..=3).into_iter())
.collect(),
),
Err(ReceivalConfirmationError::FailedToConfirmFutureMessages),
Err(ReceptionConfirmationError::FailedToConfirmFutureMessages),
);
}
@@ -330,7 +330,7 @@ mod tests {
.chain(unrewarded_relayers(2..=3).into_iter())
.collect(),
),
Err(ReceivalConfirmationError::EmptyUnrewardedRelayerEntry),
Err(ReceptionConfirmationError::EmptyUnrewardedRelayerEntry),
);
}
@@ -345,7 +345,7 @@ mod tests {
.chain(unrewarded_relayers(2..=2).into_iter())
.collect(),
),
Err(ReceivalConfirmationError::NonConsecutiveUnrewardedRelayerEntries),
Err(ReceptionConfirmationError::NonConsecutiveUnrewardedRelayerEntries),
);
}
@@ -409,11 +409,11 @@ mod tests {
lane.send_message(outbound_message_data(REGULAR_PAYLOAD));
assert_eq!(
lane.confirm_delivery(0, 3, &unrewarded_relayers(1..=3)),
Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected),
Err(ReceptionConfirmationError::TryingToConfirmMoreMessagesThanExpected),
);
assert_eq!(
lane.confirm_delivery(2, 3, &unrewarded_relayers(1..=3)),
Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected),
Err(ReceptionConfirmationError::TryingToConfirmMoreMessagesThanExpected),
);
assert_eq!(
lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)),
+2 -2
View File
@@ -261,7 +261,7 @@ impl Chain for TestBridgedChain {
impl ChainWithGrandpa for TestBridgedChain {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = "";
const MAX_AUTHORITIES_COUNT: u32 = 16;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 8;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 8;
const MAX_MANDATORY_HEADER_SIZE: u32 = 256;
const AVERAGE_HEADER_SIZE: u32 = 64;
}
@@ -294,7 +294,7 @@ impl Chain for OtherBridgedChain {
impl ChainWithGrandpa for OtherBridgedChain {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = "";
const MAX_AUTHORITIES_COUNT: u32 = 16;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 8;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 8;
const MAX_MANDATORY_HEADER_SIZE: u32 = 256;
const AVERAGE_HEADER_SIZE: u32 = 64;
}
@@ -427,7 +427,7 @@ mod tests {
run_test(|| {
Bridge::<TestRuntime, ()>::put(uncongested_bridge(FixedU128::from_rational(125, 100)));
// it shold eventually decreased to one
// it should eventually decreased to one
while XcmBridgeHubRouter::bridge().delivery_fee_factor > MINIMAL_DELIVERY_FEE_FACTOR {
XcmBridgeHubRouter::on_initialize(One::one());
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "pallet-xcm-bridge-hub"
description = "Module that adds dynamic bridges/lanes support to XCM infrastucture at the bridge hub."
description = "Module that adds dynamic bridges/lanes support to XCM infrastructure at the bridge hub."
version = "0.2.0"
authors.workspace = true
edition.workspace = true
@@ -83,7 +83,7 @@ impl<H: HeaderT> GrandpaJustification<H> {
.saturating_add(HashOf::<C>::max_encoded_len().saturated_into());
let max_expected_votes_ancestries_size =
C::REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY.saturating_mul(C::AVERAGE_HEADER_SIZE);
C::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY.saturating_mul(C::AVERAGE_HEADER_SIZE);
// justification is round number (u64=8b), a signed GRANDPA commit and the
// `votes_ancestries` vector
@@ -318,7 +318,7 @@ trait JustificationVerifier<Header: HeaderT> {
}
// check that the cumulative weight of validators that voted for the justification target
// (or one of its descendents) is larger than the required threshold.
// (or one of its descendants) is larger than the required threshold.
if cumulative_weight < threshold {
return Err(Error::TooLowCumulativeWeight)
}
+4 -4
View File
@@ -283,7 +283,7 @@ pub trait ChainWithGrandpa: Chain {
/// ancestry and the pallet will accept such justification. The limit is only used to compute
/// maximal refund amount and submitting justifications which exceed the limit, may be costly
/// to submitter.
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32;
/// Maximal size of the mandatory chain header. Mandatory header is the header that enacts new
/// GRANDPA authorities set (so it has large digest inside).
@@ -317,8 +317,8 @@ where
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str =
<T::Chain as ChainWithGrandpa>::WITH_CHAIN_GRANDPA_PALLET_NAME;
const MAX_AUTHORITIES_COUNT: u32 = <T::Chain as ChainWithGrandpa>::MAX_AUTHORITIES_COUNT;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
<T::Chain as ChainWithGrandpa>::REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 =
<T::Chain as ChainWithGrandpa>::REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY;
const MAX_MANDATORY_HEADER_SIZE: u32 =
<T::Chain as ChainWithGrandpa>::MAX_MANDATORY_HEADER_SIZE;
const AVERAGE_HEADER_SIZE: u32 = <T::Chain as ChainWithGrandpa>::AVERAGE_HEADER_SIZE;
@@ -373,7 +373,7 @@ mod tests {
impl ChainWithGrandpa for TestChain {
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = "Test";
const MAX_AUTHORITIES_COUNT: u32 = 128;
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 2;
const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 2;
const MAX_MANDATORY_HEADER_SIZE: u32 = 100_000;
const AVERAGE_HEADER_SIZE: u32 = 1_024;
}
+4 -4
View File
@@ -289,27 +289,27 @@ pub struct ReceivedMessages<DispatchLevelResult> {
/// Id of the lane which is receiving messages.
pub lane: LaneId,
/// Result of messages which we tried to dispatch
pub receive_results: Vec<(MessageNonce, ReceivalResult<DispatchLevelResult>)>,
pub receive_results: Vec<(MessageNonce, ReceptionResult<DispatchLevelResult>)>,
}
impl<DispatchLevelResult> ReceivedMessages<DispatchLevelResult> {
/// Creates new `ReceivedMessages` structure from given results.
pub fn new(
lane: LaneId,
receive_results: Vec<(MessageNonce, ReceivalResult<DispatchLevelResult>)>,
receive_results: Vec<(MessageNonce, ReceptionResult<DispatchLevelResult>)>,
) -> Self {
ReceivedMessages { lane, receive_results }
}
/// Push `result` of the `message` delivery onto `receive_results` vector.
pub fn push(&mut self, message: MessageNonce, result: ReceivalResult<DispatchLevelResult>) {
pub fn push(&mut self, message: MessageNonce, result: ReceptionResult<DispatchLevelResult>) {
self.receive_results.push((message, result));
}
}
/// Result of single message receival.
#[derive(RuntimeDebug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
pub enum ReceivalResult<DispatchLevelResult> {
pub enum ReceptionResult<DispatchLevelResult> {
/// Message has been received and dispatched. Note that we don't care whether dispatch has
/// been successful or not - in both case message falls into this category.
///
+1 -1
View File
@@ -71,7 +71,7 @@ pub const MAX_AUTHORITIES_COUNT: u32 = 1_256;
/// justifications with any additional headers in votes ancestry, so reasonable headers may
/// be set to zero. But we assume that there may be small GRANDPA lags, so we're leaving some
/// reserve here.
pub const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 2;
pub const REASONABLE_HEADERS_IN_JUSTIFICATION_ANCESTRY: u32 = 2;
/// Average header size in `votes_ancestries` field of justification on Polkadot-like
/// chains.
+3 -3
View File
@@ -104,7 +104,7 @@ pub trait Chain: Send + Sync + 'static {
const ID: ChainId;
/// A type that fulfills the abstract idea of what a Substrate block number is.
// Constraits come from the associated Number type of `sp_runtime::traits::Header`
// Constraints come from the associated Number type of `sp_runtime::traits::Header`
// See here for more info:
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Number
//
@@ -125,7 +125,7 @@ pub trait Chain: Send + Sync + 'static {
+ MaxEncodedLen;
/// A type that fulfills the abstract idea of what a Substrate hash is.
// Constraits come from the associated Hash type of `sp_runtime::traits::Header`
// Constraints come from the associated Hash type of `sp_runtime::traits::Header`
// See here for more info:
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Hash
type Hash: Parameter
@@ -143,7 +143,7 @@ pub trait Chain: Send + Sync + 'static {
/// A type that fulfills the abstract idea of what a Substrate hasher (a type
/// that produces hashes) is.
// Constraits come from the associated Hashing type of `sp_runtime::traits::Header`
// Constraints come from the associated Hashing type of `sp_runtime::traits::Header`
// See here for more info:
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Hashing
type Hasher: HashT<Output = Self::Hash>;
+2 -2
View File
@@ -56,7 +56,7 @@ mod chain;
mod storage_proof;
mod storage_types;
// Re-export macro to aviod include paste dependency everywhere
// Re-export macro to avoid include paste dependency everywhere
pub use sp_runtime::paste;
/// Use this when something must be shared among all instances.
@@ -461,7 +461,7 @@ macro_rules! generate_static_str_provider {
};
}
/// Error message that is only dispayable in `std` environment.
/// Error message that is only displayable in `std` environment.
#[derive(Encode, Decode, Clone, Eq, PartialEq, PalletError, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct StrippableError<T> {
+1 -1
View File
@@ -88,7 +88,7 @@ pub fn make_default_justification<H: HeaderT>(header: &H) -> GrandpaJustificatio
/// Generate justifications in a way where we are able to tune the number of pre-commits
/// and vote ancestries which are included in the justification.
///
/// This is useful for benchmarkings where we want to generate valid justifications with
/// This is useful for benchmarks where we want to generate valid justifications with
/// a specific number of pre-commits (tuned with the number of "authorities") and/or a specific
/// number of vote ancestries (tuned with the "votes" parameter).
///
+1 -1
View File
@@ -134,7 +134,7 @@ cargo check -p bridge-runtime-common
cargo check -p bridge-runtime-common --features runtime-benchmarks
cargo check -p bridge-runtime-common --features integrity-test
# we're removing lock file after all chechs are done. Otherwise we may use different
# we're removing lock file after all checks are done. Otherwise we may use different
# Substrate/Polkadot/Cumulus commits and our checks will fail
rm -f $BRIDGES_FOLDER/Cargo.lock
@@ -10,7 +10,7 @@
//!
//! * [`Call::force_checkpoint`]: Set the initial trusted consensus checkpoint.
//! * [`Call::set_operating_mode`]: Set the operating mode of the pallet. Can be used to disable
//! processing of conensus updates.
//! processing of consensus updates.
//!
//! ## Consensus Updates
//!
@@ -249,7 +249,7 @@ pub fn execution_header_pruning() {
stored_hashes.push(hash);
}
// We should have only stored upto `execution_header_prune_threshold`
// We should have only stored up to `execution_header_prune_threshold`
assert_eq!(
ExecutionHeaders::<Test>::iter().count() as u32,
execution_header_prune_threshold
@@ -9,7 +9,7 @@ use snowbridge_beacon_primitives::CompactExecutionHeader;
use snowbridge_core::inbound::{Log, Message, Proof};
use sp_std::vec;
pub fn make_register_token_with_infufficient_fee_message() -> InboundQueueFixture {
pub fn make_register_token_with_insufficient_fee_message() -> InboundQueueFixture {
InboundQueueFixture {
execution_header: CompactExecutionHeader{
parent_hash: hex!("998e81dc6df788a920b67e058fbde0dc3f4ec6f11f3f7cd8c3148e6d99584885").into(),
@@ -1,7 +1,7 @@
Description: Check if the with-Westend GRANPDA pallet was initialized at Rococo BH
Description: Check if the with-Westend GRANDPA pallet was initialized at Rococo BH
Network: ./bridge_hub_rococo_local_network.toml
Creds: config
# relay is already started - let's wait until with-Westend GRANPDA pallet is initialized at Rococo
# relay is already started - let's wait until with-Westend GRANDPA pallet is initialized at Rococo
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds
@@ -1,6 +1,6 @@
Description: Check if the with-Rococo GRANPDA pallet was initialized at Westend BH
Description: Check if the with-Rococo GRANDPA pallet was initialized at Westend BH
Network: ./bridge_hub_westend_local_network.toml
Creds: config
# relay is already started - let's wait until with-Rococo GRANPDA pallet is initialized at Westend
# relay is already started - let's wait until with-Rococo GRANDPA pallet is initialized at Westend
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds
@@ -126,36 +126,36 @@ if (!process.argv[2] || !process.argv[3]) {
}
const type = process.argv[2];
const rpcEnpoint = process.argv[3];
const rpcEndpoint = process.argv[3];
const output = process.argv[4];
const inputArgs = process.argv.slice(5, process.argv.length);
console.log(`Generating hex-encoded call data for:`);
console.log(` type: ${type}`);
console.log(` rpcEnpoint: ${rpcEnpoint}`);
console.log(` rpcEndpoint: ${rpcEndpoint}`);
console.log(` output: ${output}`);
console.log(` inputArgs: ${inputArgs}`);
switch (type) {
case 'remark-with-event':
remarkWithEvent(rpcEnpoint, output);
remarkWithEvent(rpcEndpoint, output);
break;
case 'add-exporter-config':
addExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]);
addExporterConfig(rpcEndpoint, output, inputArgs[0], inputArgs[1]);
break;
case 'remove-exporter-config':
removeExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]);
removeExporterConfig(rpcEndpoint, output, inputArgs[0], inputArgs[1]);
break;
case 'add-universal-alias':
addUniversalAlias(rpcEnpoint, output, inputArgs[0], inputArgs[1]);
addUniversalAlias(rpcEndpoint, output, inputArgs[0], inputArgs[1]);
break;
case 'add-reserve-location':
addReserveLocation(rpcEnpoint, output, inputArgs[0]);
addReserveLocation(rpcEndpoint, output, inputArgs[0]);
break;
case 'force-create-asset':
forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
forceCreateAsset(rpcEndpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
break;
case 'force-xcm-version':
forceXcmVersion(rpcEnpoint, output, inputArgs[0], inputArgs[1]);
forceXcmVersion(rpcEndpoint, output, inputArgs[0], inputArgs[1]);
break;
case 'check':
console.log(`Checking nodejs installation, if you see this everything is ready!`);
+1 -1
View File
@@ -30,7 +30,7 @@ done
export POLKADOT_SDK_PATH=`realpath $(dirname "$0")/../..`
export BRIDGE_TESTS_FOLDER=$POLKADOT_SDK_PATH/bridges/testing/tests
# set pathc to binaries
# set path to binaries
if [ "$ZOMBIENET_DOCKER_PATHS" -eq 1 ]; then
export POLKADOT_BINARY=/usr/local/bin/polkadot
export POLKADOT_PARACHAIN_BINARY=/usr/local/bin/polkadot-parachain
@@ -24,7 +24,7 @@ echo -e "Sleeping 90s before starting relayer ...\n"
sleep 90
${BASH_SOURCE%/*}/../../environments/rococo-westend/start_relayer.sh $rococo_dir $westend_dir relayer_pid
# Sometimes the relayer syncs multiple parachain heads in the begining leading to test failures.
# Sometimes the relayer syncs multiple parachain heads in the beginning leading to test failures.
# See issue: https://github.com/paritytech/parity-bridges-common/issues/2838.
# TODO: Remove this sleep after the issue is fixed.
echo -e "Sleeping 180s before runing the tests ...\n"
@@ -158,7 +158,7 @@ where
/// the limit passed to the constructor.
///
/// If the given level is found to have a number of blocks greater than or equal the limit
/// then the limit is enforced by chosing one (or more) blocks to remove.
/// then the limit is enforced by choosing one (or more) blocks to remove.
///
/// The removal strategy is driven by the block freshness.
///
+1 -1
View File
@@ -832,7 +832,7 @@ fn restore_limit_monitor() {
.collect::<Vec<_>>();
// Scenario before limit application (with B11 imported as best)
// Import order (freshess): B00, B10, B11, B12, B20, B21
// Import order (freshness): B00, B10, B11, B12, B20, B21
//
// B00 --+-- B10 --+-- B20
// | +-- B21
+5 -5
View File
@@ -18,7 +18,7 @@
//!
//! A parachain needs to build PoVs that are send to the relay chain to progress. These PoVs are
//! erasure encoded and one piece of it is stored by each relay chain validator. As the relay chain
//! decides on which PoV per parachain to include and thus, to progess the parachain it can happen
//! decides on which PoV per parachain to include and thus, to progress the parachain it can happen
//! that the block corresponding to this PoV isn't propagated in the parachain network. This can
//! have several reasons, either a malicious collator that managed to include its own PoV and
//! doesn't want to share it with the rest of the network or maybe a collator went down before it
@@ -338,8 +338,8 @@ where
let mut blocks_to_delete = vec![hash];
while let Some(delete) = blocks_to_delete.pop() {
if let Some(childs) = self.waiting_for_parent.remove(&delete) {
blocks_to_delete.extend(childs.iter().map(BlockT::hash));
if let Some(children) = self.waiting_for_parent.remove(&delete) {
blocks_to_delete.extend(children.iter().map(BlockT::hash));
}
}
self.clear_waiting_recovery(&hash);
@@ -448,7 +448,7 @@ where
/// Import the given `block`.
///
/// This will also recursivley drain `waiting_for_parent` and import them as well.
/// This will also recursively drain `waiting_for_parent` and import them as well.
fn import_block(&mut self, block: Block) {
let mut blocks = VecDeque::new();
@@ -495,7 +495,7 @@ where
tracing::debug!(
target: LOG_TARGET,
block_hash = ?hash,
"Cound not recover. Block was never announced as candidate"
"Could not recover. Block was never announced as candidate"
);
return
},
@@ -293,7 +293,8 @@ impl ReconnectingWebsocketWorker {
/// listeners. If an error occurs during sending, the receiver has been closed and we remove
/// the sender from the list.
/// - Find a new valid RPC server to connect to in case the websocket connection is terminated.
/// If the worker is not able to connec to an RPC server from the list, the worker shuts down.
/// If the worker is not able to connect to an RPC server from the list, the worker shuts
/// down.
pub async fn run(mut self) {
let mut pending_requests = FuturesUnordered::new();
+1 -1
View File
@@ -464,7 +464,7 @@ pub mod pallet {
// One complication here, is that the `host_configuration` is updated by an inherent
// and those are processed after the block initialization phase. Therefore, we have to
// be content only with the configuration as per the previous block. That means that
// the configuration can be either stale (or be abscent altogether in case of the
// the configuration can be either stale (or be absent altogether in case of the
// beginning of the chain).
//
// In order to mitigate this, we do the following. At the time, we are only concerned
@@ -90,7 +90,7 @@ pub enum Error {
DmqMqcHead(ReadEntryErr),
/// Relay dispatch queue cannot be extracted.
RelayDispatchQueueRemainingCapacity(ReadEntryErr),
/// The hrmp inress channel index cannot be extracted.
/// The hrmp ingress channel index cannot be extracted.
HrmpIngressChannelIndex(ReadEntryErr),
/// The hrmp egress channel index cannot be extracted.
HrmpEgressChannelIndex(ReadEntryErr),
+1 -1
View File
@@ -462,7 +462,7 @@ impl<T: Config> Pallet<T> {
// Max message size refers to aggregates, or pages. Not to individual fragments.
let max_message_size = channel_info.max_message_size as usize;
let format_size = format.encoded_size();
// We check the encoded fragment length plus the format size agains the max message size
// We check the encoded fragment length plus the format size against the max message size
// because the format is concatenated if a new page is needed.
let size_to_check = encoded_fragment
.len()
@@ -20,7 +20,7 @@ use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalSiblingSovereigAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION,
};
use parachains_common::{AccountId, Balance};
@@ -76,7 +76,7 @@ pub fn genesis() -> Storage {
// Penpal's teleportable asset representation
(
PenpalTeleportableAssetLocation::get(),
PenpalSiblingSovereigAccount::get(),
PenpalSiblingSovereignAccount::get(),
true,
ED,
),
@@ -20,7 +20,7 @@ use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalSiblingSovereigAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION,
};
use parachains_common::{AccountId, Balance};
@@ -72,7 +72,7 @@ pub fn genesis() -> Storage {
// Penpal's teleportable asset representation
(
PenpalTeleportableAssetLocation::get(),
PenpalSiblingSovereigAccount::get(),
PenpalSiblingSovereignAccount::get(),
true,
ED,
),
@@ -31,8 +31,8 @@ pub const PARA_ID_B: u32 = 2001;
pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT;
parameter_types! {
pub PenpalSudoAcccount: AccountId = get_account_id_from_seed::<sr25519::Public>("Alice");
pub PenpalAssetOwner: AccountId = PenpalSudoAcccount::get();
pub PenpalSudoAccount: AccountId = get_account_id_from_seed::<sr25519::Public>("Alice");
pub PenpalAssetOwner: AccountId = PenpalSudoAccount::get();
}
pub fn genesis(para_id: u32) -> Storage {
@@ -66,7 +66,7 @@ pub fn genesis(para_id: u32) -> Storage {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
sudo: penpal_runtime::SudoConfig { key: Some(PenpalSudoAcccount::get()) },
sudo: penpal_runtime::SudoConfig { key: Some(PenpalSudoAccount::get()) },
assets: penpal_runtime::AssetsConfig {
assets: vec![(
penpal_runtime::xcm_config::TELEPORTABLE_ASSET_ID,
@@ -14,7 +14,7 @@
// limitations under the License.
mod genesis;
pub use genesis::{genesis, PenpalAssetOwner, PenpalSudoAcccount, ED, PARA_ID_A, PARA_ID_B};
pub use genesis::{genesis, PenpalAssetOwner, PenpalSudoAccount, ED, PARA_ID_A, PARA_ID_B};
pub use penpal_runtime::xcm_config::{
CustomizableAssetFromSystemAssetHub, LocalTeleportableToAssetHub, XcmConfig,
};
@@ -114,7 +114,7 @@ where
.expect("Bridge message does not exist")
.into();
let payload = Vec::<u8>::decode(&mut &encoded_payload[..])
.expect("Decodign XCM message failed");
.expect("Decoding XCM message failed");
let id: u32 = LaneIdWrapper(*lane).into();
let message = BridgeMessage { id, nonce, payload };
@@ -265,7 +265,7 @@ macro_rules! impl_assert_events_helpers_for_relay_chain {
$crate::impls::assert_expected_events!(
Self,
vec![
// XCM is successfully received and proccessed
// XCM is successfully received and processed
[<$chain RuntimeEvent>]::<N>::MessageQueue($crate::impls::pallet_message_queue::Event::Processed {
origin: $crate::impls::AggregateMessageOrigin::Ump($crate::impls::UmpQueueId::Para(id)),
weight_used,
@@ -343,7 +343,7 @@ macro_rules! impl_hrmp_channels_helpers_for_relay_chain {
<Self as Chain>::Runtime,
>::contains_key(&channel_id);
// Check the HRMP channel has been successfully registrered
// Check the HRMP channel has been successfully registered
assert!(hrmp_channel_exist)
});
}
@@ -67,7 +67,7 @@ parameter_types! {
xcm::v3::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalSiblingSovereigAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
pub PenpalSiblingSovereignAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
}
/// Helper function to generate a crypto pair from seed
@@ -1052,7 +1052,7 @@ fn reserve_transfer_native_asset_from_para_to_para_trough_relay() {
// fund the Parachain Origin's SA on Relay Chain with the native tokens held in reserve
Rococo::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]);
// Init values for Parachain Desitnation
// Init values for Parachain Destination
let receiver = PenpalBReceiver::get();
// Init Test
@@ -215,7 +215,7 @@ fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
let system_para_native_asset_location =
v3::Location::try_from(RelayLocation::get()).expect("conversion works");
let reservable_asset_location =
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("coversion works");
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8799)));
assert_expected_events!(
PenpalA,
@@ -246,7 +246,7 @@ fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
fn system_para_to_para_assets_receiver_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent;
let system_para_asset_location =
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("coversion works");
v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
PenpalA::assert_xcmp_queue_success(None);
assert_expected_events!(
PenpalA,
@@ -1054,7 +1054,7 @@ fn reserve_transfer_native_asset_from_para_to_para_trough_relay() {
// fund the Parachain Origin's SA on Relay Chain with the native tokens held in reserve
Westend::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]);
// Init values for Parachain Desitnation
// Init values for Parachain Destination
let receiver = PenpalBReceiver::get();
// Init Test
@@ -23,7 +23,7 @@ use rococo_westend_system_emulated_network::BridgeHubRococoParaSender as BridgeH
use snowbridge_core::outbound::OperatingMode;
use snowbridge_pallet_inbound_queue_fixtures::{
register_token::make_register_token_message,
register_token_with_insufficient_fee::make_register_token_with_infufficient_fee_message,
register_token_with_insufficient_fee::make_register_token_with_insufficient_fee_message,
send_token::make_send_token_message, send_token_to_penpal::make_send_token_to_penpal_message,
InboundQueueFixture,
};
@@ -514,7 +514,7 @@ fn register_weth_token_in_asset_hub_fail_for_insufficient_fee() {
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
// Construct RegisterToken message and sent to inbound queue
let message = make_register_token_with_infufficient_fee_message();
let message = make_register_token_with_insufficient_fee_message();
send_inbound_message(message).unwrap();
assert_expected_events!(
@@ -192,7 +192,7 @@ pub type ForeignFungiblesTransactor = FungiblesAdapter<
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We dont need to check teleports here.
// We don't need to check teleports here.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
@@ -185,7 +185,7 @@ pub type ForeignFungiblesTransactor = FungiblesAdapter<
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We dont need to check teleports here.
// We don't need to check teleports here.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
@@ -618,7 +618,7 @@ fn test_asset_xcm_take_first_trader_with_refund() {
// We actually use half of the weight
let weight_used = bought / 2;
// Make sure refurnd works.
// Make sure refund works.
let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used));
assert_eq!(
@@ -745,7 +745,7 @@ fn test_that_buying_ed_refund_does_not_refund_for_take_first_trader() {
// Buy weight should work
assert_ok!(trader.buy_weight(bought, asset.into(), &ctx));
// Should return None. We have a specific check making sure we dont go below ED for
// Should return None. We have a specific check making sure we don't go below ED for
// drop payment
assert_eq!(trader.refund_weight(bought, &ctx), None);
@@ -1120,7 +1120,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor
AssetId: Clone,
AssetIdConverter: MaybeEquivalence<Location, AssetId>,
{
// foreign parachain with the same consenus currency as asset
// foreign parachain with the same consensus currency as asset
let foreign_asset_id_location = Location::new(1, [Parachain(2222), GeneralIndex(1234567)]);
let asset_id = AssetIdConverter::convert(&foreign_asset_id_location).unwrap();
@@ -386,7 +386,7 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
existential_deposit,
);
// create foreign asset for wrapped/derivated representation
// create foreign asset for wrapped/derived representation
assert_ok!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::force_create(
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::root_origin(),
@@ -456,7 +456,7 @@ mod benches {
[cumulus_pallet_xcmp_queue, XcmpQueue]
[pallet_collator_selection, CollatorSelection]
// XCM
[pallet_xcm, PalletXcmExtrinsiscsBenchmark::<Runtime>]
[pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pallet_xcm_benchmarks::fungible, XcmBalances]
[pallet_xcm_benchmarks::generic, XcmGeneric]
);
@@ -644,7 +644,7 @@ impl_runtime_apis! {
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
// This is defined once again in dispatch_benchmark, because list_benchmarks!
// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
@@ -680,7 +680,7 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
impl pallet_xcm::benchmarking::Config for Runtime {
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
xcm_config::XcmConfig,
@@ -344,7 +344,7 @@ parameter_types! {
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
/// We allow Root and the `StakingAdmi` to execute privileged collator selection operations.
/// We allow Root and the `StakingAdmin` to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
@@ -456,7 +456,7 @@ mod benches {
[cumulus_pallet_xcmp_queue, XcmpQueue]
[pallet_collator_selection, CollatorSelection]
// XCM
[pallet_xcm, PalletXcmExtrinsiscsBenchmark::<Runtime>]
[pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pallet_xcm_benchmarks::fungible, XcmBalances]
[pallet_xcm_benchmarks::generic, XcmGeneric]
);
@@ -644,7 +644,7 @@ impl_runtime_apis! {
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
// This is defined once again in dispatch_benchmark, because list_benchmarks!
// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
@@ -680,7 +680,7 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
impl pallet_xcm::benchmarking::Config for Runtime {
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
xcm_config::XcmConfig,
@@ -145,7 +145,7 @@ pub type ForeignFungiblesTransactor = FungiblesAdapter<
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We dont need to check teleports here.
// We don't need to check teleports here.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
+1 -1
View File
@@ -135,7 +135,7 @@ fn runtime(id: &str) -> Runtime {
fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
let (id, _, para_id) = extract_parachain_id(id);
Ok(match id {
// - Defaul-like
// - Default-like
"staging" =>
Box::new(chain_spec::rococo_parachain::staging_rococo_parachain_local_config()),
"tick" => Box::new(GenericChainSpec::from_json_bytes(
@@ -421,7 +421,7 @@ mod tests {
.unwrap();
assert_eq!(pre, Some(100));
// The `CheckWeight` extension will refunt `actual_weight` from `PostDispatchInfo`
// The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo`
// we always need to call `post_dispatch` to verify that they interoperate correctly.
assert_ok!(CheckWeight::<Test>::post_dispatch(None, &info, &post_info, 0, &Ok(())));
assert_ok!(StorageWeightReclaim::<Test>::post_dispatch(
@@ -456,7 +456,7 @@ mod tests {
.unwrap();
assert_eq!(pre, Some(100));
// The `CheckWeight` extension will refunt `actual_weight` from `PostDispatchInfo`
// The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo`
// we always need to call `post_dispatch` to verify that they interoperate correctly.
assert_ok!(CheckWeight::<Test>::post_dispatch(None, &info, &post_info, 0, &Ok(())));
assert_ok!(StorageWeightReclaim::<Test>::post_dispatch(
@@ -500,7 +500,7 @@ mod tests {
&Ok(())
));
// `CheckWeight` gets called after `StorageWeightReclaim` this time.
// The `CheckWeight` extension will refunt `actual_weight` from `PostDispatchInfo`
// The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo`
// we always need to call `post_dispatch` to verify that they interoperate correctly.
assert_ok!(CheckWeight::<Test>::post_dispatch(None, &info, &post_info, 0, &Ok(())));
@@ -536,7 +536,7 @@ mod tests {
&Ok(())
));
// `CheckWeight` gets called after `StorageWeightReclaim` this time.
// The `CheckWeight` extension will refunt `actual_weight` from `PostDispatchInfo`
// The `CheckWeight` extension will refund `actual_weight` from `PostDispatchInfo`
// we always need to call `post_dispatch` to verify that they interoperate correctly.
assert_ok!(CheckWeight::<Test>::post_dispatch(None, &info, &post_info, 0, &Ok(())));
+1 -1
View File
@@ -22,7 +22,7 @@
//! access to any clock from the runtime the timestamp is always passed as an inherent into the
//! runtime. To check this inherent when validating the block, we will use the relay chain slot. As
//! the relay chain slot is derived from a timestamp, we can easily convert it back to a timestamp
//! by muliplying it with the slot duration. By comparing the relay chain slot derived timestamp
//! by multiplying it with the slot duration. By comparing the relay chain slot derived timestamp
//! with the timestamp we can ensure that the parachain timestamp is reasonable.
#![cfg_attr(not(feature = "std"), no_std)]
+13 -12
View File
@@ -141,7 +141,7 @@ impl<
) -> Result<xcm_executor::AssetsInHolding, XcmError> {
log::trace!(target: "xcm::weight", "TakeFirstAssetTrader::buy_weight weight: {:?}, payment: {:?}, context: {:?}", weight, payment, context);
// Make sure we dont enter twice
// Make sure we don't enter twice
if self.0.is_some() {
return Err(XcmError::NotWithdrawable)
}
@@ -176,7 +176,7 @@ impl<
// Convert to the same kind of asset, with the required fungible balance
let required = first.id.clone().into_asset(asset_balance.into());
// Substract payment
// Subtract payment
let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?;
// record weight and asset
@@ -203,7 +203,7 @@ impl<
// Calculate asset_balance
// This read should have already be cached in buy_weight
let (asset_balance, outstanding_minus_substracted) =
let (asset_balance, outstanding_minus_subtracted) =
FeeCharger::charge_weight_in_fungibles(local_asset_id, weight).ok().map(
|asset_balance| {
// Require at least a drop of minimum_balance
@@ -221,16 +221,15 @@ impl<
)?;
// Convert balances into u128
let outstanding_minus_substracted: u128 =
outstanding_minus_substracted.saturated_into();
let outstanding_minus_subtracted: u128 = outstanding_minus_subtracted.saturated_into();
let asset_balance: u128 = asset_balance.saturated_into();
// Construct outstanding_concrete_asset with the same location id and substracted
// Construct outstanding_concrete_asset with the same location id and subtracted
// balance
let outstanding_concrete_asset: Asset =
(id.clone(), outstanding_minus_substracted).into();
(id.clone(), outstanding_minus_subtracted).into();
// Substract from existing weight and balance
// Subtract from existing weight and balance
weight_outstanding = weight_outstanding.saturating_sub(weight);
// Override AssetTraderRefunder
@@ -263,9 +262,10 @@ impl<
}
}
/// XCM fee depositor to which we implement the TakeRevenue trait
/// It receives a Transact implemented argument, a 32 byte convertible acocuntId, and the fee
/// receiver account FungiblesMutateAdapter should be identical to that implemented by WithdrawAsset
/// XCM fee depositor to which we implement the `TakeRevenue` trait.
/// It receives a `Transact` implemented argument and a 32 byte convertible `AccountId`, and the fee
/// receiver account's `FungiblesMutateAdapter` should be identical to that implemented by
/// `WithdrawAsset`.
pub struct XcmFeesTo32ByteAccount<FungiblesMutateAdapter, AccountId, ReceiverAccount>(
PhantomData<(FungiblesMutateAdapter, AccountId, ReceiverAccount)>,
);
@@ -763,7 +763,8 @@ mod test_trader {
/// Implementation of `xcm_builder::EnsureDelivery` which helps to ensure delivery to the
/// parent relay chain. Deposits existential deposit for origin (if needed).
/// Deposits estimated fee to the origin account (if needed).
/// Allows to trigger additional logic for specific `ParaId` (e.g. open HRMP channel) (if neeeded).
/// Allows triggering of additional logic for a specific `ParaId` (e.g. to open an HRMP channel) if
/// needed.
#[cfg(feature = "runtime-benchmarks")]
pub struct ToParentDeliveryHelper<XcmConfig, ExistentialDeposit, PriceForDelivery>(
sp_std::marker::PhantomData<(XcmConfig, ExistentialDeposit, PriceForDelivery)>,
@@ -19,14 +19,14 @@ async function connect(endpoint, types = {}) {
}
if (!process.argv[2] || !process.argv[3]) {
console.log("usage: node generate_keys <input json> <scale output file> [rpc enpoint]");
console.log("usage: node generate_keys <input json> <scale output file> [rpc endpoint]");
exit();
}
const input = process.argv[2];
const output = process.argv[3];
// default to localhost and the default Substrate port
const rpcEnpoint = process.argv[4] || "ws://localhost:9944";
const rpcEndpoint = process.argv[4] || "ws://localhost:9944";
console.log("Processing", input, output);
fs.readFile(input, "utf8", (err, data) => {
@@ -38,8 +38,8 @@ fs.readFile(input, "utf8", (err, data) => {
const genesis = JSON.parse(data);
console.log("loaded genesis, length = ", genesis.length);
console.log(`Connecting to RPC endpoint: ${rpcEnpoint}`);
connect(rpcEnpoint)
console.log(`Connecting to RPC endpoint: ${rpcEndpoint}`);
connect(rpcEndpoint)
.then((api) => {
console.log('Connected');
const setStorage = api.tx.system.setStorage(genesis);
+1 -1
View File
@@ -54,7 +54,7 @@
"validity_votes": "Vec<ValidityAttestation>",
"validator_indices": "BitVec"
},
"CandidatePendingAvailablility": {
"CandidatePendingAvailability": {
"core": "u32",
"descriptor": "CandidateDescriptor",
"availability_votes": "BitVec",
+1 -1
View File
@@ -139,7 +139,7 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers.
/// This is used to limit the maximal weight of a single extrinsic.
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used
@@ -47,7 +47,7 @@ fn create_extrinsics(
src_accounts: &[sr25519::Pair],
dst_accounts: &[sr25519::Pair],
) -> (usize, Vec<UncheckedExtrinsic>) {
// Add as many tranfer extrinsics as possible into a single block.
// Add as many transfer extrinsics as possible into a single block.
let mut block_builder = BlockBuilderBuilder::new(client)
.on_parent_block(client.chain_info().best_hash)
.with_parent_block_number(client.chain_info().best_number)
+2 -2
View File
@@ -735,7 +735,7 @@ pub fn node_config(
tokio_handle: tokio::runtime::Handle,
key: Sr25519Keyring,
nodes: Vec<MultiaddrWithPeerId>,
nodes_exlusive: bool,
nodes_exclusive: bool,
para_id: ParaId,
is_collator: bool,
endowed_accounts: Vec<AccountId>,
@@ -759,7 +759,7 @@ pub fn node_config(
None,
);
if nodes_exlusive {
if nodes_exclusive {
network_config.default_peers_set.reserved_nodes = nodes;
network_config.default_peers_set.non_reserved_mode =
sc_network::config::NonReservedPeerMode::Deny;
@@ -2,7 +2,7 @@ FROM docker.io/parity/base-bin
# This file allows building a Generic container image
# based on one or multiple pre-built Linux binaries.
# Some defaults are set to polkadot but all can be overriden.
# Some defaults are set to polkadot but all can be overridden.
SHELL ["/bin/bash", "-c"]
+1 -1
View File
@@ -20,7 +20,7 @@ PROJECT_ROOT=${PROJECT_ROOT:-$(git rev-parse --show-toplevel)}
DOCKERFILE=${DOCKERFILE:-docker/dockerfiles/binary_injected.Dockerfile}
VERSION_TOML=$(grep "^version " $PROJECT_ROOT/Cargo.toml | grep -oE "([0-9\.]+-?[0-9]+)")
#n The following VAR have default that can be overriden
#n The following VAR have default that can be overridden
DOCKER_OWNER=${DOCKER_OWNER:-parity}
# We may get 1..n binaries, comma separated
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-sdk-docs"
description = "The one stop shop for developers of the polakdot-sdk"
description = "The one stop shop for developers of the polkadot-sdk"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage = "paritytech.github.io"
repository.workspace = true
@@ -16,7 +16,7 @@
//! in a process called "Runtime Upgrades".
//!
//! Forkless runtime upgrades are a defining feature of the Substrate framework. Updating the
//! runtime logic without forking the code base enables your blockchain to seemlessly evolve
//! runtime logic without forking the code base enables your blockchain to seamlessly evolve
//! over time in a deterministic, rules-based manner. It also removes ambiguity for node operators
//! and other participants in the network about what is the canonical runtime.
//!
@@ -24,7 +24,7 @@
//!
//! ## Performing a Runtime Upgrade
//!
//! To upgrade a runtime, an [`Origin`](frame_system::RawOrigin) with the necesarry permissions
//! To upgrade a runtime, an [`Origin`](frame_system::RawOrigin) with the necessary permissions
//! (usually via governance) changes the `:code` storage. Usually, this is performed via a call to
//! [`set_code`] (or [`set_code_without_checks`]) with the desired new runtime blob, scheduled
//! using [`pallet_scheduler`].
@@ -41,7 +41,7 @@
//!
//! The typical use case of a migration is to 'migrate' pallet storage from one layout to another,
//! for example when the encoding of a storage item is changed. However, they can also execute
//! arbitary logic such as:
//! arbitrary logic such as:
//!
//! - Calling arbitrary pallet methods
//! - Mutating arbitrary on-chain state
@@ -88,7 +88,7 @@
//!
//! Prior to deploying migrations, it is critical to perform additional checks to ensure that when
//! run in our real runtime they will not brick the chain due to:
//! - Panicing
//! - Panicking
//! - Touching too many storage keys and resulting in an excessively large PoV
//! - Taking too long to execute
//!
+1 -1
View File
@@ -122,7 +122,7 @@ pub struct RunCmd {
/// Overseer message capacity override.
///
/// **Dangerous!** Do not touch unless explicitly adviced to.
/// **Dangerous!** Do not touch unless explicitly advised to.
#[arg(long)]
pub overseer_channel_capacity_override: Option<usize>,
+1 -1
View File
@@ -8,7 +8,7 @@ monitor the liveliness and performance of a network and its validators.
# How does it work ?
Just import the dashboard JSON files from this folder in your Grafana installation. All dashboards are grouped in
folder percategory (like for example `parachains`). The files have been created by Grafana export functionality and
folder per category (like for example `parachains`). The files have been created by Grafana export functionality and
follow the data model specified [here](https://grafana.com/docs/grafana/latest/dashboards/json-model/).
We aim to keep the dashboards here in sync with the implementation, except dashboards for development and
@@ -254,7 +254,7 @@ fn canonicalize_works() {
// -> B1 -> C1 -> D1
// A -> B2 -> C2 -> D2
//
// We'll canonicalize C1. Everytning except D1 should disappear.
// We'll canonicalize C1. Everything except D1 should disappear.
//
// Candidates:
// Cand1 in B2
@@ -79,7 +79,7 @@ pub fn v1_to_latest(db: Arc<dyn Database>, config: Config) -> Result<()> {
block.candidates().iter().enumerate()
{
// Loading the candidate will also perform the conversion to the updated format and
// return that represantation.
// return that representation.
if let Some(candidate_entry) = backend
.load_candidate_entry_v1(&candidate_hash, candidate_index as CandidateIndex)
.map_err(|e| Error::InternalError(e))?
@@ -269,7 +269,7 @@ fn canonicalize_works() {
// -> B1 -> C1 -> D1
// A -> B2 -> C2 -> D2
//
// We'll canonicalize C1. Everytning except D1 should disappear.
// We'll canonicalize C1. Everything except D1 should disappear.
//
// Candidates:
// Cand1 in B2
@@ -60,7 +60,7 @@ pub fn v2_to_latest(db: Arc<dyn Database>, config: Config) -> Result<()> {
block.candidates().iter().enumerate()
{
// Loading the candidate will also perform the conversion to the updated format and
// return that represantation.
// return that representation.
if let Some(candidate_entry) = backend
.load_candidate_entry_v2(&candidate_hash, candidate_index as CandidateIndex)
.map_err(|e| Error::InternalError(e))?
@@ -104,7 +104,7 @@ pub fn v1_to_latest_sanity_check(
for block in all_blocks {
for (_core_index, candidate_hash) in block.candidates() {
// Loading the candidate will also perform the conversion to the updated format and
// return that represantation.
// return that representation.
if let Some(candidate_entry) = backend.load_candidate_entry(&candidate_hash).unwrap() {
candidates.insert(candidate_entry.candidate.hash());
}
@@ -264,7 +264,7 @@ fn canonicalize_works() {
// -> B1 -> C1 -> D1
// A -> B2 -> C2 -> D2
//
// We'll canonicalize C1. Everytning except D1 should disappear.
// We'll canonicalize C1. Everything except D1 should disappear.
//
// Candidates:
// Cand1 in B2
@@ -148,7 +148,7 @@ fn relay_vrf_modulo_cores(
generate_samples(rand_chacha, num_samples as usize, max_cores as usize)
}
/// Generates `num_sumples` randomly from (0..max_cores) range
/// Generates `num_samples` randomly from (0..max_cores) range
///
/// Note! The algorithm can't change because validators on the other
/// side won't be able to check the assignments until they update.
@@ -91,7 +91,7 @@ enum ImportedBlockInfoError {
#[error(transparent)]
RuntimeError(RuntimeApiError),
#[error("future cancalled while requesting {0}")]
#[error("future cancelled while requesting {0}")]
FutureCancelled(&'static str, futures::channel::oneshot::Canceled),
#[error(transparent)]
@@ -1850,7 +1850,7 @@ async fn get_approval_signatures_for_candidate<Context>(
gum::trace!(
target: LOG_TARGET,
?candidate_hash,
"Spawning task for fetching sinatures from approval-distribution"
"Spawning task for fetching signatures from approval-distribution"
);
ctx.spawn("get-approval-signatures", Box::pin(get_approvals))
}
+12 -12
View File
@@ -3154,7 +3154,7 @@ where
// starting configuration. The relevant ticks (all scheduled wakeups) are printed after no further
// ticks are scheduled. To create a valid test, a prefix of the relevant ticks should be included
// in the final test configuration, ending at the tick with the desired inputs to
// should_trigger_assignemnt.
// should_trigger_assignment.
async fn step_until_done(clock: &MockClock) {
let mut relevant_ticks = Vec::new();
loop {
@@ -3837,7 +3837,7 @@ fn test_approval_is_sent_on_max_approval_coalesce_count() {
async fn handle_approval_on_max_coalesce_count(
virtual_overseer: &mut VirtualOverseer,
candidate_indicies: Vec<CandidateIndex>,
candidate_indices: Vec<CandidateIndex>,
) {
assert_matches!(
overseer_recv(virtual_overseer).await,
@@ -3845,16 +3845,16 @@ async fn handle_approval_on_max_coalesce_count(
_,
c_indices,
)) => {
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies.clone()).unwrap(), c_indices);
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices.clone()).unwrap(), c_indices);
}
);
for _ in &candidate_indicies {
for _ in &candidate_indices {
recover_available_data(virtual_overseer).await;
fetch_validation_code(virtual_overseer).await;
}
for _ in &candidate_indicies {
for _ in &candidate_indices {
assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive{exec_kind, response_sender, ..}) if exec_kind == PvfExecKind::Approval => {
@@ -3885,7 +3885,7 @@ async fn handle_approval_on_max_coalesce_count(
assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::ApprovalDistribution(ApprovalDistributionMessage::DistributeApproval(vote)) => {
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies).unwrap(), vote.candidate_indices);
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices).unwrap(), vote.candidate_indices);
}
);
@@ -3895,7 +3895,7 @@ async fn handle_approval_on_max_coalesce_count(
async fn handle_approval_on_max_wait_time(
virtual_overseer: &mut VirtualOverseer,
candidate_indicies: Vec<CandidateIndex>,
candidate_indices: Vec<CandidateIndex>,
clock: Box<MockClock>,
) {
const TICK_NOW_BEGIN: u64 = 1;
@@ -3909,16 +3909,16 @@ async fn handle_approval_on_max_wait_time(
_,
c_indices,
)) => {
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies.clone()).unwrap(), c_indices);
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices.clone()).unwrap(), c_indices);
}
);
for _ in &candidate_indicies {
for _ in &candidate_indices {
recover_available_data(virtual_overseer).await;
fetch_validation_code(virtual_overseer).await;
}
for _ in &candidate_indicies {
for _ in &candidate_indices {
assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::CandidateValidation(CandidateValidationMessage::ValidateFromExhaustive{exec_kind, response_sender, ..}) if exec_kind == PvfExecKind::Approval => {
@@ -3978,7 +3978,7 @@ async fn handle_approval_on_max_wait_time(
assert_matches!(
overseer_recv(virtual_overseer).await,
AllMessages::ApprovalDistribution(ApprovalDistributionMessage::DistributeApproval(vote)) => {
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indicies).unwrap(), vote.candidate_indices);
assert_eq!(TryInto::<CandidateBitfield>::try_into(candidate_indices).unwrap(), vote.candidate_indices);
}
);
@@ -4319,7 +4319,7 @@ fn subsystem_relaunches_approval_work_on_restart() {
virtual_overseer
});
// Restart a new approval voting subsystem with the same database and major syncing true untill
// Restart a new approval voting subsystem with the same database and major syncing true until
// the last leaf.
let config = HarnessConfigBuilder::default().backend(store_clone).major_syncing(true).build();
@@ -126,13 +126,13 @@ impl DelayedApprovalTimer {
/// no additional timer is started.
pub(crate) fn maybe_arm_timer(
&mut self,
wait_untill: Tick,
wait_until: Tick,
clock: &dyn Clock,
block_hash: Hash,
validator_index: ValidatorIndex,
) {
if self.blocks.insert(block_hash) {
let clock_wait = clock.wait(wait_untill);
let clock_wait = clock.wait(wait_until);
self.timers.push(Box::pin(async move {
clock_wait.await;
(block_hash, validator_index)
+1 -1
View File
@@ -1218,7 +1218,7 @@ fn process_message(
// tx channel is dropped and that error is caught by the caller subsystem.
//
// We bubble up the specific error here so `av-store` logs still tell what
// happend.
// happened.
return Err(e.into())
},
}
+1 -1
View File
@@ -292,7 +292,7 @@ struct State {
/// Cache the per-session Validator->Group mapping.
validator_to_group_cache:
LruMap<SessionIndex, Arc<IndexedVec<ValidatorIndex, Option<GroupIndex>>>>,
/// A cloneable sender which is dispatched to background candidate validation tasks to inform
/// A clonable sender which is dispatched to background candidate validation tasks to inform
/// the main task of the result.
background_validation_tx: mpsc::Sender<(Hash, ValidatedCandidateCommand)>,
/// The handle to the keystore used for signing.
@@ -617,7 +617,7 @@ async fn validate_candidate_exhaustive(
Err(e) => {
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (validation code)");
// Code already passed pre-checking, if decompression fails now this most likley means
// Code already passed pre-checking, if decompression fails now this most likely means
// some local corruption happened.
return Err(ValidationFailed("Code decompression failed".to_string()))
},
@@ -51,7 +51,7 @@ type Timestamp = u64;
// If a block isn't approved in 120 seconds, nodes will abandon it
// and begin building on another chain.
const STAGNANT_TIMEOUT: Timestamp = 120;
// Delay prunning of the stagnant keys in prune only mode by 25 hours to avoid interception with the
// Delay pruning of the stagnant keys in prune only mode by 25 hours to avoid interception with the
// finality
const STAGNANT_PRUNE_DELAY: Timestamp = 25 * 60 * 60;
// Maximum number of stagnant entries cleaned during one `STAGNANT_TIMEOUT` iteration
@@ -237,7 +237,7 @@ impl Clock for SystemClock {
//
// The exact time that a block becomes stagnant in the local node is always expected
// to differ from other nodes due to network asynchrony and delays in block propagation.
// Non-monotonicity exarcerbates that somewhat, but not meaningfully.
// Non-monotonicity exacerbates that somewhat, but not meaningfully.
match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(d) => d.as_secs(),
@@ -406,7 +406,7 @@ async fn import_chains_into_empty(
// some pre-blocks may need to be supplied to answer ancestry requests
// that gather batches beyond the beginning of the new chain.
// pre-blocks are those already known by the subsystem, however,
// the subsystem has no way of knowin that until requesting ancestry.
// the subsystem has no way of knowing that until requesting ancestry.
async fn import_all_blocks_into(
virtual_overseer: &mut VirtualOverseer,
backend: &TestBackend,
@@ -1300,7 +1300,7 @@ fn finalize_erases_unviable_from_one_but_not_all_reverts() {
// F <- A1 <- A2 <- A3
//
// A3 reverts A2 and A1.
// Finalize A1. A2 is stil unviable.
// Finalize A1. A2 is still unviable.
let (a3_hash, chain_a) =
construct_chain_on_base(vec![1, 2, 3], finalized_number, finalized_hash, |h| {
@@ -341,7 +341,7 @@ pub(crate) fn note_earliest_session(
let lower_bound = (new_earliest_session, CandidateHash(Hash::repeat_byte(0x00)));
let new_recent_disputes = recent_disputes.split_off(&lower_bound);
// Any remanining disputes are considered ancient and must be pruned.
// Any remaining disputes are considered ancient and must be pruned.
let pruned_disputes = recent_disputes;
if pruned_disputes.len() != 0 {
@@ -462,7 +462,7 @@ async fn wait_for_first_leaf<Context>(ctx: &mut Context) -> Result<Option<Activa
}
}
/// Check wheter a dispute for the given candidate could be spam.
/// Check whether a dispute for the given candidate could be spam.
///
/// That is the candidate could be made up.
pub fn is_potential_spam(
@@ -39,7 +39,7 @@ impl RefCountedCandidates {
// If a `CandidateHash` with reference count equals to 1 is about to be removed - the
// candidate is dropped from the container too.
// If a `CandidateHash` with reference count biger than 1 is about to be removed - the
// If a `CandidateHash` with reference count bigger than 1 is about to be removed - the
// reference count is decreased and the candidate remains in the container.
pub fn remove(&mut self, candidate: &CandidateHash) {
match self.candidates.get_mut(candidate) {
@@ -121,7 +121,7 @@ impl Inclusions {
Entry::Vacant(_) => {
// Rare case where same candidate was present on multiple heights, but all are
// pruned at the same time. This candidate was already pruned in the previous
// occurence so it is skipped now.
// occurrence so it is skipped now.
},
Entry::Occupied(mut e) => {
let mut blocks_including = std::mem::take(e.get_mut());
@@ -542,8 +542,8 @@ fn scraper_handles_backed_but_not_included_candidate() {
}
#[test]
fn scraper_handles_the_same_candidate_incuded_in_two_different_block_heights() {
// Same candidate will be inclued in these two leaves
fn scraper_handles_the_same_candidate_included_in_two_different_block_heights() {
// Same candidate will be included in these two leaves
let test_targets = vec![2, 3];
// How many blocks should we skip before sending a leaf update.

Some files were not shown because too many files have changed in this diff Show More