paritytech / paritytech/dotns

[Feat]: Add Rust bindings (dotns-bindings crate)

Open
#121 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotns-sdk triage type: feature
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-rs published to crates.io as dotns-bindings.
Tasks, packages/bindings-rs
  • Scaffold Cargo crate at packages/bindings-rs/ as dotns-bindings.
  • Use forge bind --alloy --overwrite --skip-build in CI to generate bindings via alloy::sol! macro from packages/abi/artifacts/.
  • Expose typed contract structs per contract with every function exposed.
  • Expose a deployments module mirroring the TS version, sourced from @parity/dotns-deployments.
  • Integration test reads one view function from live Paseo. No mocks.
  • cargo doc generated for the crate; published alongside release.
  • Publish to crates.io as dotns-bindings.
Tasks, examples
  • examples/resolve-rs/: a minimal Rust binary that depends on dotns-bindings, resolves alice.dot on Paseo, prints the address.
  • Example builds and runs in CI on every PR.

Acceptance criteria

  • cargo add dotns-bindings works from a fresh project.
  • examples/resolve-rs/ resolves a name end to end.
  • cargo doc published alongside the crate on every release.
  • Integration test against live Paseo passes in CI.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.