pub trait SendToRelayChain {
type AccountId;
type Balance: Parameter + Member + Copy;
// Required methods
fn validator_set(
report: ValidatorSetReport<Self::AccountId>,
) -> Result<(), ()>;
fn set_keys(
stash: Self::AccountId,
keys: Vec<u8>,
max_delivery_and_remote_execution_fee: Option<Self::Balance>,
) -> Result<Self::Balance, SendKeysError<Self::Balance>>;
fn purge_keys(
stash: Self::AccountId,
max_delivery_and_remote_execution_fee: Option<Self::Balance>,
) -> Result<Self::Balance, SendKeysError<Self::Balance>>;
}Expand description
The communication trait of pallet-staking-async-rc-client -> relay-chain.
This trait should only encapsulate our outgoing communication to the RC. Any incoming communication comes it directly via our calls.
In a real runtime, this is implemented via XCM calls, much like how the core-time pallet works. In a test runtime, it can be wired to direct function calls.
Note: This trait intentionally avoids XCM types in its signature to keep the pallet XCM-agnostic. The implementation details (XCM, direct calls, etc.) are left to the runtime.
Required Associated Types§
Required Methods§
Sourcefn validator_set(report: ValidatorSetReport<Self::AccountId>) -> Result<(), ()>
fn validator_set(report: ValidatorSetReport<Self::AccountId>) -> Result<(), ()>
Send a new validator set report to relay chain.
Sourcefn set_keys(
stash: Self::AccountId,
keys: Vec<u8>,
max_delivery_and_remote_execution_fee: Option<Self::Balance>,
) -> Result<Self::Balance, SendKeysError<Self::Balance>>
fn set_keys( stash: Self::AccountId, keys: Vec<u8>, max_delivery_and_remote_execution_fee: Option<Self::Balance>, ) -> Result<Self::Balance, SendKeysError<Self::Balance>>
Send session keys to relay chain for registration.
The keys are forwarded to pallet-staking-async-ah-client::set_keys_from_ah on the RC.
Note: proof is validated on AH side, so only validated keys are sent.
The relay chain uses UnpaidExecution, so no fees are charged there. Instead, the total
fee (delivery + remote execution cost) is charged on AssetHub.
stash: The validator stash account.keys: The encoded session keys.max_delivery_and_remote_execution_fee: Optional maximum total fee the user is willing to pay. This includes both the XCM delivery fee and the remote execution cost. If the actual total fee exceeds this, the operation fails withSendKeysError::FeesExceededMax. PassNonefor unlimited (no cap).
Returns the total fees charged on success (delivery + execution).
Sourcefn purge_keys(
stash: Self::AccountId,
max_delivery_and_remote_execution_fee: Option<Self::Balance>,
) -> Result<Self::Balance, SendKeysError<Self::Balance>>
fn purge_keys( stash: Self::AccountId, max_delivery_and_remote_execution_fee: Option<Self::Balance>, ) -> Result<Self::Balance, SendKeysError<Self::Balance>>
Send a request to purge session keys on the relay chain.
The request is forwarded to pallet-staking-async-ah-client::purge_keys_from_ah on the RC.
The relay chain uses UnpaidExecution, so no fees are charged there. Instead, the total
fee (delivery + remote execution cost) is charged on AssetHub.
stash: The validator stash account.max_delivery_and_remote_execution_fee: Optional maximum total fee the user is willing to pay. This includes both the XCM delivery fee and the remote execution cost. If the actual total fee exceeds this, the operation fails withSendKeysError::FeesExceededMax. PassNonefor unlimited (no cap).
Returns the total fees charged on success (delivery + execution).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl SendToRelayChain for ()
Available on crate feature std only.
impl SendToRelayChain for ()
std only.