Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Pre-generate runtime API clients to use on light nodes #3875

@svyatonik

Description

@svyatonik

We may want to (remotely) call some runtime methods from the light nodes. Currently, the call must be manually encoded like in this example:

fetcher.remote_call(RemoteCallRequest {
	block: best_hash,
	header: best_header,
	method: "AccountNonceApi_account_nonce".into(),
	call_data: account.encode(),
	retry_count: None,
})

I'm suggesting to extend decl_runtime_apis! macro (or add some additional macro) that will generate structure to be used on light nodes for calling some (we do not need it for everything) runtime methods. It could be something like that for declaring (mind the : Light):

decl_runtime_apis! {
	pub trait TaggedTransactionQueue: Light {
		fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity;
	}
}

The example usage of generated client:

LightTaggedTransactionQueue::at_header(fetcher, hash, header)
	.validate_transaction(transaction)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions