Skip to content

Commit ba0ef8a

Browse files
authored
feat(deploy): publish-trading-v0 — one-shot v0 publish for 4 trading blueprints (#158)
* feat(deploy): record every registered blueprint variant + per-binary publish The multi-blueprint repos (ai-agent-sandbox, ai-trading) each register their full set on-chain (sandbox: cloud/instance/tee = ids 10-12; trading: trading/instance/tee/validator = ids 13-16), but the sweep's manifest parser kept only the last id per repo (tail -1), so blueprints.tsv recorded 1 of 3-4 and even mislabelled trading (id 16 is the validator, not the main blueprint). - register-blueprints.sh: record ONE manifest row per emitted DEPLOY_<LABEL>BLUEPRINT_ID, pairing each with its same-label BSM. All variants now land in the manifest on a re-run. - blueprints.tsv: rebuilt as the complete 17-blueprint manifest from on-chain truth (blueprintCount=17), with the operator binary name + variant recorded per row — the bin->id map the publish step needs. - publish-blueprint-binary.yml: optional `binary_name` input so a multi-blueprint repo publishes the right binary to the right id (asset match becomes "<binary>-<triple>.tar.xz"). * feat(deploy): publish-trading-v0 — one-shot v0 publish for the four trading blueprints Closes the `no_v0_published` column for blueprint ids 13/14/15/16 on Base Sepolia in one invocation. Pulls each binary's x86_64-unknown-linux-gnu tar.xz from the ai-trading-blueprint GitHub Release (default v0.1.3), computes sha256, and delegates to deploy/publish-binary.sh which is already append-only + idempotent. PRIVATE_KEY=<owner> ./deploy/publish-trading-v0.sh TANGLE_CORE auto-loads from deployments/base-sepolia/latest.json; RPC defaults to https://sepolia.base.org. Override TAG if a newer release supersedes v0.1.3.
1 parent 6e1c818 commit ba0ef8a

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

deploy/publish-trading-v0.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
# Publish v0 (genesis binary version) on-chain for the four ai-trading
3+
# blueprints registered on Base Sepolia:
4+
#
5+
# 13 trading -> trading-blueprint-x86_64-unknown-linux-gnu.tar.xz
6+
# 14 instance -> trading-instance-blueprint-x86_64-unknown-linux-gnu.tar.xz
7+
# 15 tee-instance -> trading-tee-instance-blueprint-x86_64-unknown-linux-gnu.tar.xz
8+
# 16 validator -> trading-validator-x86_64-unknown-linux-gnu.tar.xz
9+
#
10+
# Closes the `no_v0_published` column in deployments/base-sepolia/blueprints.tsv
11+
# for the trading row(s). Append-only + idempotent — re-running is a no-op if
12+
# a version is already published (see deploy/publish-binary.sh for the guard).
13+
#
14+
# Required env (loaded from the secrets repo, NOT baked here):
15+
# PRIVATE_KEY - blueprint owner key (shared-testnet-deployer; 0x2420…)
16+
#
17+
# Optional env (sensible defaults):
18+
# TAG - GitHub release tag to publish (default v0.1.3)
19+
# TANGLE_CORE - default loaded from deployments/base-sepolia/latest.json
20+
# RPC_URL - default https://sepolia.base.org
21+
set -euo pipefail
22+
23+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
24+
TAG="${TAG:-v0.1.3}"
25+
RPC_URL="${RPC_URL:-https://sepolia.base.org}"
26+
TANGLE_CORE="${TANGLE_CORE:-$(jq -r '.tangle' "$ROOT_DIR/deployments/base-sepolia/latest.json")}"
27+
: "${PRIVATE_KEY:?set PRIVATE_KEY (blueprint owner key)}"
28+
29+
REPO="tangle-network/ai-trading-blueprint"
30+
TGT="x86_64-unknown-linux-gnu"
31+
TMPDIR="$(mktemp -d)"
32+
trap 'rm -rf "$TMPDIR"' EXIT
33+
34+
# id binary
35+
publish_pairs=(
36+
"13 trading-blueprint"
37+
"14 trading-instance-blueprint"
38+
"15 trading-tee-instance-blueprint"
39+
"16 trading-validator"
40+
)
41+
42+
for pair in "${publish_pairs[@]}"; do
43+
read -r BID BIN <<<"$pair"
44+
A="${BIN}-${TGT}.tar.xz"
45+
URL="https://github.com/${REPO}/releases/download/${TAG}/${A}"
46+
echo
47+
echo "=== publishing blueprint $BID ($BIN) from ${TAG} ==="
48+
curl -fsSL "$URL" -o "$TMPDIR/$A"
49+
50+
# sha256 is computed by publish-binary.sh against BINARY_PATH; pass the
51+
# tarball itself (operators verify the same artifact they downloaded).
52+
TANGLE_CORE="$TANGLE_CORE" \
53+
RPC_URL="$RPC_URL" \
54+
PRIVATE_KEY="$PRIVATE_KEY" \
55+
BLUEPRINT_ID="$BID" \
56+
BINARY_PATH="$TMPDIR/$A" \
57+
BINARY_URI="$URL" \
58+
"$ROOT_DIR/deploy/publish-binary.sh"
59+
done
60+
61+
echo
62+
echo "all four ai-trading blueprints published on-chain (or already had v0)."
63+
echo "verify with:"
64+
echo " for id in 13 14 15 16; do"
65+
echo " cast call $TANGLE_CORE 'getBinaryVersionCount(uint64)(uint64)' \$id --rpc-url $RPC_URL"
66+
echo " done"

0 commit comments

Comments
 (0)