Skip to content

# PR: Audit and Document Off-Chain Data in Soroban Contracts#237

Open
gelluisaac wants to merge 1 commit intoSkillCert:mainfrom
gelluisaac:featured
Open

# PR: Audit and Document Off-Chain Data in Soroban Contracts#237
gelluisaac wants to merge 1 commit intoSkillCert:mainfrom
gelluisaac:featured

Conversation

@gelluisaac
Copy link
Contributor

Summary

This PR adds comprehensive documentation identifying all on-chain data structures and fields in the SkillCert Soroban smart contracts that are candidates for migration to off-chain storage.

Type of Change

  • Documentation
  • Bug fix
  • New feature
  • Breaking change
  • Refactoring

Description

Currently, the Soroban smart contracts store extensive application data (user profiles, course metadata, etc.) directly on-chain, which is not optimal for blockchain technology due to high storage costs and gas inefficiency.

This audit formally documents:

  • All data structures storing non-essential string data
  • A field-by-field analysis with on-chain necessity assessment
  • Complete off-chain database schema mapping
  • Recommended minimal on-chain struct definitions

Changes

  • Added docs/OFF_CHAIN_DATA_AUDIT.md containing the full audit report

Key Findings

Metric Count
Structs with off-chain candidates 16
Total string fields to move off-chain 47
Database tables required 6

Structs Analyzed

Contract Struct Off-Chain Fields
user_profile UserProfile name, email, country, profession, goals
course_access UserProfile name, email, profession, goals, country
user_management UserProfile full_name, contact_email, profession, country, purpose, profile_picture_url
user_management LightProfile full_name, profession, country
course_registry Course title, description, category, language, thumbnail_url, level, duration_hours
course_registry CourseModule title, position
course_registry CourseGoal content
course_registry CourseCategory name, description

Off-Chain Database Tables Proposed

  1. users — User profile information
  2. courses — Course metadata
  3. course_modules — Module titles and positions
  4. course_goals — Goal content
  5. course_categories — Category names and descriptions
  6. contract_metadata — Contract schema export data

Files Analyzed

  • contracts/user_profile/src/schema.rs
  • contracts/course/course_access/src/schema.rs
  • contracts/course/course_registry/src/schema.rs
  • contracts/user_management/src/schema.rs
  • contracts/user_management/src/models/user.rs
  • contracts/schema_export/src/lib.rs

Testing

  • No code changes — documentation only
  • All existing tests pass (no modifications to Rust files)

Checklist

  • Documentation follows project standards
  • All fields documented verbatim (no assumptions about database size)
  • No changes made to Rust source files
  • Mapping document provides clear schema for off-chain database

Related Issues

Closes #235 Audit and Identify Off-Chain Data in Contracts

Next Steps

This audit serves as the foundation for:

  1. Implementing the off-chain database schema
  2. Refactoring on-chain structs to minimal versions
  3. Building synchronization mechanisms between on-chain and off-chain data

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.

Audit and Identify Off-chain Data in Soroban Contracts

1 participant