|
1 | 1 | # 🧬 COHR LAB Command Center |
2 | | -<img width="1773" height="886" alt="ChatGPT Image Apr 2, 2026, 05_00_15 AM" src="https://github.com/user-attachments/assets/9cb5100c-b6cf-4cbd-ad03-40f469eba24b" /> |
| 2 | +<img width="1531" height="684" alt="ChatGPT Image Apr 2, 2026, 05_52_12 AM" src="https://github.com/user-attachments/assets/5bd792f2-29e5-46b4-9f4a-7ab3d7702685" /> |
3 | 3 |
|
4 | 4 | >Deterministic on-chain lifecycle engine modeling semiconductor fabrication — executed entirely through direct contract interaction (no backend layer) built on the **XRPL EVM Sidechain Testnet**. |
5 | 5 | > A fully deployed Solidity contract powering a live Web3 state machine — no backend, no server, one frontend execution layer. |
|
84 | 84 |
|
85 | 85 | --- |
86 | 86 |
|
87 | | -### Lifecycle System |
| 87 | +## 🔐 Execution Guarantees |
| 88 | + |
| 89 | +COHR enforces strict invariants at the contract level: |
| 90 | + |
| 91 | +- ✅ A batch can only move forward (no rollback) |
| 92 | +- ✅ Only the owner can mutate state |
| 93 | +- ✅ Each stage is executed exactly once |
| 94 | +- ✅ Terminal states are irreversible |
| 95 | +- ✅ Full lifecycle can be reconstructed from events alone |
| 96 | + |
| 97 | +> This ensures deterministic, audit-safe execution under all conditions |
| 98 | +
|
| 99 | +--- |
| 100 | + |
| 101 | +## ⚠️ Failure Modes & Constraints |
| 102 | + |
| 103 | +- ❌ Incorrect gas overrides will cause transaction failure (XRPL EVM limitation) |
| 104 | +- ❌ Users must manually confirm every transaction (no relayer layer) |
| 105 | +- ❌ No batching — each lifecycle step is a discrete transaction |
| 106 | +- ❌ UI does not cache state — all reads come directly from chain |
| 107 | +- ❌ Network instability directly impacts execution and UX |
| 108 | +- ❌ Frontend dependency — no fallback execution path without UI |
| 109 | + |
| 110 | +### Mitigations |
| 111 | + |
| 112 | +- ✅ Explicit gas configuration enforced in all write calls |
| 113 | +- ✅ Idempotent contract design (no duplicate state transitions) |
| 114 | +- ✅ Event-driven UI reconstruction (stateless frontend) |
| 115 | +- ✅ Clear lifecycle boundaries reduce invalid transitions |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 🔒 Security Considerations |
| 120 | + |
| 121 | +- ✅ No external contract calls → eliminates reentrancy risk |
| 122 | +- ✅ Strict ownership enforcement on all state mutations |
| 123 | +- ✅ Bounded state machine → prevents invalid stage transitions |
| 124 | +- ✅ No dynamic execution paths → predictable behavior |
| 125 | +- ✅ Immutable deployment → no upgrade attack surface |
| 126 | + |
| 127 | +### Known Limitations |
| 128 | + |
| 129 | +- ❌ No pausable mechanism (cannot halt contract) |
| 130 | +- ❌ No emergency admin override |
| 131 | +- ❌ No upgrade proxy (logic cannot be modified post-deploy) |
| 132 | + |
| 133 | +> Designed for deterministic execution over administrative control |
| 134 | +
|
| 135 | +--- |
| 136 | + |
| 137 | +## ⛽ Gas & Performance |
| 138 | + |
| 139 | +### Execution Costs (Approximate) |
| 140 | + |
| 141 | +- ✅ createBatch → ~120k gas |
| 142 | +- ✅ advanceBatch → ~80k gas |
| 143 | +- ✅ setStepNote → ~60k gas |
| 144 | + |
| 145 | +### Optimization Characteristics |
| 146 | + |
| 147 | +- ✅ Fixed-size arrays reduce dynamic storage overhead |
| 148 | +- ✅ uint8 stage encoding minimizes storage footprint |
| 149 | +- ✅ No external calls → consistent gas profile |
| 150 | +- ✅ Linear lifecycle progression → predictable execution cost |
| 151 | +- ✅ No complex loops → bounded computation |
| 152 | + |
| 153 | +> Designed for predictable, stable execution per lifecycle step |
| 154 | +
|
| 155 | +--- |
| 156 | + |
| 157 | +## Lifecycle System |
88 | 158 |
|
89 | 159 | - ✅ Crystal → Wafer → Epitaxy → Lithography → Testing → Pigtail |
90 | 160 | - ✅ Per-stage timestamps stored on-chain |
@@ -178,14 +248,52 @@ cohr-lab/ |
178 | 248 |
|
179 | 249 | --- |
180 | 250 |
|
181 | | -## Running Locally |
| 251 | +## 🧪 Local Execution |
| 252 | + |
| 253 | +COHR LAB is a **stateless frontend** that interacts directly with a deployed smart contract — no backend required. |
182 | 254 |
|
183 | 255 | ```bash |
184 | 256 | git clone https://github.com/zrt219/cohr-lab |
185 | 257 | cd cohr-lab |
186 | | -open index.html |
| 258 | +npx serve . |
| 259 | +``` |
| 260 | + |
| 261 | +Open: http://localhost:3000 |
| 262 | + |
| 263 | +--- |
| 264 | + |
| 265 | +### 🦊 MetaMask (XRPL EVM Testnet) |
| 266 | + |
| 267 | +| Field | Value | |
| 268 | +|------|------| |
| 269 | +| RPC | https://rpc.testnet.xrplevm.org | |
| 270 | +| Chain ID | 1449000 | |
| 271 | +| Symbol | XRP | |
| 272 | + |
| 273 | +--- |
| 274 | + |
| 275 | +### ⚠️ Gas Override (Required) |
| 276 | + |
| 277 | +```js |
| 278 | +const overrides = { |
| 279 | + gasLimit: 300000, |
| 280 | + gasPrice: ethers.utils.parseUnits("100", "gwei"), |
| 281 | + type: 0 |
| 282 | +}; |
187 | 283 | ``` |
188 | 284 |
|
| 285 | +--- |
| 286 | + |
| 287 | +## 🚀 Deploy (Vercel) |
| 288 | + |
| 289 | +- Import repo into Vercel |
| 290 | +- Framework: **Other** |
| 291 | +- Build: **none** |
| 292 | +- Output: `./` |
| 293 | + |
| 294 | +> Static deployment — UI connects directly to XRPL EVM |
| 295 | +
|
| 296 | + |
189 | 297 | --- |
190 | 298 |
|
191 | 299 | ## Connecting MetaMask |
|
0 commit comments