You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(accounting): inline bridge/lock/history modules into Accounting
Sapphire's 64 KiB runtime limit removes the need for the size-driven
delegatecall split, so all bridge, lock, and history logic now lives in a
single resident Accounting contract. Removes the fallback selector dispatcher,
the mirrored storage prefix, module pointers, and cross-contract delegatecall;
BridgeLib remains a separately-deployed linked library.
History append helpers become internal so history cannot be forged by an
external caller. Solidity tests call selectors directly and add
selector-completeness and history-append-absence guards. Off-chain ABI
collapses to Accounting + BridgeLib and drops module resolution and the
bridgeModule startup check. Accounting NatSpec normalized to block style with
full @param/@return coverage.
-**AccountingHistoryModule.sol** — non-upgradeable delegated history module. Accounting owns the history storage; the module supplies history read/write code via `delegatecall`.
9
+
-**Accounting.sol** — Core accounting contract (UUPS upgradeable). Manages balances, deposits, locks, transfers, withdrawals, emergency withdraws, per-user history, and the ROSE bridge.
10
+
-**BridgeLib.sol** — delegatecall-linked library holding the bridge-withdrawal validation and signing helpers used by `Accounting`.
11
11
-**EVMSignerAndVerifier.sol** — Sapphire-confidential EVM keypair management; signs sweep, gas-funding, and withdrawal transactions for source chains using the `EIP155Signer` precompile.
12
12
-**EIP712SignatureVerifier.sol** — Verifies user-authored EIP-712 signatures for transfer / lock / withdrawal operations.
13
13
-**auth/AccountingSiweAuth.sol** — SIWE-based authentication for confidential Sapphire view calls.
@@ -127,8 +127,8 @@ bun run coverage
127
127
128
128
## Deployment
129
129
130
-
The `deploy` task provisions the SIWE auth helper, Accounting proxy/implementation,
131
-
AccountingHistoryModule, and links Accounting to the module in the same deploy task.
130
+
The `deploy` task provisions the SIWE auth helper, the `BridgeLib` library, and the
131
+
Accounting proxy/implementation (with `BridgeLib` linked) in a single deploy task.
@@ -326,15 +314,15 @@ Run `npx hardhat <task> --help` for parameter details.
326
314
| AccountingSiweAuth | TBD |
327
315
| Accounting (Proxy) | TBD |
328
316
| Accounting (Implementation) | TBD |
329
-
|AccountingHistoryModule| TBD |
317
+
|BridgeLib| TBD |
330
318
331
319
## Security Considerations
332
320
333
321
-**Trust anchor for deposits:** ROFL TEE attestation. `creditDeposit` is gated by `roflEnsureAuthorizedOrigin(roflAppID)` — no on-chain transaction proof is verified
334
322
-**Confidential signing:** Sapphire's `EIP155Signer` + `SIGN_DIGEST` precompile keeps the contract-held EVM private key inside the secure environment; signed transactions are returned only to authorized callers
335
323
-**EIP-712:** All user-authored balance operations require typed-data signatures, validated by `EIP712SignatureVerifier`
336
324
-**Signed view-call auth:**`onlyROFLQuery` matches `msg.sender` against the ROFL-published `roflSignerAddress`. `roflEnsureAuthorizedOrigin` is unavailable inside `eth_call`, so signed-query reads use this alternative gate
337
-
-**History module:** Accounting stores history in its own proxy storage and delegates history code to `AccountingHistoryModule`. Only the owner can update the module pointer; deployment tasks validate the module marker before linking.
325
+
-**History:** Accounting stores and reads per-user history in its own storage via resident, internal-only append paths — there is no external history-append selector, so entries cannot be forged.
338
326
-**1-block delays** on `resolveWithdrawal` and `executeEmergencyWithdraw` mitigate same-block read-then-act simulation attacks
339
327
340
328
## Development
@@ -344,7 +332,7 @@ Run `npx hardhat <task> --help` for parameter details.
344
332
```
345
333
contracts/
346
334
├── Accounting.sol # Main accounting contract (UUPS proxy)
347
-
├── AccountingHistoryModule.sol # Delegated history read/write code
0 commit comments