Skip to content

Developfeat(wallet+mobile): integrate tokens, fees, activity feed, and biometric auth#6

Merged
hooftly merged 17 commits intomainfrom
develop
Sep 9, 2025
Merged

Developfeat(wallet+mobile): integrate tokens, fees, activity feed, and biometric auth#6
hooftly merged 17 commits intomainfrom
develop

Conversation

@hooftly
Copy link
Member

@hooftly hooftly commented Sep 9, 2025

Summary

This PR delivers a major update to the EqualFi wallet and mobile app by
introducing token support, fee handling, biometric authentication, secure
pending UserOp storage, and a real-time activity feed. It also extends RPC
utilities and updates configs to align with the new schema.

Changes

  • Wallet
    • Added secure storage for pending UserOps with resilient retries.
    • Integrated eth_call view helper to fetch wallet state and bind into UserOps.
    • Added EntryPoint fund helpers and balance query.
  • PQC Core
    • Replaced string-based reverts with custom errors for validation and ownership.
    • Clarified nonce semantics and aligned WOTS commitPK with Dart.
  • Aggregator
    • Added optional aggregator support with storage, views, setters, and events.
  • Mobile
    • Updated example config schema and expanded main screen cards.
    • Integrated biometric authentication (Face ID / Touch ID) with configurable settings.
    • Added Base token registry (USDC/WETH), ERC-20 ABI encoders, and send UI flow.
    • Introduced FeeState model, RPC fee utils, EntryPoint hash service, and fee preview UI.
    • Added serializable ActivityItem, ActivityStore, ActivityPoller, and scrollable ActivityFeed.
  • Docs + CI
    • Added NatSpec for PQCWallet state vars and events, regenerated ABI.
    • Added forge snapshot to CI workflow and documented Phase-0 WOTS gas usage.

Motivation

These updates bring the wallet closer to MVP parity by enabling token
transfers, dynamic fee selection, and secure, user-friendly flows with
biometric auth. The ActivityFeed provides real-time visibility of pending
operations, while backend improvements (secure storage, aggregator support,
gas snapshots, and custom errors) strengthen robustness and auditability.

Testing

  • forge build
  • forge test -vv
  • forge snapshot
  • slither .
  • Mobile app runs with updated config schema and displays new UI elements.

Checklist

  • Tests added or updated
  • Docs updated
  • Lint checks pass
  • Ready for review.

- Added stricter rotation in `validateUserOp`, requiring `confirmNextCommit` to
  equal `nextPkCommit` and atomically updating `currentPkCommit` and
  `nextPkCommit` in one step.
- Extended unit tests to assert the new rotation flow, emitting
  `WOTSCommitmentsUpdated` and verifying state transitions.
- Introduced negative test confirming mismatched `confirmNextCommit` causes
  `validateUserOp` to revert.

Testing
✅ forge build
✅ forge test -vv
✅ slither .
- Added dedicated `BadECDSA` error and integrated it into `validateUserOp` to
  guarantee on-chain ECDSA owner checks remain mandatory even with future
  aggregator support.
- Introduced tests asserting invalid ECDSA signatures always revert, whether
  WOTS data is valid (aggregator path) or invalid (fallback path), ensuring
  the owner check is enforced.

Testing
✅ forge build
✅ forge test -vv
✅ forge snapshot
✅ slither .
…etters

- Wired in optional aggregator support by introducing aggregator, verifier,
  and forceOnChainVerify storage fields with corresponding events, while
  keeping on-chain verification enabled by default.
- Added getAggregator view that returns the aggregator address only when
  on-chain verification is disabled.
- Implemented owner-only setters to update aggregator, verifier, and
  force-on-chain settings.
- Updated ABI and tests to cover aggregator defaults and setter behavior,
  ensuring new view/setter functions are exposed in the public interface.

Testing
✅ forge build
✅ forge test -vv
✅ forge snapshot
✅ slither .
- Clarified contract nonce semantics by documenting that nonce() is the
  source of the WOTS signature index, with check + increment occurring
  at the end of validateUserOp.
- Added documentation highlighting the link between nonce() and the WOTS
  index for developers and integrators.
- Extended test coverage to assert nonce increments on successful ops
  and remains unchanged when a mismatched nonce causes a revert.

Testing
✅ forge build
✅ forge test -vv
…on and ownership

- Introduced dedicated custom errors to reduce bytecode size:
  ECDSA_Invalid, PQC_CommitMismatch, NextCommit_ConfirmMismatch,
  Nonce_Invalid, NotOwner, and Sig_Length.
- Updated wallet validation and setter logic to use these custom errors,
  covering signature length checks, commit/nonce mismatches, and owner
  access control.
- Revised tests to expect new error selectors for owner checks, nonce
  and commit validation, ECDSA failures, and signature-length gating.
- Added helper functions for managing EntryPoint funds, including a
  balanceOfEntryPoint getter to query the wallet’s deposit on the
  EntryPoint contract.
- Updated ABI to expose balanceOfEntryPoint alongside depositToEntryPoint.
- Extended DummyEntryPoint and added tests that deposit ETH and verify
  recorded balances through the new helper.
- Updated Solidity WOTS library so commitPK concatenates public key
  elements and applies SHA-256, matching the Dart implementation.
- Added Solidity ↔ Dart parity tests using a fixed public key vector,
  asserting the commitment equals a known SHA-256 value.
- Documented deterministic WOTS commit parity and included example
  output in PQC development notes.
- Added forge snapshot step to CI workflow to capture gas snapshots
  during contract checks.
- Updated gas usage docs with Phase-0 full WOTS on-chain numbers:
  validateUserOp median gas = 2,921,463, plus recorded execute and
  executeBatch values.
- Documented public state variables with NatSpec, clarifying EntryPoint,
  owner, WOTS commitments, and verification settings.
- Added detailed NatSpec for all emitted events, describing triggers and
  parameters.
- Regenerated and exported PQCWallet.json so ABI reflects updated event
  definitions.
- Verified generated docs render event summaries and parameter tables
  from NatSpec comments.
…play

- Updated mobile example configuration to align with new schema, adding
  chain ID, aggregator, prover registry, and verification flags alongside
  existing RPC and bundler URLs.
- Expanded main screen UI to display all new configuration fields—
  chain ID, wallet, entry point, aggregator, prover registry, and
  force-on-chain-verify—within the top cards for clarity.
…serOp

- Added RPC view extension to issue eth_call requests and return
  hex-encoded results from contract functions.
- Updated _sendEth to query nonce, currentPkCommit, and nextPkCommit
  via ABI-encoded calls, parse responses, and log them before building
  the UserOperation.
- UserOperation now uses on-chain nonce, confirms on-chain nextPkCommit,
  and proposes commitment derived from index + 2 for WOTS key rotation.
- Introduced unit test with local JSON-RPC server to verify new
  callViewHex helper.
…etries

- Added secure storage layer to persist pending UserOperation records
  per chain and wallet, enabling retries across app restarts.
- Orchestrated UserOp flow to reuse stored hybrid signatures when hash
  matches, or rebuild new hybrids when calldata changes, updating
  storage accordingly.
- Wired main wallet UI to send operations through new flow, display
  pending records, and support manual/automatic cleanup after confirmation.
…settings

- Added biometric authentication via local_auth and platform permissions,
  enabling Face ID/Touch ID prompts on iOS and Android.
- Created reusable BiometricService and persistent AppSettings to enforce
  biometric checks on mainnet and optionally on testnets, with a UI switch
  controlling testnet requirement.
- Integrated biometric gate into signing workflow and main app so signatures
  are produced only after successful authentication, with toggle exposed
  in settings screen.
…ew UI

- Added RPC utilities to fetch priority fee suggestions and recent fee
  history, enabling dynamic gas pricing.
- Implemented EntryPoint service using canonical getUserOpHash ABI to
  compute hashes via eth_call.
- Introduced FeeState model and fee preview sheet to display network and
  bundler fees with manual gas parameter overrides.
- Updated send flow to gather fee suggestions, allow user adjustments,
  and compute userOpHash with EntryPoint service before signing.
- Added Base token registry with USDC/WETH addresses, feature flags,
  and Permit2 support for Base networks.
- Introduced ChainTokens model to load token data and provide address
  and feature lookups per chain.
- Implemented ERC-20 ABI encoders for transfer, approve, and scaffolded
  permit, enabling batched token transactions.
- Built token send UI with token selection, recipient/amount fields,
  and toggles for EIP-2612 and Permit2, wired into new sendToken flow.
- Extended user operation flow with sendToken path and buildTokenSendBatch
  to assemble executeBatch calldata for transfers.
- Registered new token asset and added unit test verifying registry
  loading in pubspec.yaml.
…tegration

- Introduced serializable ActivityItem model to capture user operation
  details, persisted via new ActivityStore backed by shared_preferences.
- Added ActivityPoller to resolve pending operations through bundler and
  chain RPC, updating feed statuses in near real time.
- Rendered scrollable ActivityFeed and integrated store/poller into main
  send flows for ETH and token transfers, creating feed entries upon
  UserOp submission.
@hooftly hooftly merged commit c0fba0b into main Sep 9, 2025
1 of 2 checks passed
@hooftly hooftly deleted the develop branch September 9, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant