[Feat]: Add Rust bindings (dotns-bindings crate)
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 4
- Forks
- 2
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 24
Description
Component: Other
Priority: P1
Summary
a lot of polkadot's infrastructure tooling is written in rust. indexers, backend services, cli utilities, and so on. if you want to resolve a .dot name from any of those today, you have to vendor the abi by hand and pair it with alloy yourself. that's roughly 150-200 lines of boilerplate per consumer, and each copy drifts on the first contract upgrade.
the fix is a dotns-bindings crate on crates.io, generated from the same @parity/dotns-abi artifacts as the typescript side, so both languages are always in lockstep with the contracts. the rust toolchain for this (forge bind --alloy wrapping alloy::sol!) is mature and used by the foundry rust template, so there's very little novel engineering involved. mostly it's wiring.
one important point: the addresses come from @parity/dotns-deployments, re-exported as a deployments rust module, so neither language has its own copy of the address table. if paritytech/dotns#118 ships the canonical deployments.json inside the artifact, both sides consume it the same way.
depends on #119 for @parity/dotns-abi and @parity/dotns-deployments.
Proposal
New package:
packages/bindings-rspublished to crates.io asdotns-bindings.
Tasks, packages/bindings-rs
- Scaffold Cargo crate at
packages/bindings-rs/asdotns-bindings. - Use
forge bind --alloy --overwrite --skip-buildin CI to generate bindings viaalloy::sol!macro frompackages/abi/artifacts/. - Expose typed contract structs per contract with every function exposed.
- Expose a
deploymentsmodule mirroring the TS version, sourced from@parity/dotns-deployments. - Integration test reads one view function from live Paseo. No mocks.
-
cargo docgenerated for the crate; published alongside release. - Publish to crates.io as
dotns-bindings.
Tasks, examples
-
examples/resolve-rs/: a minimal Rust binary that depends ondotns-bindings, resolvesalice.doton Paseo, prints the address. - Example builds and runs in CI on every PR.
Acceptance criteria
-
cargo add dotns-bindingsworks from a fresh project. -
examples/resolve-rs/resolves a name end to end. -
cargo docpublished alongside the crate on every release. - Integration test against live Paseo passes in CI.
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.
Research direction
Start by checking dependency #119 and the existing packages/abi/artifacts and TypeScript deployment exports. Then inspect the proposed packages/bindings-rs crate, the forge bind --alloy CI command, and examples/resolve-rs/. Done means the crate and example build, resolve alice.dot against live Paseo, pass the integration checks, and have cargo doc and crates.io publication wired into releases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, solidity
- Domain
- backend-api-design, build-system, developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100