With the introduction of pallet-revive, smart contracts have become first-class citizens within the Polkadot ecosystem. One of the most interesting aspects of Revive is its ability to expose native runtime functionality directly to Solidity contracts through precompiles (and/or host functions).
Today, Asset Hub already exposes several categories of precompiles, including:
- Assets-related functionality
- XCM-related functionality
- Storage access
- Ethereum-compatible precompiles
- System and cryptographic functionality, among others
In addition, there have been discussions around introducing further runtime-backed capabilities through new precompiles, such as staking-related functionality and additional cryptographic operations.
While exploring the current landscape, I noticed that discussions around precompiles tend to happen independently and are often tied to specific use cases. This made me wonder whether there is a broader picture that could benefit from ecosystem-wide discussion.
Some questions I would like to gather feedback on:
Current State
- What is the intended long-term strategy for precompiles within Revive? There is talk about Host functions, should they be used to implement advanced runtime computations
- Should precompiles generally live alongside the pallets they expose (e.g. XCM within
pallet-xcm, Assets withinpallet-assets)? - Are there existing guidelines for implementing new runtime-backed precompiles?
Documentation and Discoverability
The current documentation provides a useful overview of existing precompiles, but as more runtime capabilities become available, discoverability may become increasingly important.
Would it make sense to establish a canonical location documenting:
- Available precompiles
- Addresses
- Input/output formats
- SCALE encoding requirements
- Weight calculation methodology
- Version compatibility considerations
Future Direction
As Revive adoption grows, it seems likely that more pallets will expose functionality through precompiles.
Is there interest in defining a more standardized approach to:
- Precompile implementation patterns
- Address allocation
- Documentation requirements
- Testing and benchmarking expectations
My goal with this post is primarily to understand the current thinking around precompiles and gather context from runtime engineers and ecosystem teams before proposing tooling improvements around the developer experience of consuming these capabilities.
I would be interested in hearing how others see the future of precompiles within the Revive ecosystem.