Questions tagged [host-functions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
2 answers
128 views

How to provide host functions and make it callable from pallets?

I'm trying to encapsulate some host functions so that I can call them in pallets. I use sp_runtime_interface::runtime_interface to declare a trait, give the default implementation in the declaration, ...
Brice's user avatar
  • 51
3 votes
1 answer
156 views

How might we introduce a new host function into the Polkadot ecosystem?

Introducing new host functions means that all nodes must update to include it. In the future, some parachain teams may require some custom host functions for their needs. What would the approval ...
Sacha Lansky's user avatar
  • 2,620
3 votes
0 answers
53 views

What is transaction indexing in externalities useful for?

For example, there's a FRAME pallet called Remark which does one thing: it allows storing data in externalities that can access the node's storage via a runtime interface. If integrated into a runtime,...
Sacha Lansky's user avatar
  • 2,620
2 votes
2 answers
87 views

Calling std-based host function from a pallet

Based on: Use std only rust library to extend substrate runtime interface? How to understand [runtime-interface] and `Externalities`? I understand that I should be able to: have a crate that is not ...
pmikolajczyk41's user avatar
2 votes
1 answer
62 views

How can I access a backend instance from a host function?

As given in the title, I would like to get access to an instance of the backend from a host function. When I say 'backend instance' here, I'm referring to this. I hope to call its offchain_storage(), ...
Justin Frevert's user avatar
2 votes
1 answer
41 views

How to register a custom extension for offchain workers?

I have the following code. #[cfg(feature = "std")] use sp_externalities::ExternalitiesExt; #[cfg(feature = "std")] sp_externalities::decl_extension! { pub struct CustomExt(u32)...
Sachin's user avatar
  • 61
2 votes
0 answers
56 views

Why Hosts set storage information directly and not through the Runtime

Why Host set storage information directly and not through the Runtime api? (e.g. Grandpa Authorities, Accounts, Code, Heap_Pages) Is this an expected behavior or legacy?
user2862's user avatar
  • 309
1 vote
1 answer
36 views

Register Host Function: "runtime requires function imports which are not present on the host: env:ext_storage_proof_size_storage_proof_size_version_1"

When upgrading my node to the latest version of the Polkadot-SDK, I get the following error when trying to run the node: Error: Error: Command failed with exit code 1: bash -c ./target/...
Shawn Tabrizi's user avatar
  • 16k
1 vote
1 answer
39 views

Syncing with a chain that requires host functions deprecated by the Substrate

I'm working on upgrading a Substrate-based standalone chain that was launched several years ago. Recently, we made a transition from polkadot-v0.9.34 to polkadot-v0.9.35. After we did that, we are no ...
Yahor Tsaryk's user avatar
1 vote
1 answer
21 views

Is there a way to set a pallet configuration using a function that lives on the outer node?

I am aware that this should break consensus, as one may easily start a node with different params -> end up with a different wasm bytecode, and thus be on a different network. However, inspite of ...
b0zero's user avatar
  • 533
1 vote
0 answers
98 views

runtime requires function imports which are not present on the host: 'env:_critical_section_1_0_acquire', 'env:_critical_section_1_0_release'

I wanted to add a runtime interface, which can be simplified to the following: #[sp_runtime_interface::runtime_interface] pub trait Test { fn some_bytes() -> Vec<u8> { vec![] }...
nazar-pc's user avatar
  • 551
0 votes
0 answers
18 views

What is the usecase of `PassBy` trait bound

While working on types between Runtime and Host functions, types going from Runtime to host function requires a PassBy trait bound while types going from Host function to Runtime does not need that ...
vedhavyas's user avatar
  • 155
0 votes
0 answers
15 views

`sp_io::crypto::ed25519_batch_verify` was removed amid Polkadot 0.9.39 and 0.9.43. What is replacement in Runtime?

We useded25519_batch_verify in runtime from sp_io::crypto mod. sp_io::Crypto and Verify traits require self, but I cannot find implementation. In substrate primitives core I see verify calling fn ...
Dzmitry Lahoda's user avatar
0 votes
0 answers
24 views

Can a Substrate Runtime bulk-read many storage keys at once?

This question is about the Substrate host functions and storage implementation and is not specific to FRAME (although relevant FRAME-related information is welcome). Imagine that the runtime knows it ...
JoshOrndorff's user avatar
  • 1,181