Skip to content

Commit a7f49b6

Browse files
committed
Set call index explicitly
1 parent 09909d1 commit a7f49b6

File tree

10 files changed

+47
-0
lines changed

10 files changed

+47
-0
lines changed

crates/pallet-domains/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ mod pallet {
184184
#[pallet::call]
185185
impl<T: Config> Pallet<T> {
186186
// TODO: proper weight
187+
#[pallet::call_index(0)]
187188
#[pallet::weight((10_000, Pays::No))]
188189
pub fn submit_bundle(
189190
origin: OriginFor<T>,
@@ -238,6 +239,7 @@ mod pallet {
238239
}
239240

240241
// TODO: proper weight
242+
#[pallet::call_index(1)]
241243
#[pallet::weight((10_000, Pays::No))]
242244
pub fn submit_fraud_proof(origin: OriginFor<T>, fraud_proof: FraudProof) -> DispatchResult {
243245
ensure_none(origin)?;
@@ -268,6 +270,7 @@ mod pallet {
268270
}
269271

270272
// TODO: proper weight
273+
#[pallet::call_index(2)]
271274
#[pallet::weight((10_000, Pays::No))]
272275
pub fn submit_bundle_equivocation_proof(
273276
origin: OriginFor<T>,
@@ -285,6 +288,7 @@ mod pallet {
285288
}
286289

287290
// TODO: proper weight
291+
#[pallet::call_index(3)]
288292
#[pallet::weight((10_000, Pays::No))]
289293
pub fn submit_invalid_transaction_proof(
290294
origin: OriginFor<T>,

crates/pallet-feeds/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ mod pallet {
198198
impl<T: Config> Pallet<T> {
199199
// TODO: add proper weights
200200
/// Create a new feed
201+
#[pallet::call_index(0)]
201202
#[pallet::weight((10_000, Pays::No))]
202203
pub fn create(
203204
origin: OriginFor<T>,
@@ -238,6 +239,7 @@ mod pallet {
238239
}
239240

240241
/// Updates the feed with init data provided.
242+
#[pallet::call_index(1)]
241243
#[pallet::weight((10_000, Pays::No))]
242244
pub fn update(
243245
origin: OriginFor<T>,
@@ -271,6 +273,7 @@ mod pallet {
271273
// TODO: add proper weights
272274
// TODO: For now we don't have fees, but we will have them in the future
273275
/// Put a new object into a feed
276+
#[pallet::call_index(2)]
274277
#[pallet::weight((10_000, Pays::No))]
275278
pub fn put(origin: OriginFor<T>, feed_id: T::FeedId, object: Object) -> DispatchResult {
276279
let (owner, feed_config) = ensure_owner!(origin, feed_id);
@@ -306,6 +309,7 @@ mod pallet {
306309
}
307310

308311
/// Closes the feed and stops accepting new feed.
312+
#[pallet::call_index(3)]
309313
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), Pays::No))]
310314
pub fn close(origin: OriginFor<T>, feed_id: T::FeedId) -> DispatchResult {
311315
let (owner, mut feed_config) = ensure_owner!(origin, feed_id);
@@ -319,6 +323,7 @@ mod pallet {
319323
}
320324

321325
/// Transfers feed from current owner to new owner
326+
#[pallet::call_index(4)]
322327
#[pallet::weight((T::DbWeight::get().reads_writes(3, 3), Pays::No))]
323328
pub fn transfer(
324329
origin: OriginFor<T>,

crates/pallet-object-store/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mod pallet {
6363
// TODO: add proper weights
6464
// TODO: For now we don't have fees, but we will have them in the future
6565
/// Put a new object into a feed
66+
#[pallet::call_index(0)]
6667
#[pallet::weight((10_000, Pays::No))]
6768
pub fn put(origin: OriginFor<T>, object: Vec<u8>) -> DispatchResult {
6869
let who = ensure_signed(origin)?;

crates/pallet-subspace/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ mod pallet {
466466
/// This extrinsic must be called unsigned and it is expected that only block authors will
467467
/// call it (validated in `ValidateUnsigned`), as such if the block author is defined it
468468
/// will be defined as the equivocation reporter.
469+
#[pallet::call_index(0)]
469470
#[pallet::weight((<T as Config>::WeightInfo::report_equivocation(), DispatchClass::Operational))]
470471
// Suppression because the custom syntax will also generate an enum and we need enum to have
471472
// boxed value.
@@ -481,6 +482,7 @@ mod pallet {
481482

482483
/// Submit new root block to the blockchain. This is an inherent extrinsic and part of the
483484
/// Subspace consensus logic.
485+
#[pallet::call_index(1)]
484486
#[pallet::weight((<T as Config>::WeightInfo::store_root_blocks(root_blocks.len()), DispatchClass::Mandatory, Pays::No))]
485487
pub fn store_root_blocks(
486488
origin: OriginFor<T>,
@@ -492,6 +494,7 @@ mod pallet {
492494

493495
/// Enable solution range adjustment after every era.
494496
/// Note: No effect on the solution range for the current era
497+
#[pallet::call_index(2)]
495498
#[pallet::weight(T::DbWeight::get().writes(1))]
496499
pub fn enable_solution_range_adjustment(
497500
origin: OriginFor<T>,
@@ -514,6 +517,7 @@ mod pallet {
514517

515518
/// Farmer vote, currently only used for extra rewards to farmers.
516519
// TODO: Proper weight
520+
#[pallet::call_index(3)]
517521
#[pallet::weight((<T as Config>::WeightInfo::vote(), DispatchClass::Operational, Pays::No))]
518522
// Suppression because the custom syntax will also generate an enum and we need enum to have
519523
// boxed value.
@@ -528,6 +532,7 @@ mod pallet {
528532
}
529533

530534
/// Enable rewards for blocks and votes at specified block height.
535+
#[pallet::call_index(4)]
531536
#[pallet::weight(T::DbWeight::get().writes(1))]
532537
pub fn enable_rewards(
533538
origin: OriginFor<T>,
@@ -539,6 +544,7 @@ mod pallet {
539544
}
540545

541546
/// Enable storage access for all users.
547+
#[pallet::call_index(5)]
542548
#[pallet::weight(T::DbWeight::get().writes(1))]
543549
pub fn enable_storage_access(origin: OriginFor<T>) -> DispatchResult {
544550
ensure_root(origin)?;
@@ -549,6 +555,7 @@ mod pallet {
549555
}
550556

551557
/// Enable storage access for all users.
558+
#[pallet::call_index(6)]
552559
#[pallet::weight(T::DbWeight::get().writes(1))]
553560
pub fn enable_authoring_by_anyone(origin: OriginFor<T>) -> DispatchResult {
554561
ensure_root(origin)?;

domains/pallets/domain-registry/src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ mod pallet {
253253
impl<T: Config> Pallet<T> {
254254
/// Creates a new domain with some deposit locked.
255255
// TODO: proper weight
256+
#[pallet::call_index(0)]
256257
#[pallet::weight(10_000)]
257258
pub fn create_domain(
258259
origin: OriginFor<T>,
@@ -278,6 +279,7 @@ mod pallet {
278279
// TODO: support destroy_domain in the future.
279280

280281
// TODO: proper weight
282+
#[pallet::call_index(1)]
281283
#[pallet::weight(10_000)]
282284
pub fn update_domain_config(
283285
origin: OriginFor<T>,
@@ -300,6 +302,7 @@ mod pallet {
300302

301303
/// Register a new domain operator.
302304
// TODO: proper weight
305+
#[pallet::call_index(2)]
303306
#[pallet::weight(10_000)]
304307
pub fn register_domain_operator(
305308
origin: OriginFor<T>,
@@ -319,6 +322,7 @@ mod pallet {
319322

320323
/// Update the domain stake.
321324
// TODO: proper weight
325+
#[pallet::call_index(3)]
322326
#[pallet::weight(10_000)]
323327
pub fn update_domain_stake(
324328
origin: OriginFor<T>,
@@ -338,6 +342,7 @@ mod pallet {
338342

339343
/// Deregister a domain operator.
340344
// TODO: proper weight
345+
#[pallet::call_index(4)]
341346
#[pallet::weight(10_000)]
342347
pub fn deregister_domain_operator(
343348
origin: OriginFor<T>,
@@ -367,6 +372,7 @@ mod pallet {
367372
}
368373

369374
// TODO: proper weight
375+
#[pallet::call_index(5)]
370376
#[pallet::weight((10_000, Pays::No))]
371377
pub fn submit_core_bundle(
372378
origin: OriginFor<T>,
@@ -403,6 +409,7 @@ mod pallet {
403409
}
404410

405411
// TODO: proper weight
412+
#[pallet::call_index(6)]
406413
#[pallet::weight((10_000, Pays::No))]
407414
pub fn submit_fraud_proof(
408415
origin: OriginFor<T>,
@@ -418,6 +425,7 @@ mod pallet {
418425
}
419426

420427
// TODO: proper weight
428+
#[pallet::call_index(7)]
421429
#[pallet::weight((10_000, Pays::No))]
422430
pub fn submit_bundle_equivocation_proof(
423431
origin: OriginFor<T>,
@@ -433,6 +441,7 @@ mod pallet {
433441
}
434442

435443
// TODO: proper weight
444+
#[pallet::call_index(8)]
436445
#[pallet::weight((10_000, Pays::No))]
437446
pub fn submit_invalid_transaction_proof(
438447
origin: OriginFor<T>,

domains/pallets/executive/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ mod pallet {
7373
// TODO: this call may be moved to other places if this pallet is no longer necessary.
7474
/// Unsigned version of `frame_sudo::sudo_unchecked_weight`.
7575
#[allow(clippy::boxed_local)]
76+
#[pallet::call_index(0)]
7677
#[pallet::weight((*_weight, call.get_dispatch_info().class, Pays::No))]
7778
pub fn sudo_unchecked_weight_unsigned(
7879
origin: OriginFor<T>,

domains/pallets/executor-registry/src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ mod pallet {
159159
impl<T: Config> Pallet<T> {
160160
/// Register the origin account as an executor.
161161
// TODO: proper weight
162+
#[pallet::call_index(0)]
162163
#[pallet::weight(10_000)]
163164
pub fn register(
164165
origin: OriginFor<T>,
@@ -207,6 +208,7 @@ mod pallet {
207208

208209
/// Declare no desire to be an executor and remove the registration.
209210
// TODO: proper weight
211+
#[pallet::call_index(1)]
210212
#[pallet::weight(10_000)]
211213
pub fn deregister(origin: OriginFor<T>) -> DispatchResult {
212214
let _who = ensure_signed(origin)?;
@@ -223,6 +225,7 @@ mod pallet {
223225

224226
/// Increase the executor's stake by locking some more balance.
225227
// TODO: proper weight
228+
#[pallet::call_index(2)]
226229
#[pallet::weight(10_000)]
227230
pub fn increase_stake(origin: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {
228231
let who = ensure_signed(origin)?;
@@ -271,6 +274,7 @@ mod pallet {
271274
/// The reduced stake will be held locked for a while until it
272275
/// can be withdrawn to be transferrable.
273276
// TODO: proper weight
277+
#[pallet::call_index(3)]
274278
#[pallet::weight(10_000)]
275279
pub fn decrease_stake(origin: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {
276280
let who = ensure_signed(origin)?;
@@ -325,6 +329,7 @@ mod pallet {
325329
///
326330
/// The balance being locked will become free on success.
327331
// TODO: proper weight
332+
#[pallet::call_index(4)]
328333
#[pallet::weight(10_000)]
329334
pub fn withdraw_decreased_stake(
330335
origin: OriginFor<T>,
@@ -374,6 +379,7 @@ mod pallet {
374379

375380
/// Stop participating in the bundle election temporarily.
376381
// TODO: proper weight
382+
#[pallet::call_index(5)]
377383
#[pallet::weight(10_000)]
378384
pub fn pause_execution(origin: OriginFor<T>) -> DispatchResult {
379385
let who = ensure_signed(origin)?;
@@ -409,6 +415,7 @@ mod pallet {
409415

410416
/// Participate in the bundle election again.
411417
// TODO: proper weight
418+
#[pallet::call_index(6)]
412419
#[pallet::weight(10_000)]
413420
pub fn resume_execution(origin: OriginFor<T>) -> DispatchResult {
414421
let who = ensure_signed(origin)?;
@@ -439,6 +446,7 @@ mod pallet {
439446
///
440447
/// It won't take effect until next epoch.
441448
// TODO: proper weight
449+
#[pallet::call_index(7)]
442450
#[pallet::weight(10_000)]
443451
pub fn update_public_key(
444452
origin: OriginFor<T>,
@@ -463,6 +471,7 @@ mod pallet {
463471

464472
/// Set a new reward address.
465473
// TODO: proper weight
474+
#[pallet::call_index(8)]
466475
#[pallet::weight(10_000)]
467476
pub fn update_reward_address(origin: OriginFor<T>, new: T::AccountId) -> DispatchResult {
468477
let who = ensure_signed(origin)?;

domains/pallets/messenger/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ mod pallet {
459459
/// Next Channel ID is used to assign the new channel.
460460
/// Channel is set to initiated and do not accept or receive any messages.
461461
/// Only a root user can create the channel.
462+
#[pallet::call_index(0)]
462463
#[pallet::weight((10_000, Pays::No))]
463464
pub fn initiate_channel(
464465
origin: OriginFor<T>,
@@ -487,6 +488,7 @@ mod pallet {
487488
/// An open channel is closed with a foreign domain.
488489
/// Channel is set to Closed and do not accept or receive any messages.
489490
/// Only a root user can close an open channel.
491+
#[pallet::call_index(1)]
490492
#[pallet::weight((10_000, Pays::No))]
491493
pub fn close_channel(
492494
origin: OriginFor<T>,
@@ -508,6 +510,7 @@ mod pallet {
508510
}
509511

510512
/// Receives an Inbox message that needs to be validated and processed.
513+
#[pallet::call_index(2)]
511514
#[pallet::weight((10_000, Pays::No))]
512515
pub fn relay_message(
513516
origin: OriginFor<T>,
@@ -519,6 +522,7 @@ mod pallet {
519522
}
520523

521524
/// Receives a response from the dst_domain for a message in Outbox.
525+
#[pallet::call_index(3)]
522526
#[pallet::weight((10_000, Pays::No))]
523527
pub fn relay_message_response(
524528
origin: OriginFor<T>,
@@ -530,6 +534,7 @@ mod pallet {
530534
}
531535

532536
/// Declare the desire to become a relayer for this domain by reserving the relayer deposit.
537+
#[pallet::call_index(4)]
533538
#[pallet::weight((10_000, Pays::No))]
534539
pub fn join_relayer_set(origin: OriginFor<T>, relayer_id: RelayerId<T>) -> DispatchResult {
535540
let who = ensure_signed(origin)?;
@@ -538,6 +543,7 @@ mod pallet {
538543
}
539544

540545
/// Declare the desire to exit relaying for this domain.
546+
#[pallet::call_index(5)]
541547
#[pallet::weight((10_000, Pays::No))]
542548
pub fn exit_relayer_set(origin: OriginFor<T>, relayer_id: RelayerId<T>) -> DispatchResult {
543549
let who = ensure_signed(origin)?;

domains/pallets/transporter/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ mod pallet {
167167
impl<T: Config> Pallet<T> {
168168
/// Initiates transfer of funds from account on src_domain to account on dst_domain.
169169
/// Funds are burned on src_domain first and are minted on dst_domain using Messenger.
170+
#[pallet::call_index(0)]
170171
#[pallet::weight((10_000, Pays::No))]
171172
pub fn transfer(
172173
origin: OriginFor<T>,

orml/vesting/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ pub mod module {
244244

245245
#[pallet::call]
246246
impl<T: Config> Pallet<T> {
247+
#[pallet::call_index(0)]
247248
#[pallet::weight(T::WeightInfo::claim(<T as Config>::MaxVestingSchedules::get() / 2))]
248249
pub fn claim(origin: OriginFor<T>) -> DispatchResult {
249250
let who = ensure_signed(origin)?;
@@ -256,6 +257,7 @@ pub mod module {
256257
Ok(())
257258
}
258259

260+
#[pallet::call_index(1)]
259261
#[pallet::weight(T::WeightInfo::vested_transfer())]
260262
pub fn vested_transfer(
261263
origin: OriginFor<T>,
@@ -274,6 +276,7 @@ pub mod module {
274276
Ok(())
275277
}
276278

279+
#[pallet::call_index(2)]
277280
#[pallet::weight(T::WeightInfo::update_vesting_schedules(vesting_schedules.len() as u32))]
278281
pub fn update_vesting_schedules(
279282
origin: OriginFor<T>,
@@ -289,6 +292,7 @@ pub mod module {
289292
Ok(())
290293
}
291294

295+
#[pallet::call_index(3)]
292296
#[pallet::weight(T::WeightInfo::claim(<T as Config>::MaxVestingSchedules::get() / 2))]
293297
pub fn claim_for(origin: OriginFor<T>, dest: <T::Lookup as StaticLookup>::Source) -> DispatchResult {
294298
let _ = ensure_signed(origin)?;

0 commit comments

Comments
 (0)