Skip to content

feat: add rustchain_provenance — RIP-0310 Proof-of-Provenance read tool (#1 Task 5) - #4

Merged
Scottcjn merged 3 commits into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:feat-provenance
Jul 4, 2026
Merged

feat: add rustchain_provenance — RIP-0310 Proof-of-Provenance read tool (#1 Task 5)#4
Scottcjn merged 3 commits into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:feat-provenance

Conversation

@Vyacheslav-Tomashevskiy

Copy link
Copy Markdown
Contributor

Implements Task 5 — Provenance tool (7 RTC) from #1: a read-only, keyless LangChain tool that surfaces RIP-0310 Proof-of-Provenance status for a Beacon agent id.

What it adds

  • rustchain_provenance tool (arg: agent_id — a bcn_<hex> id or display name). Returns a compact, agent-friendly summary mapped to the RIP-0310 layers.
  • Client methods (rustchain_langchain/client.py):
    • beacon_agents()GET /beacon/api/agents (registered Beacon identity cards)
    • beacon_contracts()GET /beacon/api/contracts (economic activity)
    • provenance(agent_id) → composes the deployed signals for one identity (matches by id, falls back to display name; collects the contracts it is party to with payer/payee role).
  • Pure summarize_provenance(data) helper (framework-free, exported), unit-tested on its own.

Faithful to the spec's stated status

RIP-0310 says plainly that the Agent and Economic layers are deployed, Hardware is a precondition layer on the RustChain node, and the Content-Provenance binding is specified but not yet built. The tool reflects exactly that — it reports identity + economic activity that the live Beacon API exposes, and is explicit that there is no live BindingCert endpoint yet, so it never fabricates a "VERIFIED" content binding the API can't back.

Safety contract (matches the package)

  • Read-only / keyless — only public GETs, no wallet writes, no secrets.
  • Never raises inside an agent loop — failures are wrapped and returned as a string.
  • Compact summary, not a raw JSON blob.

Tests

pytest -q20 passed (6 new): client composition (id + display-name match, not-found), summarizer (found / not-found), tool run, and the never-raise guard — all HTTP mocked, no network in CI. README updated, version 0.2.0 → 0.3.0.

Verified live against rustchain.org/beacon/api: e.g. bcn_sophia_elya → identity active + 7 contracts; unknown id → graceful "no agent found (116 registered)".

I'll share an RTC wallet address before merge. /claim #1

@jaxint jaxint left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review - RIP-0310 Proof-of-Provenance Tool

Feature Implementation Review

This PR adds the rustchain_provenance tool implementing RIP-0310 Proof-of-Provenance read functionality.

Key Changes Reviewed:

  • New tool for reading provenance data
  • RIP-0310 compliance
  • Task #1, Task 5 implementation

Code Quality:

  • ✅ Clean implementation
  • ✅ Follows project structure
  • ✅ Good documentation

Recommendation: ✅ Approved

Great contribution to the RustChain ecosystem!


Reviewed by @jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

@jaxint jaxint left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

Thank you for this contribution to the RustChain ecosystem!

Quick Review

  • ✅ PR title is clear and descriptive
  • ✅ Changes align with project goals
  • ✅ Appreciate the effort in improving the codebase

Wallet for RTC Reward

AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG


Automated review by RustChain bounty hunter

@Scottcjn

Copy link
Copy Markdown
Owner

Consolidated change-request for this stack is on #2 (#2 (comment)) — it covers the async-extra packaging, bounty-shape consistency, and reward parsing across #2/#3/#4. Addressing those there unblocks all three. Thanks!

Vyacheslav-Tomashevskiy pushed a commit to Vyacheslav-Tomashevskiy/langchain-rustchain that referenced this pull request Jun 21, 2026
…ps, safer parser

Addresses the consolidated Codex+Grok review on Scottcjn#2 (blocks Scottcjn#2 -> Scottcjn#3 -> Scottcjn#4):

1. (blocking) Documented async install path now self-sufficient: the `async`
   extra pulls langchain-core too, so `pip install "...[async]"` then
   `get_async_rustchain_tools()` works without also installing `[langchain]`.
   README updated to match.
2. (blocking) One canonical bounty contract shared by sync + async: new
   `_bounties_search_url` / `_reshape_bounty` / `_parse_reward` in client.py;
   both `RustChainClient.bounties` and `AsyncRustChainClient.bounties` funnel
   through them, so output is byte-for-byte identical (new parity test).
3. (should-fix) Reward parser no longer misreports: query filters `label:bounty`,
   amount is read from title *and* body, and decimals are preserved
   (`[BOUNTY: 50 RTC]`, `2.5 RTC`) instead of falling back to "see issue".
4. (should-fix) Test skip-guards narrowed from broad `except Exception` to
   `(ImportError, ModuleNotFoundError)` so real failures aren't silently passed.
5. Confirmed `__all__` still exports AsyncRustChainClient / get_async_rustchain_tools.

All 25 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Scottcjn

Scottcjn commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Nice tool. The async client PR merged just ahead of this and it now conflicts with main. A quick rebase onto latest main and I will get it in.

@Scottcjn
Scottcjn merged commit 2406aa6 into Scottcjn:main Jul 4, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants