Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions landing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ To embed the unlisted demo, create `.env.local` in this directory containing `VI
The interactive scenarios are illustrations of the proposed site-safety workflow; they do not call a wallet or external service.

The extension download is a prototype ZIP at `public/bound-extension.zip`. To refresh it after changing the extension, run `node apps/extension/build.mjs` from the repository root, then `python landing/scripts/package-extension.py`. The packager includes only the extension's build files and excludes browser profiles and local data. Users must extract the ZIP and load it as an unpacked extension in Chromium.

## Testing route

Open `/testing` (for example `http://127.0.0.1:5173/testing`) or use **Testing** in the landing navigation. Vite development and preview servers support direct route loads; a production static host must rewrite `/testing` and `/testing/` to `index.html`.

The five judge cases call the actual decoder, transaction policy engine and frontend comparator with synthetic request/evidence fixtures. They cover a trusted approval (100), no baseline (unknown), unknown spender (35), corroborated hash conflict with a risky approval (15, fallback eligible), and stale evidence (15, fallback suppressed). The route applies the default score gate of `<16` in addition to frontend eligibility. It does not simulate ticket creation, browser document binding or cancellation acknowledgements.

Run each case manually, toggle stale/immature/fewer-reporter/drift inputs, inspect the computed JSON, try Cancel/Continue/typed confirmation and advance the review deadline. **Evaluate all five** produces one result per case and **Export report** downloads those results. **Open Swarm report** is a manual presentation navigation with no extension ticket; **Connect real wallet** separately issues only `eth_requestAccounts` through the installed wallet/BOUND path. No real wallet approvals are requested by the fixtures.

Run `npm test` and `npm run build` in this directory. Source basis: `Docs/BOUND_Final_Architecture.md`, `Docs/BOUND_Technical_Architecture_and_Security_Whitepaper.md`, the decoder/policy implementation and `apps/extension/frontend-redirect.mjs`. The architecture documents contain proposed features; the workbench reports implemented decision logic only.
3 changes: 2 additions & 1 deletion landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite --host 127.0.0.1",
"build": "vite build",
"preview": "vite preview --host 127.0.0.1"
"preview": "vite preview --host 127.0.0.1",
"test": "node --test src/sim/engine.test.mjs src/testing/cases.test.mjs"
},
"dependencies": {
"@gsap/react": "^2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion landing/src/footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Logo } from '../lib/shared.jsx';
import './footer.css';

const links = [['The problem', '#problem'], ['The record', '#record'], ['How it works', '#how'], ['Simulation', '#simulation'], ['Technology', '#stack'], ['Demo', '#demo']];
const links = [['The problem', '#problem'], ['The record', '#record'], ['How it works', '#how'], ['Simulation', '#simulation'], ['Technology', '#stack'], ['Demo', '#demo'], ['Testing', '/testing']];

export default function Footer() {
return <footer className="ft">
Expand Down
1 change: 1 addition & 0 deletions landing/src/hero/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export default function Hero({ Logo, Arrow, menu, setMenu }) {
<a href="#record" onClick={close}>The record</a>
<a href="#how" onClick={close}>How it works</a>
<a href="#simulation" onClick={close}>Simulation</a>
<a href="/testing" onClick={close}>Testing</a>
<a href="#stack" onClick={close}>Technology</a>
<a className="bh-mobile-only" href="#demo" onClick={close}>Watch the demo</a>
<a className="bh-mobile-only" href="/bound-extension.zip" download onClick={close}>Download extension</a>
Expand Down
7 changes: 5 additions & 2 deletions landing/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { Suspense, lazy, useEffect, useState } from 'react';
import { createRoot } from 'react-dom/client';
import Lenis from 'lenis';
import gsap from 'gsap';
Expand All @@ -16,6 +16,8 @@ import Closing from './closing/Closing.jsx';
import Footer from './footer/Footer.jsx';
import './style.css';

const Testing = lazy(() => import('./testing/Testing.jsx'));

function App() {
const [menu, setMenu] = useState(false);
useEffect(() => {
Expand Down Expand Up @@ -52,4 +54,5 @@ function App() {
</>;
}

createRoot(document.getElementById('root')).render(<App />);
const testingRoute = /^\/testing\/?$/.test(window.location.pathname);
createRoot(document.getElementById('root')).render(testingRoute ? <Suspense fallback={<p>Loading testing workbench…</p>}><Testing /></Suspense> : <App />);
68 changes: 68 additions & 0 deletions landing/src/testing/Testing.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, { useEffect, useState } from 'react';
import { CASES, runCase } from './cases.js';
import { decide, lifecycleEvent } from '../sim/engine.js';
import './testing.css';

const SWARM = 'https://bzz.limo/bzz/fa43f135f708b18f7f97008971e977f8ac74385f9f7237fb58bdc20ad2ba14ef/';
export default function Testing() {
useEffect(() => { const previous=document.title; document.title='BOUND · Testing workbench'; return ()=>{document.title=previous;}; }, []);
const [selected, setSelected] = useState(CASES[0].id);
const [overrides, setOverrides] = useState({});
const [result, setResult] = useState(null);
const [runs, setRuns] = useState({});
const [phrase, setPhrase] = useState('');
const [decision, setDecision] = useState('');
const [wallet, setWallet] = useState('');
const [connecting, setConnecting] = useState(false);
const scenario = CASES.find(c => c.id === selected);
function run() {
const output = { ...runCase(selected, overrides), time: new Date().toISOString() };
setResult(output); setRuns(previous => ({...previous, [selected]: output})); setDecision(''); setPhrase('');
}
function select(id) { setSelected(id); setOverrides({}); setResult(null); setDecision(''); setPhrase(''); }
const effective = {...scenario.settings, ...overrides};
function toggle(name) { setOverrides(previous => ({...previous, [name]: !effective[name]})); setResult(null); setDecision(''); }
function act(action) { setDecision(decide({...result, requiresTyped: result.verdict === 'escalated'}, action, phrase === 'I UNDERSTAND' ? phrase : '').text); }
function deadline() { setDecision(lifecycleEvent({requiresTyped: result.verdict === 'escalated'}, 'deadline').text); }
function runAll() {
setRuns(Object.fromEntries(CASES.map(c => [c.id, {...runCase(c.id), time: new Date().toISOString()}])));
}
function download() {
const url = URL.createObjectURL(new Blob([JSON.stringify({source:'BOUND testing route; synthetic inputs, real decoder/policy/frontend functions',runs},null,2)],{type:'application/json'}));
const a = document.createElement('a'); a.href=url; a.download='bound-testing-results.json'; a.click(); setTimeout(()=>URL.revokeObjectURL(url),1000);
}
async function connect() {
setConnecting(true);
try {
const injected=window.ethereum;
const provider=injected?.providers?.find(p=>p.isMetaMask)||injected;
if(!provider?.request) throw Error('No injected wallet found. Open this route in Chrome with your wallet and BOUND enabled.');
const accounts=await provider.request({method:'eth_requestAccounts'});
setWallet(accounts?.[0] ? `Connected: ${accounts[0]}` : 'No account returned.');
} catch(error) {setWallet(error.message || 'Connection did not complete.');}
finally {setConnecting(false);}
}
return <div className="testing-page">
<header className="lab-nav"><a href="/" className="lab-brand">bound<span>.</span></a><span>PRODUCT TESTING / 01—05</span><a href="/">Back to home ↗</a></header>
<main id="main" className="lab-main">
<div className="lab-intro"><div><p className="lab-eyebrow">THE JUDGE’S WORKBENCH</p><h1>Ask the hard<br/>questions.</h1><p className="lab-sub">Five cases. Inspect the inputs, change the evidence, and see what BOUND actually computes.</p></div><div className="lab-scope"><b>Real decision code. Controlled inputs.</b><p>This page calls the repository’s decoder, policy engine and frontend comparator with fictional addresses and records. It does not publish to Arkiv, write ENS, or send transactions.</p><p>Wallet connection below is a separate live action. Browser mediation and gateway availability need their own verification.</p></div></div>
<div className="lab-toolbar"><span>{Object.keys(runs).length} / 5 cases evaluated</span><div><button onClick={runAll}>Evaluate all five</button><button disabled={!Object.keys(runs).length} onClick={download}>Export report ↓</button><button onClick={()=>{setRuns({});select(CASES[0].id);}}>Reset</button></div></div>
<div className="lab-workbench"><nav className="lab-cases" aria-label="Test scenarios">{CASES.map((c,i)=><button key={c.id} aria-pressed={selected===c.id} onClick={()=>select(c.id)}><span className="lab-number">0{i+1}</span><span><strong>{c.title}</strong><small>{runs[c.id] ? `${runs[c.id].score ?? 'Unknown'}${runs[c.id].score===null?'':'/100'} · ${runs[c.id].redirectEligible?'Fallback eligible':'Review on site'}`:'Ready to evaluate'}</small></span><span>↗</span></button>)}</nav>
<section className="lab-panel" aria-label="Selected scenario"><p className="lab-eyebrow">QUESTION TO TEST</p><h2>{scenario.question || scenario.title}</h2><p>{scenario.description}</p>
<fieldset className="lab-switches"><legend>Change the evidence</legend><label><input type="checkbox" checked={!!effective.stale} onChange={()=>toggle('stale')}/> Stale watcher data</label><label><input type="checkbox" checked={!!effective.immature} onChange={()=>toggle('immature')}/> Baseline not mature</label><label><input type="checkbox" checked={!effective.drift} onChange={()=>toggle('drift')}/> No drift corroboration</label><label><input type="checkbox" checked={!!effective.unconfirmed} onChange={()=>toggle('unconfirmed')}/> Fewer than three reporters</label></fieldset>
<button className="lab-run" onClick={run}>Evaluate this case →</button>
<div aria-live="polite">{result ? <div className="lab-result" data-verdict={result.verdict}>
<div className="lab-result-top"><div><span className="lab-eyebrow">CONFIDENCE CHECK SCORE</span><strong className="lab-score">{result.score ?? '—'}{result.score!==null&&<small>/100</small>}</strong></div><span className="lab-verdict">{result.verdict}</span></div>
<p>{result.score===null?'Unknown: no usable baseline. Missing evidence does not establish safety.':'Higher means stronger policy support. This score is not a measured probability of safety.'}</p>
<dl className="lab-evidence"><div><dt>Frontend comparison</dt><dd>{result.comparison}</dd></div><div><dt>Automatic fallback</dt><dd>{result.redirectEligible?'Eligible: low score + fresh, corroborated mismatch':'Not eligible'}</dd></div><div><dt>Evaluated at</dt><dd>{new Date(result.time).toLocaleString()}</dd></div></dl>
<p>{result.explanation}</p><ul>{(result.reasons || []).map((reason,i)=><li key={i}>{reason}</li>)}</ul>
<div className="lab-actions"><h3>Try the review decision</h3>{result.verdict==='escalated'&&<label>Type I UNDERSTAND<input aria-label="Confirmation phrase" value={phrase} onChange={e=>setPhrase(e.target.value)} autoComplete="off"/></label>}<div><button onClick={()=>act('cancel')}>Cancel request</button><button onClick={()=>act('continue')}>Continue to wallet</button><button onClick={deadline}>Advance review to timeout</button></div><p role="status">{decision || 'These controls calculate the review outcome without calling a wallet.'}</p></div>
{result.redirectEligible&&<a className="lab-swarm" href={`${SWARM}#presentation=${encodeURIComponent(JSON.stringify({origin:window.location.origin,score:result.score,time:result.time}))}`} target="_blank" rel="noreferrer">Open Swarm report ↗</a>}
<details><summary>Inspect request and computed evidence</summary><pre>{JSON.stringify(result,null,2)}</pre></details>
</div> : <p className="lab-empty">Choose inputs, then evaluate. Results are computed on demand.</p>}</div>
</section></div>
<section className="lab-live"><div><p className="lab-eyebrow">SEPARATE LIVE CHECK</p><h2>Test the installed extension.</h2><p>Connect your wallet here to exercise BOUND’s real connection interception. The five fixtures above do not change the installed extension’s score for this origin.</p></div><div><button onClick={connect} disabled={connecting}>{connecting?'Waiting for wallet…':'Connect real wallet'}</button><p role="status">{wallet || 'Requires a wallet extension. No signing or transaction requests.'}</p></div></section>
<p className="lab-footnote">Implementation: packages/decoder · packages/policy-core · packages/policy-core/frontend.mjs. Inspired by the final architecture and security whitepaper; proposed features are not presented as implemented.</p>
</main>
</div>;
}
Loading
Loading