Skip to content

feat(deploy): single-shot BSM deploy + Tangle blueprint registration#7

Merged
drewstone merged 1 commit into
mainfrom
feat/cargo-tangle-register-blueprint
May 21, 2026
Merged

feat(deploy): single-shot BSM deploy + Tangle blueprint registration#7
drewstone merged 1 commit into
mainfrom
feat/cargo-tangle-register-blueprint

Conversation

@tangletools

Copy link
Copy Markdown
Contributor

Replaces the prior deploy/register-blueprint.sh (which only printed cast commands for the operator to paste manually) with a proper single-shot flow that deploys InferenceBSM (impl + UUPS proxy + initialize) AND registers the blueprint on Tangle in the same broadcast.

Mirrors the proven pattern from ai-agent-sandbox-blueprint's RegisterBlueprint.s.sol (sandbox/instance/TEE blueprint IDs 0/1/2 already on-chain on Base Sepolia).

What changed

  • contracts/script/RegisterBlueprint.s.sol (new): Foundry script that builds the BlueprintDefinition matching blueprint.json, deploys InferenceBSM (impl + proxy + initialize(paymentToken)), then calls Tangle.createBlueprint. Env-parameterized (PRIVATE_KEY, TANGLE_CORE, PAYMENT_TOKEN) with Base Sepolia + anvil defaults.

  • deploy/register-blueprint.sh (rewritten): invokes the forge script in one broadcast, parses the proxy + blueprint ID out of console2 output, and emits the operator-registration calldata for the operator's separate Tangle.registerOperator call.

  • contracts/foundry.toml: bump tnt-core 0.10.4 → 0.13.0 (latest soldeer release matching the deployed Base Sepolia ABI; BlueprintDefinition gained a metadataHash field between 0.10 and 0.13 — selector mismatch would otherwise revert against the live contract).

  • contracts/remappings.txt: drop stale 0.10.4 entries, point tnt-core/ at the 0.13.0 dep.

  • contracts/soldeer.lock: regenerated.

Usage (Base Sepolia)

export PRIVATE_KEY=0x...
export RPC_URL=https://sepolia.base.org
export TANGLE_CORE=0xC9b0716a187072be0f38A5D972392C6479b9Cfe3
export PAYMENT_TOKEN=0x036CbD53842c5426634e7929541eC2318f3dCF7e   # USDC sepolia
./deploy/register-blueprint.sh

Local anvil works with no env vars (defaults to LocalTestnet snapshot addresses).

What this PR does NOT do

Actually run the broadcast — creating a blueprint produces a permanent on-chain ID. Land this PR for review, then run the script when you're ready to publish.

Test plan

  • forge build clean (asm-keccak256 lint warnings only, pre-existing in InferenceBSM.sol)
  • Local: ./deploy/register-blueprint.sh against anvil snapshot
  • Sepolia: same script with RPC_URL=https://sepolia.base.org and TANGLE_CORE=0xC9b0716a187072be0f38A5D972392C6479b9Cfe3

Replaces the prior `deploy/register-blueprint.sh` that printed cast
commands for the operator to paste manually. The new flow deploys
InferenceBSM (impl + UUPS proxy + initialize) AND registers the
blueprint on Tangle in a single broadcast via
`contracts/script/RegisterBlueprint.s.sol`.

Mirrors the proven pattern from ai-agent-sandbox-blueprint's
RegisterBlueprint.s.sol (sandbox/instance/TEE blueprint IDs 0/1/2
already registered against Base Sepolia tnt-core).

## Changes

- **`contracts/script/RegisterBlueprint.s.sol`** (new): builds the
  `BlueprintDefinition` matching `blueprint.json`, deploys BSM
  (impl + proxy + `initialize(paymentToken)`), then calls
  `Tangle.createBlueprint`. Reads `PRIVATE_KEY`, `TANGLE_CORE`,
  `PAYMENT_TOKEN` from env with Base Sepolia / anvil defaults.

- **`deploy/register-blueprint.sh`**: rewritten to invoke the forge
  script in one broadcast, parse the proxy + blueprint ID out of
  console2 output, and emit the operator-registration calldata for
  the operator's separate `Tangle.registerOperator` call.

- **`contracts/foundry.toml`**: bump tnt-core 0.10.4 → 0.13.0 (latest
  soldeer release matching the deployed Base Sepolia ABI;
  `BlueprintDefinition` gained a `metadataHash` field between 0.10
  and 0.13 — selector mismatch would revert otherwise).
- **`contracts/remappings.txt`**: drop stale 0.10.4 entries, point
  `tnt-core/` at the new 0.13.0 dep.
- **`contracts/soldeer.lock`**: regenerated.

## Usage (Base Sepolia)

```
export PRIVATE_KEY=0x...
export RPC_URL=https://sepolia.base.org
export TANGLE_CORE=0xC9b0716a187072be0f38A5D972392C6479b9Cfe3
export PAYMENT_TOKEN=0x036CbD53842c5426634e7929541eC2318f3dCF7e
./deploy/register-blueprint.sh
```

## What this PR does NOT do

Actually run the broadcast — that creates a permanent on-chain
blueprint ID that can't be reused. Land this PR for review, then
operators / blueprint owners run the script once they're ready to
publish.

## Verification

  forge build   clean (asm-keccak256 lint warnings only)

@drewstone drewstone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Auto-approved via session script.

@drewstone drewstone merged commit 1d96fe2 into main May 21, 2026
1 of 5 checks passed
@drewstone drewstone deleted the feat/cargo-tangle-register-blueprint branch May 21, 2026 11:44
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.

2 participants