Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
2b1e374
Add UD identity transaction routing to handleIdentityRequest
Oct 4, 2025
31fa794
Add UDIdentityManager for UD domain verification
Oct 4, 2025
5f6297e
Update GCR types and initialization for UD identities
Oct 4, 2025
931b5a3
updated memories
Oct 6, 2025
0cf46be
some linting
Oct 6, 2025
502bf2e
Add Polygon L2 + Ethereum L1 multi-chain support for UD node
Oct 8, 2025
7158ff7
updated demosdk
Oct 8, 2025
34d82b1
Add Base and Sonic network support for Unstoppable Domains
Oct 10, 2025
ae525ad
base and sonic memories
Oct 10, 2025
d2f3752
solana exploration memories
Oct 10, 2025
ce3c32a
feat(ud): add signature type detection utility (Phase 1)
Oct 17, 2025
6b2c943
fixed import
Oct 17, 2025
885a0bb
better eslint rules
Oct 17, 2025
1bb69e9
added support files for UD Solana resolution
Oct 17, 2025
7b9826d
feat(ud): add EVM records fetching to udIdentityManager (Phase 2)
Oct 21, 2025
10460e4
feat(ud): Phase 3 & 4 - Solana integration + multi-signature verifica…
Oct 21, 2025
587585b
updated memories
Oct 21, 2025
eff3af6
feat(ud): Phase 5 - Update IdentityTypes for multi-signature support
Oct 21, 2025
8fb864f
fix(security): comprehensive security and code quality improvements
Oct 21, 2025
c833679
feat(ud): implement UD domain points system with TLD-based rewards
Oct 21, 2025
9b42669
updated memories
Oct 21, 2025
7d6bb56
updated ud tracking memories too
Oct 21, 2025
5cbd622
fix(ud): enforce case-insensitive domain normalization in points system
Oct 21, 2025
f469f89
fix(ud): CRITICAL - enforce case-sensitive Solana address matching
Oct 21, 2025
7012393
fix(ud): add type guard to prevent TypeError in detectSignatureType
Oct 21, 2025
5cd78a5
fix(ud): preserve registryType (UNS vs CNS) in evmToUnified
Oct 21, 2025
a5429f0
fix(ud): make udDomains and telegram optional for backward compatibility
Oct 21, 2025
56fe18e
fix(ud): add comprehensive enum and timestamp validation
Oct 21, 2025
7766b7b
updated memories
Oct 21, 2025
f9e4b94
ignored claudedocs
Oct 21, 2025
2ac51f0
fix(ud): add ownership verification to deductUdDomainPoints and fix i…
Oct 21, 2025
9dd7e3d
fix(gcr): enforce type contracts for UD identity validation
Oct 21, 2025
9bda838
chore: add type-check scripts for bun and tsc
Oct 21, 2025
17569b1
fix(imports): correct Wallet import from @coral-xyz/anchor
Oct 21, 2025
1a93ad0
fix(security): add domain ownership verification to awardUdDomainPoints
Oct 21, 2025
e603386
updated memories
Oct 21, 2025
fbaa2e6
fix(ud): prevent race condition in UD points award
Oct 21, 2025
c949229
fix(ud): normalize domain to lowercase when storing in GCR
Oct 21, 2025
d30030c
fix(ud): add explicit initialization for udDomains breakdown
Oct 21, 2025
69f66d6
perf(ud): remove redundant ownership check on domain unlinking
Oct 21, 2025
22a6da1
Merge branch 'testnet' into ud_identities
tcsenpai Oct 21, 2025
7a4a021
Update src/libs/blockchain/gcr/gcr_routines/udSolanaResolverHelper.ts
tcsenpai Oct 21, 2025
4d6eca8
Update src/libs/blockchain/gcr/gcr_routines/udSolanaResolverHelper.ts
tcsenpai Oct 21, 2025
6f72ba7
fix(types): add missing SavedUdIdentity import to PointSystem
Oct 21, 2025
a3bf5ba
fix(ud): handle 0x prefix in Demos identity regex validation
Oct 21, 2025
a303ef2
fix(validation): improve Uint8Array type guard to exclude arrays
Oct 21, 2025
66298d4
refactor: use UserPoints interface from SDK
Oct 21, 2025
8809fc5
fix(gcr): fix syntax error in isFirstConnection function
claude Nov 5, 2025
d27c949
Merge pull request #494 from kynesyslabs/claude/fix-ud-identities-011…
tcsenpai Nov 5, 2025
94fe042
Merge branch 'testnet' into ud_identities
tcsenpai Nov 5, 2025
c3f0f7a
updated ignore
Nov 6, 2025
e2b2301
fix(security): autofix Express is not emitting security headers
aikido-autofix[bot] Nov 11, 2025
5a53764
installed helmet
Nov 11, 2025
e685a59
Merge pull request #499 from kynesyslabs/fix/aikido-security-sast-100…
tcsenpai Nov 11, 2025
91a7924
fix(security): prevent SQL injection in fedistore.ts
claude Nov 11, 2025
074cc28
Update src/features/activitypub/fedistore.ts
tcsenpai Nov 11, 2025
583bbb8
Merge pull request #500 from kynesyslabs/claude/fix-sql-injection-fed…
tcsenpai Nov 11, 2025
d3ad87f
fix(security): add Helmet middleware to MCP SSE server
claude Nov 11, 2025
27b1190
Merge pull request #502 from kynesyslabs/claude/add-helmet-security-m…
tcsenpai Nov 11, 2025
776b3cc
fix(security): repair SQL injection protection in fedistore.ts
claude Nov 11, 2025
23b7c5b
Merge pull request #503 from kynesyslabs/claude/fix-sql-injection-fed…
tcsenpai Nov 11, 2025
0ad3d54
fix(security): add path traversal protection to file read operations
claude Nov 12, 2025
e3c52ec
Merge pull request #505 from kynesyslabs/claude/fix-file-inclusion-vu…
tcsenpai Nov 12, 2025
971b308
fix: solana rpc issue + comment out some try/catch blocks
cwilvx Nov 17, 2025
23008a9
update applyUdIdentityAdd to parse payload correctly
cwilvx Nov 21, 2025
a9dbc3c
fix: signing ud domain payload with records pubkeys
cwilvx Nov 24, 2025
8398a67
rename resolveUdDomain nodecall
cwilvx Nov 24, 2025
3714bbb
Merge branch 'testnet' into ud_identities
cwilvx Nov 24, 2025
972961a
merge #481 - ud_identities
cwilvx Nov 24, 2025
c96c2ce
fix: sdk relative import
cwilvx Nov 25, 2025
08aa237
feat: Implemented L2 Batch aggregator to submit L2 Txs to Main
Shitikyan Nov 26, 2025
32a0a8c
feat: added nonce in L2
Shitikyan Nov 29, 2025
a1082d1
fix: update import paths for L2PSTransaction and SerializedEncryptedO…
Shitikyan Dec 3, 2025
d1bdc64
feat: Enhance L2PS transaction handling with signature verification a…
Shitikyan Dec 3, 2025
11f2310
Merge branch 'testnet' of https://github.com/Shitikyan/node into l2ps…
Shitikyan Dec 4, 2025
6af2eca
feat: Implement persistent nonce management for L2PS batch transactions
Shitikyan Dec 4, 2025
fbb8534
feat: Implement L2PS Proof Manager and Transaction Executor
Shitikyan Dec 5, 2025
512eabc
fix: Update L2PS transaction handling and mempool status updates for …
Shitikyan Dec 5, 2025
483046a
feat: Enhance L2PS mempool and transaction handling with improved err…
Shitikyan Dec 5, 2025
34e3ab5
refactor: Improve sorting and error handling in L2PS modules; enhance…
Shitikyan Dec 8, 2025
fcd46f6
refactor: Improve sorting of L2PS networks and update TODO comments f…
Shitikyan Dec 8, 2025
3b1e134
refactor: Enhance error handling and validation in L2PS transaction p…
Shitikyan Dec 8, 2025
b1c8267
refactor: Improve error logging in L2PSBatchAggregator and enhance va…
Shitikyan Dec 8, 2025
212aae2
refactor: Simplify statistics initialization in L2PSBatchAggregator a…
Shitikyan Dec 8, 2025
c1ebef8
feat: Implement L2PS Batch Prover for PLONK proofs
Shitikyan Dec 11, 2025
36e2071
refactor: Enhance transaction retrieval and error handling in Chain c…
Shitikyan Dec 12, 2025
7fcc912
refactor: Update ZK proof verification to include transaction count a…
Shitikyan Dec 12, 2025
fbe206a
refactor: Improve error handling and logging in L2PS components; enha…
Shitikyan Jan 5, 2026
624887e
refactor: Enhance error handling and logging across L2PS components f…
Shitikyan Jan 5, 2026
320bb03
refactor: Improve error logging for L2PS components to enhance clarit…
Shitikyan Jan 5, 2026
472d66e
refactor: Enhance error message handling across L2PS components for i…
Shitikyan Jan 5, 2026
5ab0e5d
refactor: Standardize error message handling across L2PS components f…
Shitikyan Jan 5, 2026
8e02698
refactor: Implement centralized error message handling across L2PS co…
Shitikyan Jan 5, 2026
f400033
refactor: Improve argument parsing logic in parseArgs function for be…
Shitikyan Jan 5, 2026
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ docs/src
src/features/bridges/EVMSmartContract/docs
src/features/bridges/LiquidityTank_UserGuide.md
local_tests
docs/storage_features
temp
STORAGE_PROGRAMS_SPEC.md
local_tests/
claudedocs
claudedocs
docs/storage_features
temp
Expand All @@ -196,4 +201,4 @@ REVIEWER_QUESTIONS_ANSWERED.md
PR_REVIEW_RAW.md
PR_REVIEW_FINAL.md
PR_REVIEW_FINAL.md
REVIEWER_QUESTIONS_ANSWERED.md
REVIEWER_QUESTIONS_ANSWERED.md
40 changes: 40 additions & 0 deletions .serena/memories/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Serena Memory Index - Quick Navigation

## UD Integration (Current Work)
- **ud_phases_tracking** - Complete phases 1-6 overview (Phase 5 done, Phase 6 pending)
- **ud_phase5_complete** - Detailed Phase 5 implementation (most comprehensive)
- **ud_integration_complete** - Current status, dependencies, next steps
- **ud_technical_reference** - Networks, contracts, record keys, test data
- **ud_architecture_patterns** - Resolution flow, verification, storage patterns
- **ud_security_patterns** - Ownership verification, security checkpoints, attack prevention
- **session_ud_points_implementation_2025_01_31** - UD points system implementation session
- **session_ud_ownership_verification_2025_10_21** - UD ownership verification security fixes

## Project Core
- **project_purpose** - Demos Network node software overview
- **tech_stack** - Languages, frameworks, tools
- **codebase_structure** - Directory organization
- **code_style_conventions** - Naming, formatting standards
- **development_patterns** - Established code patterns

## Development Workflow
- **suggested_commands** - Common CLI commands
- **task_completion_guidelines** - Workflow patterns

## Memory Organization

Each memory is atomic and self-contained. Reference specific memories based on domain:

**For UD work**:
1. Start with `ud_phases_tracking` for phase overview
2. Check `ud_phase5_complete` for detailed Phase 5 implementation
3. Use `ud_integration_complete` for current status and next steps
4. Reference `ud_technical_reference` for configs/contracts
5. Reference `ud_architecture_patterns` for implementation patterns
6. Reference `ud_security_patterns` for security verification patterns
7. Review recent sessions: `session_ud_ownership_verification_2025_10_21`

**For general development**:
- Project info: `project_purpose`, `tech_stack`, `codebase_structure`
- Development: `development_patterns`, `code_style_conventions`
- Commands: `suggested_commands`, `task_completion_guidelines`
138 changes: 138 additions & 0 deletions .serena/memories/session_ud_ownership_verification_2025_10_21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Session: UD Domain Ownership Verification - October 21, 2025

## Session Overview
**Duration**: ~1 hour
**Branch**: `ud_identities`
**Commit**: `2ac51f02` - fix(ud): add ownership verification to deductUdDomainPoints and fix import path

## Work Completed

### 1. Code Review Analysis
**Reviewer Concerns Analyzed**:
1. UD domain ownership verification missing in `deductUdDomainPoints` (LEGITIMATE)
2. Import path using explicit `node_modules/` path in udIdentityManager.ts (LEGITIMATE)

### 2. Security Implementation
**File**: `src/features/incentive/PointSystem.ts`

**Changes**:
- Added UDIdentityManager import for domain resolution
- Implemented blockchain-verified ownership check in `deductUdDomainPoints()`
- Verification flow:
1. Get user's linked wallets from GCR via `getUserIdentitiesFromGCR()`
2. Resolve domain on-chain via `UDIdentityManager.resolveUDDomain()`
3. Extract wallet addresses from linkedWallets format ("chain:address")
4. Verify at least one user wallet matches domain's authorized addresses
5. Handle case-sensitive comparison for Solana, case-insensitive for EVM
6. Return 400 error if ownership verification fails
7. Only proceed with point deduction if verified

**Security Vulnerability Addressed**:
- **Before**: Users could deduct points for domains they no longer own after transfer
- **After**: Blockchain-verified ownership required before point deduction
- **Impact**: Prevents points inflation from same domain generating multiple points across accounts

### 3. Infrastructure Fix
**File**: `src/libs/blockchain/gcr/gcr_routines/udIdentityManager.ts`

**Changes**:
- Line 3: Fixed import path from `node_modules/@kynesyslabs/demosdk/build/types/abstraction` to `@kynesyslabs/demosdk/build/types/abstraction`
- Line 258: Made `resolveUDDomain()` public (was private) to enable ownership verification from PointSystem

**Rationale**:
- Explicit node_modules paths break module resolution across different environments
- Public visibility required for PointSystem to verify domain ownership on-chain

## Technical Decisions

### Why UD Domains Need Ownership Verification
**Key Insight**: UD domains are NFTs (blockchain assets) that can be transferred/sold

**Vulnerability Scenario**:
1. Alice links `alice.crypto` → earns 3 points ✅
2. Alice transfers domain to Bob on blockchain 🔄
3. Bob links `alice.crypto` → earns 3 points ✅
4. Alice unlinks without ownership check → keeps 3 points ❌
5. **Result**: Same domain generates 6 points (should be max 3)

**Solution**: Match linking security pattern
- Linking: Verifies signature from authorized wallet via `UDIdentityManager.verifyPayload()`
- Unlinking: Now verifies current ownership via `UDIdentityManager.resolveUDDomain()`

### Implementation Pattern
**Ownership Verification Strategy**:
```typescript
// 1. Get user's linked wallets from GCR
const { linkedWallets } = await this.getUserIdentitiesFromGCR(userId)

// 2. Resolve domain to get current on-chain authorized addresses
const domainResolution = await UDIdentityManager.resolveUDDomain(normalizedDomain)

// 3. Extract wallet addresses (format: "chain:address" → "address")
const userWalletAddresses = linkedWallets.map(wallet => wallet.split(':')[1])

// 4. Verify ownership with chain-specific comparison
const isOwner = domainResolution.authorizedAddresses.some(authAddr =>
userWalletAddresses.some(userAddr => {
// Solana: case-sensitive base58
if (authAddr.signatureType === "solana") {
return authAddr.address === userAddr
}
// EVM: case-insensitive hex
return authAddr.address.toLowerCase() === userAddr.toLowerCase()
})
)
```

## Validation Results
- **ESLint**: ✅ No errors in modified files
- **Type Safety**: ✅ All changes type-safe
- **Import Verification**: ✅ UDIdentityAssignPayload confirmed exported from SDK
- **Pattern Consistency**: ✅ Matches linking flow security architecture

## Files Modified
1. `src/features/incentive/PointSystem.ts` (+56 lines)
- Added UDIdentityManager import
- Implemented ownership verification in deductUdDomainPoints()

2. `src/libs/blockchain/gcr/gcr_routines/udIdentityManager.ts` (+2, -2 lines)
- Fixed import path (line 3)
- Made resolveUDDomain() public (line 258)

## Key Learnings

### UD Domain Resolution Flow
**Multi-Chain Priority**:
1. Polygon UNS → Base UNS → Sonic UNS → Ethereum UNS → Ethereum CNS
2. Fallback to Solana for .demos and other Solana domains
3. Returns UnifiedDomainResolution with authorizedAddresses array

### Points System Security Principles
1. **Consistency**: Award and deduct operations must have matching security
2. **Blockchain Truth**: On-chain state is source of truth for ownership
3. **Chain Awareness**: Different signature validation (case-sensitive Solana vs case-insensitive EVM)
4. **Error Clarity**: Return meaningful 400 errors when verification fails

### Import Path Best Practices
- Never use explicit `node_modules/` paths in TypeScript imports
- Use package name directly: `@kynesyslabs/demosdk/build/types/abstraction`
- Ensures module resolution works across all environments (dev, build, production)

## Project Context Updates

### UD Integration Status
- **Phase 5**: Complete (domain linking with multi-chain support)
- **Security Enhancement**: Ownership verification now complete for both award and deduct flows
- **Points Integrity**: Protected against domain transfer abuse

### Related Memories
- `ud_integration_complete`: Base UD domain integration
- `ud_phase5_complete`: Multi-chain UD support completion
- `ud_technical_reference`: UD resolution and verification patterns
- `ud_architecture_patterns`: UD domain system architecture

## Next Potential Work
1. Consider adding similar ownership verification for Web3 wallet deduction
2. Review other identity deduction flows for consistency
3. Add integration tests for UD ownership verification edge cases
4. Document ownership verification requirements in API documentation
103 changes: 103 additions & 0 deletions .serena/memories/session_ud_points_implementation_2025_01_31.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# UD Domain Points Implementation Session

**Date**: 2025-01-31
**Branch**: ud_identities
**Commit**: c833679d

## Task Summary
Implemented missing UD domain points methods in PointSystem to resolve TypeScript errors identified during pre-existing issue analysis.

## Implementation Details

### Point Values Added
- `LINK_UD_DOMAIN_DEMOS: 3` - For .demos TLD domains
- `LINK_UD_DOMAIN: 1` - For other UD domains

### Methods Implemented

#### 1. awardUdDomainPoints(userId, domain, referralCode?)
**Location**: src/features/incentive/PointSystem.ts:866-934
**Functionality**:
- TLD-based point determination (.demos = 3, others = 1)
- Duplicate domain linking detection
- Referral code support
- Integration with GCR via addPointsToGCR()
- Returns RPCResponse with points awarded and total

#### 2. deductUdDomainPoints(userId, domain)
**Location**: src/features/incentive/PointSystem.ts:942-1001
**Functionality**:
- TLD-based point determination
- Domain-specific point tracking verification
- GCR integration for point deduction
- Returns RPCResponse with points deducted and total

### Type System Updates

#### 1. GCR_Main Entity (src/model/entities/GCRv2/GCR_Main.ts)
- Added `udDomains: { [domain: string]: number }` to breakdown (line 36)
- Added `telegram: number` to socialAccounts (line 34)

#### 2. SDK Types (sdks/src/types/abstraction/index.ts)
- Added `udDomains: { [domain: string]: number }` to UserPoints breakdown (line 283)

#### 3. Local UserPoints Interface (PointSystem.ts:12-33)
- Created local interface matching GCR entity structure
- Includes all fields: web3Wallets, socialAccounts (with telegram), udDomains, referrals, demosFollow

### Infrastructure Updates

#### Extended addPointsToGCR()
- Added "udDomains" type support (line 146)
- Implemented udDomains breakdown handling (lines 221-228)

#### Updated getUserPointsInternal()
- Added udDomains initialization in breakdown return (line 130)
- Added telegram to socialAccounts initialization (line 128)

## Integration Points

### IncentiveManager Hooks
The implemented methods are called by existing hooks in IncentiveManager.ts:
- `udDomainLinked()` → calls `awardUdDomainPoints()`
- `udDomainUnlinked()` → calls `deductUdDomainPoints()`

## Testing & Validation
- ✅ TypeScript compilation: All UD-related errors resolved
- ✅ ESLint: All files pass linting
- ✅ Pattern consistency: Follows existing web3Wallets/socialAccounts patterns
- ✅ Type safety: Local UserPoints interface matches GCR entity structure

## Technical Decisions

### Why Local UserPoints Interface?
Created local interface instead of importing from SDK to:
1. Avoid circular dependency issues during development
2. Ensure type consistency with GCR entity structure
3. Enable rapid iteration without SDK rebuilds
4. Maintain flexibility for future type evolution

Note: Added FIXME comment for future SDK import migration

### Domain Identification Logic
Uses `domain.toLowerCase().endsWith(".demos")` for TLD detection:
- Simple and reliable
- Case-insensitive
- Minimal processing overhead

## Files Modified
1. src/features/incentive/PointSystem.ts (+182 lines)
2. src/model/entities/GCRv2/GCR_Main.ts (+2 lines)
3. sdks/src/types/abstraction/index.ts (+1 line)

## Commit Information
```
feat(ud): implement UD domain points system with TLD-based rewards
Commit: c833679d
```

## Session Metadata
- Duration: ~45 minutes
- Complexity: Moderate (extending existing system)
- Dependencies: GCR entity, IncentiveManager, SDK types
- Risk Level: Low (follows established patterns)
Loading