Skip to content

reorganize project code#74

Merged
pk910 merged 2 commits intomasterfrom
pk910/refactor-codebase
Jan 2, 2026
Merged

reorganize project code#74
pk910 merged 2 commits intomasterfrom
pk910/refactor-codebase

Conversation

@pk910
Copy link
Copy Markdown
Owner

@pk910 pk910 commented Jan 2, 2026

Refactor: Reorganize project structure

Summary

This PR reorganizes the project codebase to reduce clutter in the root folder and improve maintainability. The changes introduce two new sub-packages (ssztypes and reflection) that logically group related functionality.

Changes

New Package: ssztypes/

Contains SSZ type system components:

  • typecache.go - Type descriptor caching and resolution
  • ssztags.go - SSZ struct tag parsing (ssz-size, ssz-max, dynssz-*, etc.)
  • compatibility.go - FastSSZ interface compatibility checks (renamed from fastssz.go)
  • descriptor.go - Type descriptor definitions (SszType, TypeDescriptor, FieldDescriptor, etc.)
  • typewrapper.go - TypeWrapper descriptor extraction helpers
  • union.go - CompatibleUnion descriptor extraction helpers

New Package: reflection/

Contains reflection-based SSZ processing:

  • marshal.go - Reflection-based SSZ marshaling
  • unmarshal.go - Reflection-based SSZ unmarshaling
  • treeroot.go - Hash tree root calculation via reflection
  • sszsize.go - Dynamic size calculation
  • common.go - Shared ReflectionCtx for coordinating reflection operations

Root Package Cleanup

  • Consolidated main entry point in dynssz.go
  • Added options.go for DynSsz configuration options
  • Added typewrapper.go with public TypeWrapper[D, T] generic type
  • Simplified union.go with public CompatibleUnion[T] generic type
  • Removed obsolete files: const.go, utils.go, wrapper.go

Updated Dependencies

All internal imports in codegen/, spectests/, and dynssz-gen/ have been updated to use the new package paths.

Benefits

  • Cleaner root directory - Only public API and entry points remain at the root level
  • Better separation of concerns - Type system logic (ssztypes) is isolated from reflection processing (reflection)
  • Improved maintainability - Related files are grouped together logically
  • Clearer architecture - Package structure reflects the library's internal boundaries

Migration

This is an internal refactoring. The public API exposed by the dynssz package remains unchanged. Users importing only github.com/pk910/dynamic-ssz will not need to make any changes.

Users who import internal types directly may need to update imports:

  • Type descriptors and cache: github.com/pk910/dynamic-ssz/ssztypes
  • Reflection utilities: github.com/pk910/dynamic-ssz/reflection

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 91.95678% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.02%. Comparing base (fe277b3) to head (9d0fc80).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
- Coverage   89.53%   89.02%   -0.52%     
==========================================
  Files          42       45       +3     
  Lines        7437     7471      +34     
==========================================
- Hits         6659     6651       -8     
- Misses        462      485      +23     
- Partials      316      335      +19     
Components Coverage Δ
dynssz 85.77% <98.03%> (-8.58%) ⬇️
dynsszgen 86.38% <86.83%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pk910 pk910 force-pushed the pk910/refactor-codebase branch from 472e27b to 9d0fc80 Compare January 2, 2026 04:17
@pk910 pk910 merged commit 1224ce1 into master Jan 2, 2026
17 checks passed
@pk910 pk910 deleted the pk910/refactor-codebase branch January 2, 2026 04:20
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