Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(contracts): boot the program tests on a realistic clock and fix the license account offsets

nirholas2754915a3a15
diff --git a/api/_lib/x402/revenue-networks.js b/api/_lib/x402/revenue-networks.js
index 2efe172d3..227930905 100644
--- a/api/_lib/x402/revenue-networks.js
+++ b/api/_lib/x402/revenue-networks.js
@@ -17,22 +17,25 @@
// its own explorer and returns null rather than guessing.
import { CHAIN_BY_ID } from '../erc8004-chains.js';
+import { NETWORK_SOLANA_MAINNET, NETWORK_SOLANA_DEVNET } from './solana-networks.js';
// Families we name explicitly. `ids` lists every raw value the ledger may hold
// for that family: the canonical CAIP-2 id first, then legacy spellings. The
// table is the single source of truth for both directions (id → family and
-// family → ids), so display and filtering can never disagree.
+// family → ids), so display and filtering can never disagree. The two Solana
+// cluster ids come from solana-networks.js, the rail's one definition of them,
+// so a settlement can never be written under an id this table would not fold.
const FAMILIES = [
{
family: 'solana',
label: 'Solana',
- ids: ['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', 'solana:mainnet', 'solana', 'mainnet'],
+ ids: [NETWORK_SOLANA_MAINNET, 'solana:mainnet', 'solana', 'mainnet'],
},
{
family: 'solana-devnet',
label: 'Solana devnet',
cluster: 'devnet',
- ids: ['solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1', 'solana:devnet', 'devnet'],
+ ids: [NETWORK_SOLANA_DEVNET, 'solana:devnet', 'devnet'],
},
{
family: 'solana-testnet',
@@ -49,7 +52,12 @@ const FAMILIES = [
},
{ family: 'bsc', label: 'BNB Chain', chainId: 56, ids: ['eip155:56', 'bsc', 'bnb'] },
{ family: 'ethereum', label: 'Ethereum', chainId: 1, ids: ['eip155:1', 'ethereum'] },
- { family: 'arbitrum', label: 'Arbitrum One', chainId: 42161, ids: ['eip155:42161', 'arbitrum'] },
+ {
+ family: 'arbitrum',
+ label: 'Arbitrum One',
+ chainId: 42161,
+ ids: ['eip155:42161', 'arbitrum'],
+ },
{ family: 'optimism', label: 'Optimism', chainId: 10, ids: ['eip155:10', 'optimism'] },
{ family: 'polygon', label: 'Polygon', chainId: 137, ids: ['eip155:137', 'polygon'] },
{
@@ -118,7 +126,14 @@ export function networkIdentity(raw) {
// Any other Solana reference (a cluster we have not named) is still Solana.
if (/^solana:/i.test(id)) {
- return { id, family: 'solana', label: 'Solana', cluster: null, chainId: null, explorer: null };
+ return {
+ id,
+ family: 'solana',
+ label: 'Solana',
+ cluster: null,
+ chainId: null,
+ explorer: null,
+ };
}
return { id, ...UNKNOWN };
diff --git a/contracts/audit/static-analysis/clippy-agent-invocation.txt b/contracts/audit/static-analysis/clippy-agent-invocation.txt
new file mode 100644
index 000000000..e7246c8ee
--- /dev/null
+++ b/contracts/audit/static-analysis/clippy-agent-invocation.txt
@@ -0,0 +1,8 @@
+src/lib.rs:16:1: warning: unexpected `cfg` condition value: `custom-heap`
+src/lib.rs:16:1: warning: unexpected `cfg` condition value: `solana`
+src/lib.rs:16:1: warning: unexpected `cfg` condition value: `custom-panic`
+src/lib.rs:16:1: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:76:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:16:1: warning: use of deprecated method `anchor_lang::prelude::AccountInfo::<'a>::realloc`: Use AccountInfo::resize() instead
+warning: `agent-invocation` (lib) generated 13 warnings (9 duplicates)
+warning: `agent-invocation` (lib test) generated 13 warnings (11 duplicates)
diff --git a/contracts/audit/static-analysis/clippy-skill-license.txt b/contracts/audit/static-analysis/clippy-skill-license.txt
new file mode 100644
index 000000000..06d587e7c
--- /dev/null
+++ b/contracts/audit/static-analysis/clippy-skill-license.txt
@@ -0,0 +1,12 @@
+src/lib.rs:30:1: warning: unexpected `cfg` condition value: `custom-heap`
+src/lib.rs:30:1: warning: unexpected `cfg` condition value: `solana`
+src/lib.rs:30:1: warning: unexpected `cfg` condition value: `custom-panic`
+src/lib.rs:30:1: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:202:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:219:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:232:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:302:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:334:10: warning: unexpected `cfg` condition value: `anchor-debug`
+src/lib.rs:30:1: warning: use of deprecated method `anchor_lang::prelude::AccountInfo::<'a>::realloc`: Use AccountInfo::resize() instead
+warning: `skill-license` (lib test) generated 17 warnings (17 duplicates)
+warning: `skill-license` (lib) generated 17 warnings (7 duplicates)
diff --git a/contracts/audit/static-analysis/slither-report.txt b/contracts/audit/static-analysis/slither-report.txt
new file mode 100644
index 000000000..07f1d986f
--- /dev/null
+++ b/contracts/audit/static-analysis/slither-report.txt
@@ -0,0 +1,80 @@
+
+Detector: reentrancy-balance
+Reentrancy in AgentPayments.buybackTrigger(address,address,address,bytes) (src/AgentPayments.sol#255-298):
+ External call allowing reentrancy:
+ - (ok,None) = swapRouter.call{value: spend}(swapData) (src/AgentPayments.sol#280)
+ Balance read before the call:
+ - agentBefore = IERC20(agentToken).balanceOf(address(this)) (src/AgentPayments.sol#277)
+ Possible stale balance used after the call in a condition:
+ - bought == 0 (src/AgentPayments.sol#290)
+ - stale variable `bought`
+Reentrancy in AgentPayments.buybackTrigger(address,address,address,bytes) (src/AgentPayments.sol#255-298):
+ External call allowing reentrancy:
+ - (ok_scope_0,None) = swapRouter.call(swapData) (src/AgentPayments.sol#284)
+ Balance read before the call:
+ - agentBefore = IERC20(agentToken).balanceOf(address(this)) (src/AgentPayments.sol#277)
+ Possible stale balance used after the call in a condition:
+ - bought == 0 (src/AgentPayments.sol#290)
+ - stale variable `bought`
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities
+
+Detector: reentrancy-eth
+Reentrancy in AgentPayments.buybackTrigger(address,address,address,bytes) (src/AgentPayments.sol#255-298):
+ External calls:
+ - (ok,None) = swapRouter.call{value: spend}(swapData) (src/AgentPayments.sol#280)
+ - (ok_scope_0,None) = swapRouter.call(swapData) (src/AgentPayments.sol#284)
+ External calls sending eth:
+ - (ok,None) = swapRouter.call{value: spend}(swapData) (src/AgentPayments.sol#280)
+ State variables written after the call(s):
+ - acct.tokensBurned += bought (src/AgentPayments.sol#295)
+ AgentPayments._accounts (src/AgentPayments.sol#69) can be used in cross function reentrancies:
+ - AgentPayments.distributePayments(address,address) (src/AgentPayments.sol#226-241)
+ - AgentPayments.getBalances(address,address) (src/AgentPayments.sol#379-386)
+ - AgentPayments.getPaymentStats(address,address) (src/AgentPayments.sol#388-395)
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1
+
+Detector: incorrect-equality
+AgentPayments._settle(address,address,uint256,uint256,uint64,int64,int64,address) (src/AgentPayments.sol#191-218) uses a dangerous strict equality:
+ - received == 0 (src/AgentPayments.sol#202)
+AgentPayments.buybackTrigger(address,address,address,bytes) (src/AgentPayments.sol#255-298) uses a dangerous strict equality:
+ - bought == 0 (src/AgentPayments.sol#290)
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities
+
+Detector: timestamp
+AgentPayments._settle(address,address,uint256,uint256,uint64,int64,int64,address) (src/AgentPayments.sol#191-218) uses timestamp for comparisons
+ Dangerous comparisons:
+ - startTime != 0 && block.timestamp < uint256(uint64(startTime)) (src/AgentPayments.sol#206)
+ - endTime != 0 && block.timestamp > uint256(uint64(endTime)) (src/AgentPayments.sol#207)
+IdentityRegistry.setAgentWallet(uint256,address,uint256,bytes) (src/IdentityRegistry.sol#148-171) uses timestamp for comparisons
+ Dangerous comparisons:
+ - block.timestamp > deadline (src/IdentityRegistry.sol#154)
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp
+
+Detector: low-level-calls
+Low level call in AgentPayments.buybackTrigger(address,address,address,bytes) (src/AgentPayments.sol#255-298):
+ - (ok,None) = swapRouter.call{value: spend}(swapData) (src/AgentPayments.sol#280)
+ - (ok_scope_0,None) = swapRouter.call(swapData) (src/AgentPayments.sol#284)
+Low level call in AgentPayments.withdraw(address,address,address) (src/AgentPayments.sol#306-331):
+ - (ok,None) = receiver.call{value: amount}() (src/AgentPayments.sol#324)
+Low level call in GreenfieldVault.buy(bytes32,bytes) (src/GreenfieldVault.sol#199-242):
+ - (ok,None) = msg.sender.call{value: refund}() (src/GreenfieldVault.sol#239)
+Low level call in GreenfieldVault.revoke(uint256) (src/GreenfieldVault.sol#291-315):
+ - (ok,None) = msg.sender.call{value: refund}() (src/GreenfieldVault.sol#312)
+Low level call in GreenfieldVault.withdraw() (src/GreenfieldVault.sol#320-327):
+ - (ok,None) = msg.sender.call{value: amount}() (src/GreenfieldVault.sol#324)
+Low level call in IdentityRegistry.withdraw(uint256,address,uint256) (src/IdentityRegistry.sol#241-252):
+ - (ok,None) = recipient.call{value: amountWei}() (src/IdentityRegistry.sol#249)
+Low level call in IdentityRegistry.spend(uint256,address,uint256,string) (src/IdentityRegistry.sol#268-282):
+ - (ok,None) = recipient.call{value: amountWei}() (src/IdentityRegistry.sol#279)
+Low level call in ReputationRegistry.withdrawStake(uint256) (src/ReputationRegistry.sol#189-200):
+ - (ok,None) = address(msg.sender).call{value: amount}() (src/ReputationRegistry.sol#196)
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls
+
+Detector: missing-inheritance
+IdentityRegistry (src/IdentityRegistry.sol#15-295) should inherit from IIdentityRegistry (src/IIdentityRegistry.sol#14-20)
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#missing-inheritance
+
+Detector: naming-convention
+Function IdentityRegistry.DOMAIN_SEPARATOR() (src/IdentityRegistry.sol#292-294) is not in mixedCase
+Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions
+. analyzed (44 contracts with 102 detectors), 17 result(s) found
diff --git a/contracts/program-tests/Cargo.lock b/contracts/program-tests/Cargo.lock
index 701abf8e2..80a8b02ec 100644
--- a/contracts/program-tests/Cargo.lock
+++ b/contracts/program-tests/Cargo.lock
@@ -1627,10 +1627,10 @@ dependencies = [
name = "program-tests"
version = "0.1.0"
dependencies = [
- "borsh",
"litesvm",
"sha2 0.10.9",
"solana-builtins",
+ "solana-clock",
"solana-instruction",
"solana-keypair",
"solana-program-runtime",
diff --git a/contracts/program-tests/Cargo.toml b/contracts/program-tests/Cargo.toml
index 7703e5582..f85689392 100644
--- a/contracts/program-tests/Cargo.toml
+++ b/contracts/program-tests/Cargo.toml
@@ -17,7 +17,7 @@ solana-signer = "3.0"
solana-transaction = "4.1"
solana-pubkey = "3"
solana-system-interface = "3.2"
-borsh = "1.5"
+solana-clock = "3.1"
sha2 = "0.10"
# LiteSVM 0.15.2 destructures `ExecutionRecord` exhaustively, so a later patch
diff --git a/contracts/program-tests/src/lib.rs b/contracts/program-tests/src/lib.rs
index 1fd35cd1a..f997f6acd 100644
--- a/contracts/program-tests/src/lib.rs
+++ b/contracts/program-tests/src/lib.rs
@@ -15,6 +15,7 @@
//! ```
use litesvm::LiteSVM;
+use solana_clock::Clock;
use sha2::{Digest, Sha256};
use solana_pubkey::Pubkey;
use std::path::PathBuf;
@@ -75,7 +76,8 @@ pub fn load_program(svm: &mut LiteSVM, program_id: Pubkey, crate_dir: &str, so_n
path.display()
)
});
- svm.add_program(program_id, &bytes);
+ svm.add_program(program_id, &bytes)
+ .unwrap_or_else(|e| panic!("loading {so_name} into the VM failed: {e:?}"));
}
/// Derive the associated token account for `(owner, mint)`, the same derivation
@@ -149,6 +151,22 @@ pub fn decode_token_account(data: &[u8]) -> TokenAccountState {
}
}
+/// A fixed, realistic wall-clock time for the VM: 2026-01-01T00:00:00Z.
+///
+/// LiteSVM boots with `unix_timestamp == 0`, which no real cluster ever reports.
+/// The programs under test stamp `Clock::get()?.unix_timestamp` into account
+/// state and treat `0` as "not set", so tests must run against a clock that
+/// looks like a real one. Fixed rather than "now" so runs stay reproducible.
+pub const TEST_UNIX_TIMESTAMP: i64 = 1_767_225_600;
+
+/// Point the VM's clock at [`TEST_UNIX_TIMESTAMP`].
+pub fn set_realistic_clock(svm: &mut LiteSVM) {
+ let mut clock = svm.get_sysvar::<Clock>();
+ clock.unix_timestamp = TEST_UNIX_TIMESTAMP;
+ clock.epoch_start_timestamp = TEST_UNIX_TIMESTAMP;
+ svm.set_sysvar(&clock);
+}
+
/// Borsh-encode a string argument (4-byte little-endian length, then bytes).
pub fn borsh_string(s: &str) -> Vec<u8> {
let mut out = (s.len() as u32).to_le_bytes().to_vec();
diff --git a/contracts/program-tests/tests/agent_invocation.rs b/contracts/program-tests/tests/agent_invocation.rs
index 3d0e9a599..456638f05 100644
--- a/contracts/program-tests/tests/agent_invocation.rs
+++ b/contracts/program-tests/tests/agent_invocation.rs
@@ -26,6 +26,7 @@ struct Harness {
impl Harness {
fn new() -> Self {
let mut svm = LiteSVM::new();
+ set_realistic_clock(&mut svm);
let program_id = pk(AGENT_INVOCATION_ID);
load_program(
&mut svm,
@@ -104,7 +105,7 @@ impl Harness {
}
/// Send a transaction the invoker does NOT sign, using a separate fee payer.
- fn send_unsigned_by_invoker(&mut self, ix: Instruction) -> Result<Vec<String>, String> {
+ fn send_unsigned_by_invoker(&mut self, ix: Instruction) -> Result<Vec<String>, Vec<String>> {
let payer = Keypair::new();
self.svm.airdrop(&payer.pubkey(), 1_000_000_000).unwrap();
self.svm.expire_blockhash();
@@ -116,7 +117,7 @@ impl Harness {
);
match self.svm.send_transaction(tx) {
Ok(meta) => Ok(meta.logs),
- Err(failed) => Err(format!("{:?}", failed.err)),
+ Err(failed) => Err(failed.meta.logs),
}
}
}
@@ -179,12 +180,12 @@ fn unsigned_invoker_is_rejected() {
"summarize",
"{}",
);
- let err = h
+ let logs = h
.send_unsigned_by_invoker(ix)
.expect_err("an unsigned invoker must be rejected");
assert!(
- err.contains("Signature") || err.contains("signer"),
- "expected a missing-signature failure, got {err}"
+ logs_have_anchor_error(&logs, "AccountNotSigner"),
+ "expected AccountNotSigner, got {logs:?}"
);
}
diff --git a/contracts/program-tests/tests/skill_license.rs b/contracts/program-tests/tests/skill_license.rs
index 1017bddf1..78e9ffa11 100644
--- a/contracts/program-tests/tests/skill_license.rs
+++ b/contracts/program-tests/tests/skill_license.rs
@@ -34,16 +34,18 @@ struct License {
}
fn decode_license(data: &[u8]) -> License {
+ // discriminator 8 | authority 32 | agent_mint 32 | nft_mint 32
+ // | skill_hash 32 | purchase_date 8 | revoked_at 8 | bump 1 | name (4 + len)
let p = |o: usize| Pubkey::new_from_array(data[o..o + 32].try_into().unwrap());
- let name_len = u32::from_le_bytes(data[129..133].try_into().unwrap()) as usize;
+ let name_len = u32::from_le_bytes(data[153..157].try_into().unwrap()) as usize;
License {
authority: p(8),
agent_mint: p(40),
nft_mint: p(72),
- skill_hash: data[104..136 - 32].try_into().unwrap(),
+ skill_hash: data[104..136].try_into().unwrap(),
purchase_date: i64::from_le_bytes(data[136..144].try_into().unwrap()),
revoked_at: i64::from_le_bytes(data[144..152].try_into().unwrap()),
- skill_name: String::from_utf8(data[133..133 + name_len].to_vec()).unwrap(),
+ skill_name: String::from_utf8(data[157..157 + name_len].to_vec()).unwrap(),
}
}
@@ -61,6 +63,7 @@ impl Harness {
/// Boot the VM, load the program, and initialize the singleton marketplace.
fn new() -> Self {
let mut svm = LiteSVM::new();
+ set_realistic_clock(&mut svm);
let program_id = pk(SKILL_LICENSE_ID);
load_program(&mut svm, program_id, "skill-license", "skill_license.so");
@@ -557,6 +560,30 @@ fn a_stranger_cannot_burn_someone_elses_license() {
);
}
+/// SL-6 (negative): a burn must name the mint recorded on the license. Pointing
+/// it at a different license's NFT mint is rejected, so one purchase can never
+/// be used to destroy the token backing another.
+#[test]
+fn burning_with_a_foreign_mint_is_rejected() {
+ let mut h = Harness::new();
+ h.mint("summarize").unwrap();
+ h.mint("render").unwrap();
+
+ let owner = h.owner.insecure_clone();
+ let foreign_mint = h.nft_mint_pda(&owner.pubkey(), &h.agent_mint, "render");
+ let mut ix = h.burn_ix(&owner.pubkey(), &owner.pubkey(), "summarize");
+ ix.accounts[2] = AccountMeta::new(foreign_mint, false);
+
+ let logs = h
+ .send(ix, &owner, &[&owner])
+ .expect_err("a burn naming a foreign mint must be rejected");
+ assert!(
+ logs_have_anchor_error(&logs, "MintMismatch"),
+ "expected MintMismatch, got {logs:?}"
+ );
+ assert_eq!(h.license_of("summarize").revoked_at, 0);
+}
+
// ── SL-7: the lifetime counter uses checked arithmetic ───────────────────────
/// SL-7 (positive): the counter advances by exactly one per accepted mint.
diff --git a/prompts/swarm-100/route-x402-revenue.md b/prompts/swarm-100/route-x402-revenue.md
deleted file mode 100644
index 5cd0dc24e..000000000
--- a/prompts/swarm-100/route-x402-revenue.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /x402-revenue (Endpoint Revenue)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/x402-revenue')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/x402-revenue" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/x402-revenue
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /x402-revenue ("Endpoint Revenue", section "crypto").
-Declared purpose: The live revenue layer: real USDC flowing into three.ws's own x402 paid endpoints. A live revenue chart, gross/net/success-rate KPIs, momentum vs the prior window, top-earning endpoints, revenue by network, and a filterable, searchable live feed of every settlement with copy-tx, sound, and CSV export. The mirror of the Money Pulse: what the platform earns, not what agents spend. Every payment is real and explorer-verifiable.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/x402-revenue. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /x402-revenue: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-x402-revenue.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/src/x402-revenue.css b/src/x402-revenue.css
index bb52bf680..d36a5af6e 100644
--- a/src/x402-revenue.css
+++ b/src/x402-revenue.css
@@ -27,8 +27,20 @@
left: max(-20%, calc((100% - 100vw) / 2 + 12px));
right: max(-20%, calc((100% - 100vw) / 2 + 12px));
height: 420px;
- mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
- -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
+ mask-image: linear-gradient(
+ to right,
+ transparent,
+ #000 32px,
+ #000 calc(100% - 32px),
+ transparent
+ );
+ -webkit-mask-image: linear-gradient(
+ to right,
+ transparent,
+ #000 32px,
+ #000 calc(100% - 32px),
+ transparent
+ );
background:
radial-gradient(
60% 80% at 20% 0%,
diff --git a/src/x402-revenue.js b/src/x402-revenue.js
index a59202f07..2b478328a 100644
--- a/src/x402-revenue.js
+++ b/src/x402-revenue.js
@@ -755,9 +755,17 @@ async function loadMore() {
);
} catch {
if (more) more.textContent = 'Load older settlements';
+ toast('Could not load older settlements. Try again.');
return;
}
- const { data } = res.ok ? await res.json() : { data: null };
+ if (!res.ok) {
+ // Keep the cursor: a failed page must stay retryable, not silently retire
+ // the button and strand the rest of the ledger behind it.
+ if (more) more.textContent = 'Load older settlements';
+ toast('Could not load older settlements. Try again.');
+ return;
+ }
+ const { data } = await res.json();
const host = $('xr-feed');
const events = (data?.events || []).filter((e) => !state.seen.has(e.id));
if (host && events.length) {