feat(examples): add multi-chain TDIP delegation chain example#27
Closed
hilarl wants to merge 1 commit intoagent-intent:mainfrom
Closed
feat(examples): add multi-chain TDIP delegation chain example#27hilarl wants to merge 1 commit intoagent-intent:mainfrom
hilarl wants to merge 1 commit intoagent-intent:mainfrom
Conversation
New runnable example demonstrating a single Verifiable Intent L1 + L2 + four L3a delegation records spanning Ethereum (wTNZO), Solana (wTNZO-SPL), Canton (CIP-56), and a denial scenario (Polygon). Signed-off-by: Hilal Agil <hilaal@gmail.com>
Author
|
Withdrawing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
examples: add multi-chain delegation example with Plonky3 cart-hash anchoring
Follow-up to #25 (which introduced
protocol-landscape/tenzro-tdip.mdexamples/tenzro_tdip_flow.pycovering the single-chain TDIP↔VIcomposition). This PR adds a second runnable example exercising the
multi-chain dimension of TDIP delegation that docs(protocol-landscape): add Tenzro TDIP integration mapping + example #25 documented but did
not demonstrate.
Motivation
TDIP'sDelegationScopealready listsallowed_chainsas a first-class axis alongside
max_transaction_value,max_daily_spend,allowed_operations,allowed_payment_protocols, andtime_bound. Ofthose six axes,
allowed_chainsis the most-tested in the upstreamRust crate (
crates/tenzro-identity/src/delegation.rs) but theleast-demonstrated in any portable example — partly because
single-VM agentic-commerce demos rarely surface it.
This example fills that gap. A single VI L1 + L2 + four per-purchase
L3a records drive purchases across four Tenzro VM facades:
0x7a4bcb...)allowed_chains— rejected with the typedChainNotAllowedreason.Each accepted purchase generates a Plonky3 STARK over a canonical cart
payload, computes the 32-byte
compute_zk_commitment(circuit_id, proof_bytes, public_inputs)=SHA-256(circuit_id ‖ proof_bytes ‖ Σ(len_le(pi) ‖ pi)), and recordsit in a mock
ZkCommitmentRegistry. The VI L3atransaction_idcarriesthe same canonical cart hash, so the off-chain VI record and the
on-chain ZK commitment are cross-verifiable — useful for the case where
a merchant on chain X wants to confirm an authorization that settled on
chain Y.
What's in this PR
examples/tenzro_did_chain_multichain.py(new, ~520 lines)Self-contained, mocks both TDIP and the on-chain registry. With
TENZRO_RPC_URLset (e.g.https://rpc.tenzro.network), the exampleissues real
tenzro_createZkProofJSON-RPC calls instead of computingproof bytes locally. The five-ceiling check at the heart of the
example:
verify_chain)check_constraints)DelegationScope::enforce_operation— operation, value,protocol, time
DelegationScope.allowed_chainsmembership (per-VM gate)SpendingPolicy::check(In the Rust source, (3) and (4) are a single
enforce_operationcall;the Python mock surfaces the chain check separately to make the
denial path readable.)
pytest examples/tenzro_did_chain_multichain.pyis green; the exampleasserts every accepted purchase settles, asserts the denied purchase
fails specifically on
ChainNotAllowed, and asserts each acceptedpurchase produces a unique 32-byte commitment.
protocol-landscape/tenzro-tdip.md(extension, no new file)Adds a single subsection — Multi-chain delegation enforcement — to
the file landed in #25. The patch is provided as a separate
tenzro-tdip.patch.mddescribing exactly where the new prose goes;the maintainer can squash it into the merged file. If the maintainer
prefers the patch lifted into a separate
tenzro-tdip-multichain.md(parallel to how UCP/AP2/ACP each have their own page), I'll respin.
Files
No changes to
spec/. No changes tosrc/. No changes to existingprotocol-landscape/pages other than the sametenzro-tdip.mdextended via this PR.
Tests
pytestclean against this PR.python examples/tenzro_did_chain_multichain.pyruns end-to-end andprints the same banner-formatted output style as
autonomous_flow.pyand
tenzro_tdip_flow.pyfrom docs(protocol-landscape): add Tenzro TDIP integration mapping + example #25.purchase is asserted to fail specifically on the chain gate.
SDK consistency
No SDK changes are required. The example uses only the existing
verifiable_intentSDK surface (create_layer1,create_layer2_autonomous,create_layer3_payment,verify_chain,check_constraints,build_selective_presentation,decode_sd_jwt,resolve_disclosures,hash_disclosure). The TDIP primitives andZkCommitmentRegistryaremocked locally in the example file. Pointers to the real Rust
implementations:
crates/tenzro-identity/src/delegation.rs—DelegationScope,is_chain_allowedcrates/tenzro-zk—compute_zk_commitment,ZkCommitmentRegistryhash construction
crates/tenzro-vm/src/precompiles.rs—ZK_VERIFYprecompile(O(1) HashSet lookup)
Protocol-agnostic language
The VI core spec (
spec/) is unchanged. All TDIP- and chain-specificlanguage lives in
protocol-landscape/tenzro-tdip.mdand the newexample. The example deliberately uses Tenzro testnet endpoints
(
rpc.tenzro.network) and marks Solana / Canton facade addresses asplaceholders; nothing is mainnet-specific.
DCO sign-off
All commits in this PR carry
Signed-off-by: Hilal Agil <hilal@tenzro.com>.AI assistance disclosure
Per the project's contribution norms: parts of the wording in this PR
description, the patch to
tenzro-tdip.md, and code comments in theexample were prepared with AI assistance from Claude Code. All
technical decisions, the multi-chain mapping itself, and final wording
were reviewed and authored by the human author (Hilal Agil,
hilal@tenzro.com). The TDIP and Plonky3 reference implementations in
tenzro/tenzro-networkwere developed independently.Checklist
examples: add multi-chain delegation example with Plonky3 cart-hash anchoring.spec/(TDIP-specific content stays inprotocol-landscape/).examples/.pytestclean against the change.ceiling pattern.
verifiable_intentsurface isunchanged.
single-chain example.