About
## The problem it solves
## The Problem
Floating off-chain session key signatures often linger in mempools or with relayers even after a smart account owner initiates a standard revocation. This leaves ERC-4337 smart accounts exposed to front-running and paymaster gas-drain attacks from stale, still-valid signatures.
## The Solution — SovereignGuard
SovereignGuard is a zero-trust account abstraction security layer that adds:
- **Instant global epoch revocation** — a single `globalEpoch++` call instantly nullifies every outstanding off-chain session key signature, closing the window attackers rely on.
- **Granular spend caps** — per-transaction and rolling 24-hour daily spend limits, enforced on-chain, to contain the blast radius of a compromised session key.
## Tech Stack
- Solidity 0.8.28
- Foundry test suite (19/19 passing) - Next.js + TypeScript - Tailwind CSS - Glassmorphic dashboard UI
## Key Security Primitives
- Instant global epoch revocation
- Micro-value spend tracking with daily resets - Real-time on-chain execution audit logging
## Challenges we ran into
### 1. Off-Chain Signature Invalidation vs. On-Chain State Sync * **The Challenge:** Standard session key revocation algorithms only flip a boolean flag on-chain. This leaves signed, floating off-chain UserOps lingering in relayers and mempools, exposing the account to front-running exploits before state synchronization completes. * **The Solution:** We architected an atomic `globalEpoch` state variable in `SovereignAccount.sol`. Binding session key validation to the contract's active epoch allows triggering `emergencyRevokeAll()` to increment `globalEpoch++`, immediately invalidating all pending off-chain signed payloads in a single transaction.
### 2. Micro-Value Spend Limit Resets Without Bloated Gas Overhead * **The Challenge:** Tracking 24-hour rolling spending caps (`dailySpendLimit`) usually requires expensive on-chain array iteration or gas-heavy storage updates on every execution. * **The Solution:** Implemented a stateless timestamp window check (`lastResetTimestamp`). If `block.timestamp >= lastResetTimestamp + 1 days`, cumulative spend resets inline inside `executeWithSessionKey()`, keeping gas consumption minimal while guaranteeing strict limit enforcement.
### 3. Real-Time State Synchronization in Frontend * **The Challenge:** Refactoring UI state smoothly to capture epoch increments, active limits, and real-time gas usage across Next.js components without inducing unnecessary re-renders. * **The Solution:** Built a high-performance **Contract Security Audit Log** panel fed directly by structured `SessionKeyExecuted` and `EmergencyRevocationTriggered` event streams.
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.







