pallet_conventions.md
-
Hugo Trentesaux authored
* delete notes.txt file * update notes with links to issues * update comment according to #159 * doc idtystatus in readme * update weightinfo and benchmarks accordingly * add benchmark * remove remove_identity_consumers * remove force_remove_identity call * fix todo in test * update doc - remove request_membership - remove validate_identity * fix tests according to new MembershipRemovalReason * add membership removal reasons and clean up membership internal functions * remove check_remove_identity * build live tests (but no current network to check them against) * clippy
* add wot tests related to issue #136 * refac certification creation checks * refac identity creation checks * test benchmark ok * more precise error messages * check benchmarks ok * cargo cucumber ok * cargo test workspace ok * cargo test workspace quasi ok * cargo check all tests * cargo check all * remove IdtyEvent change owner key * remove removal other reason * refac revocation and removal reason * wip * refac * refac scheduling (tests ok) * add *Period * cargo test identity ok * remove IdtyEvent::Validated * cargo test wot ok * cargo test wot ok (one fails but fot the good reason) * cargo test membership ok * cargo check wot tests * cargo check identity tests * cargo check membership tests * also remove validate trait * remove validate_identity * refac identity status to allow more fine-grain control * remove unused trait * cargo check ok * remove indentity confirmation constraints * remove request from membership primitives * remove request_membership from lib.rsHugo Trentesaux authored* delete notes.txt file * update notes with links to issues * update comment according to #159 * doc idtystatus in readme * update weightinfo and benchmarks accordingly * add benchmark * remove remove_identity_consumers * remove force_remove_identity call * fix todo in test * update doc - remove request_membership - remove validate_identity * fix tests according to new MembershipRemovalReason * add membership removal reasons and clean up membership internal functions * remove check_remove_identity * build live tests (but no current network to check them against) * clippy
* add wot tests related to issue #136 * refac certification creation checks * refac identity creation checks * test benchmark ok * more precise error messages * check benchmarks ok * cargo cucumber ok * cargo test workspace ok * cargo test workspace quasi ok * cargo check all tests * cargo check all * remove IdtyEvent change owner key * remove removal other reason * refac revocation and removal reason * wip * refac * refac scheduling (tests ok) * add *Period * cargo test identity ok * remove IdtyEvent::Validated * cargo test wot ok * cargo test wot ok (one fails but fot the good reason) * cargo test membership ok * cargo check wot tests * cargo check identity tests * cargo check membership tests * also remove validate trait * remove validate_identity * refac identity status to allow more fine-grain control * remove unused trait * cargo check ok * remove indentity confirmation constraints * remove request from membership primitives * remove request_membership from lib.rs
Runtime calls
Calls are categorized according to the dispatch origin they require:
- User calls: the dispatch origin for this kind of call must be signed by the transactor. This is the only call category that can be submitted with an extrinsic.
- Root calls: This kind of call requires a special origin that can only be invoked through on-chain governance mechanisms.
- Inherent calls: This kind of call is invoked by the author of the block itself (usually automatically by the node).
- Disabled calls: These calls can not be called directly, they are reserved for internal use by other runtime calls.
We only document user calls below.
There are 65 user calls from 17 pallets.
Account - 1
unlink_identity - 0
unlink_identity()
Taking 0.0106 % of a block.
Unlink the identity associated with the account.
Balances - 6
transfer_allow_death - 0
transfer_allow_death(dest, value)
Taking 0.0186 % of a block.
dest: AccountIdLookupOf<T>
value: T::Balance
Transfer some liquid free balance to another account.
transfer_allow_death
will set the FreeBalance
of the sender and receiver.
If the sender's account is below the existential deposit as a result
of the transfer, the account will be reaped.
The dispatch origin for this call must be Signed
by the transactor.
transfer_keep_alive - 3
transfer_keep_alive(dest, value)
Taking 0.0119 % of a block.
dest: AccountIdLookupOf<T>
value: T::Balance
Same as the transfer_allow_death
call, but with a check that the transfer will not
kill the origin account.
99% of the time you want transfer_allow_death
instead.
transfer_all - 4
transfer_all(dest, keep_alive)
Taking 0.0122 % of a block.
dest: AccountIdLookupOf<T>
keep_alive: bool
Transfer the entire transferable balance from the caller account.
NOTE: This function only attempts to transfer transferable balances. This means that
any locked, reserved, or existential deposits (when keep_alive
is true
), will not be
transferred by this function. To ensure that this function results in a killed account,
you might need to prepare the account by removing any reference counters, storage
deposits, etc...
The dispatch origin of this call must be Signed.
-
dest
: The recipient of the transfer. -
keep_alive
: A boolean to determine if thetransfer_all
operation should send all of the funds the account has, causing the sender account to be killed (false), or transfer everything except at least the existential deposit, which will guarantee to keep the sender account alive (true).
OneshotAccount - 7
create_oneshot_account - 0
create_oneshot_account(dest, value)
Taking 0.0115 % of a block.
dest: <T::Lookup as StaticLookup>::Source
value: BalanceOf<T>
Create an account that can only be consumed once
-
dest
: The oneshot account to be created. -
balance
: The balance to be transfered to this oneshot account.
Origin account is kept alive.
consume_oneshot_account - 1
consume_oneshot_account(block_height, dest)
Taking 0.0182 % of a block.
block_height: BlockNumberFor<T>
dest: Account<<T::Lookup as StaticLookup>::Source>
Consume a oneshot account and transfer its balance to an account
-
block_height
: Must be a recent block number. The limit isBlockHashCount
in the past. (this is to prevent replay attacks) -
dest
: The destination account. -
dest_is_oneshot
: If set totrue
, then a oneshot account is created atdest
. Else,dest
has to be an existing account.
consume_oneshot_account_with_remaining - 2
consume_oneshot_account_with_remaining(block_height, dest, remaining_to, balance)
Taking 0.0246 % of a block.
block_height: BlockNumberFor<T>
dest: Account<<T::Lookup as StaticLookup>::Source>
remaining_to: Account<<T::Lookup as StaticLookup>::Source>
balance: BalanceOf<T>
Consume a oneshot account then transfer some amount to an account, and the remaining amount to another account.
-
block_height
: Must be a recent block number. The limit isBlockHashCount
in the past. (this is to prevent replay attacks) -
dest
: The destination account. -
dest_is_oneshot
: If set totrue
, then a oneshot account is created atdest
. Else,dest
has to be an existing account. -
dest2
: The second destination account. -
dest2_is_oneshot
: If set totrue
, then a oneshot account is created atdest2
. Else,dest2
has to be an existing account. -
balance1
: The amount transfered todest
, the leftover being transfered todest2
.
SmithMembers - 10
invite_smith - 0
invite_smith(receiver)
Taking 0.0214 % of a block.
receiver: T::IdtyIndex
Invite a member of the Web of Trust to attempt becoming a Smith.
accept_invitation - 1
accept_invitation()
Taking 0.0119 % of a block.
Accept an invitation to become a Smith (must have been invited first).
certify_smith - 2
certify_smith(receiver)
Taking 0.0255 % of a block.
receiver: T::IdtyIndex
Certify an invited Smith, which can lead the certified to become a Smith.
AuthorityMembers - 11
go_offline - 0
go_offline()
Taking 0.0152 % of a block.
Request to leave the set of validators two sessions later.
go_online - 1
go_online()
Taking 0.0172 % of a block.
Request to join the set of validators two sessions later.
set_session_keys - 2
set_session_keys(keys)
Taking 0.0225 % of a block.
keys: T::Keys
Declare new session keys to replace current ones.
Preimage - 22
note_preimage - 0
note_preimage(bytes)
Taking 0.2846 % of a block.
bytes: Vec<u8>
Register a preimage on-chain.
If the preimage was previously requested, no fees or deposits are taken for providing the preimage. Otherwise, a deposit is taken proportional to the size of the preimage.
unnote_preimage - 1
unnote_preimage(hash)
Taking 0.0171 % of a block.
hash: T::Hash
Clear an unrequested preimage from the runtime storage.
If len
is provided, then it will be a much cheaper operation.
-
hash
: The hash of the preimage to be removed from the store. -
len
: The length of the preimage ofhash
.
request_preimage - 2
request_preimage(hash)
Taking 0.0121 % of a block.
hash: T::Hash
Request a preimage be uploaded to the chain without paying any fees or deposits.
If the preimage requests has already been provided on-chain, we unreserve any deposit a user may have paid, and take the control of the preimage out of their hands.
unrequest_preimage - 3
unrequest_preimage(hash)
Taking 0.0171 % of a block.
hash: T::Hash
Clear a previously made request for a preimage.
NOTE: THIS MUST NOT BE CALLED ON hash
MORE TIMES THAN request_preimage
.
ensure_updated - 4
ensure_updated(hashes)
Taking 17.5344 % of a block.
hashes: Vec<T::Hash>
Ensure that the a bulk of pre-images is upgraded.