paritytech / paritytech/web3-storage
Precompiles: extract a shared support crate for the hand-rolled ABI helpers
@antkve is already working on this.
Since Sep 10, 2026.
- Dominant language
- Rust
- Stars
- 12
- Forks
- 3
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 33
Description
The three pallet_revive precompile crates (pallet-storage-provider-precompile, pallet-drive-registry-precompile, pallet-s3-registry-precompile) each hand-roll the same boundary helpers with no shared home: revert (tracing + Error::Revert), decode_account (bytes32 → AccountId32), and the SCALE MultiSignature decode + error message inlined into every create/establish arm. Surfaced while reviewing the visibility work, which briefly added a fourth triplicated helper (decode_visibility, since replaced by Solidity enums along with decode_role).
Proposed shape: a small no_std workspace crate (e.g. crates/utils/precompile-support) exporting revert(target, error, message), decode_account<T>(target, &[u8; 32]), and decode_multi_signature(target, &[u8]). The target: &str parameter preserves the three distinct LOG_TARGETs; each precompile keeps one-line local wrappers binding its target so the ~30 dispatch-arm call sites don't churn.
Known obstacle for going further: decode_terms cannot be shared as-is — each alloy::sol! invocation generates a nominally distinct PrimitiveAgreementTerms type per crate, so terms decoding would need a macro or a small field-accessor trait. Fine to leave per-crate initially.
Housekeeping the repo rules require when this lands: root [workspace.dependencies] entry + member registration, scripts/coverage.sh classification (COV_SKIP with the same "exercised out of process via just sc-demo" reason as the precompiles), and zepter std feature propagation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.