Skip to content

Commit

Permalink
Fix call indexes (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Jan 30, 2023
1 parent 4a9ea62 commit be849d0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions pallet/account-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Migrate all the account data under the `from` to `to`.
#[pallet::call_index(0)]
#[pallet::weight(0)]
pub fn migrate(
origin: OriginFor<T>,
Expand Down
3 changes: 3 additions & 0 deletions pallet/deposit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Lock the RING for some KTON profit/interest.
#[pallet::call_index(0)]
#[pallet::weight(0)]
pub fn lock(origin: OriginFor<T>, amount: Balance, months: u8) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down Expand Up @@ -246,6 +247,7 @@ pub mod pallet {
}

/// Claim the expired-locked RING.
#[pallet::call_index(1)]
#[pallet::weight(0)]
pub fn claim(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down Expand Up @@ -284,6 +286,7 @@ pub mod pallet {
}

/// Claim the unexpired-locked RING by paying the KTON penalty.
#[pallet::call_index(2)]
#[pallet::weight(0)]
pub fn claim_with_penalty(origin: OriginFor<T>, id: DepositId) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down
10 changes: 5 additions & 5 deletions pallet/ecdsa-authority/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ pub mod pallet {
///
/// Not allow to call while authorities is changing.
/// This will insert new authority into the index 0 of authorities.
#[pallet::call_index(0)]
#[pallet::weight(10_000_000)]
#[frame_support::transactional]
pub fn add_authority(origin: OriginFor<T>, new: T::AccountId) -> DispatchResult {
ensure_root(origin)?;

Expand All @@ -250,8 +250,8 @@ pub mod pallet {
/// Remove a authority and trigger `on_authorities_change`.
///
/// Not allow to call while authorities is changing.
#[pallet::call_index(1)]
#[pallet::weight(10_000_000)]
#[frame_support::transactional]
pub fn remove_authority(origin: OriginFor<T>, old: T::AccountId) -> DispatchResult {
ensure_root(origin)?;

Expand Down Expand Up @@ -281,8 +281,8 @@ pub mod pallet {
/// Swap the old authority with the new authority and trigger `on_authorities_change`.
///
/// Not allow to call while authorities is changing.
#[pallet::call_index(2)]
#[pallet::weight(10_000_000)]
#[frame_support::transactional]
pub fn swap_authority(
origin: OriginFor<T>,
old: T::AccountId,
Expand Down Expand Up @@ -315,8 +315,8 @@ pub mod pallet {
/// Submit the authorities change signature.
///
/// Free to submit the first-correct signature.
#[pallet::call_index(3)]
#[pallet::weight(10_000_000)]
#[frame_support::transactional]
pub fn submit_authorities_change_signature(
origin: OriginFor<T>,
signature: Signature,
Expand Down Expand Up @@ -364,8 +364,8 @@ pub mod pallet {
/// Submit the new message root signature.
///
/// Free to submit the first-correct signature.
#[pallet::call_index(4)]
#[pallet::weight(10_000_000)]
#[frame_support::transactional]
pub fn submit_new_message_root_signature(
origin: OriginFor<T>,
signature: Signature,
Expand Down
1 change: 1 addition & 0 deletions pallet/message-transact/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pub mod pallet {
{
/// This call can only be called by the lcmp message layer and is not available to normal
/// users.
#[pallet::call_index(0)]
#[pallet::weight({
let without_base_extrinsic_weight = true;
<T as pallet_evm::Config>::GasWeightMapping::gas_to_weight({
Expand Down
7 changes: 7 additions & 0 deletions pallet/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ pub mod pallet {
/// Add stakes to the staking pool.
///
/// This will transfer the stakes to a pallet/contact account.
#[pallet::call_index(0)]
#[pallet::weight(0)]
pub fn stake(
origin: OriginFor<T>,
Expand Down Expand Up @@ -409,6 +410,7 @@ pub mod pallet {
}

/// Withdraw stakes from the staking pool.
#[pallet::call_index(1)]
#[pallet::weight(0)]
pub fn unstake(
origin: OriginFor<T>,
Expand Down Expand Up @@ -455,6 +457,7 @@ pub mod pallet {
/// Cancel the `unstake` operation.
///
/// Re-stake the unstaking assets immediately.
#[pallet::call_index(2)]
#[pallet::weight(0)]
pub fn restake(
origin: OriginFor<T>,
Expand Down Expand Up @@ -499,6 +502,7 @@ pub mod pallet {
}

/// Claim the stakes from the pallet/contract account.
#[pallet::call_index(3)]
#[pallet::weight(0)]
pub fn claim(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -515,6 +519,7 @@ pub mod pallet {
/// Declare the desire to collect.
///
/// Effects will be felt at the beginning of the next session.
#[pallet::call_index(4)]
#[pallet::weight(0)]
pub fn collect(origin: OriginFor<T>, commission: Perbill) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -529,6 +534,7 @@ pub mod pallet {
/// Declare the desire to nominate a collator.
///
/// Effects will be felt at the beginning of the next session.
#[pallet::call_index(5)]
#[pallet::weight(0)]
pub fn nominate(origin: OriginFor<T>, target: T::AccountId) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -552,6 +558,7 @@ pub mod pallet {
/// Effects will be felt at the beginning of the next era.
///
/// If the target is a collator, its nominators need to re-nominate.
#[pallet::call_index(6)]
#[pallet::weight(0)]
pub fn chill(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down

0 comments on commit be849d0

Please sign in to comment.