Skip to content

feat: add credit payment support for STORE messages#130

Merged
odesenfans merged 4 commits intomainfrom
od/store-credits
Mar 26, 2026
Merged

feat: add credit payment support for STORE messages#130
odesenfans merged 4 commits intomainfrom
od/store-credits

Conversation

@odesenfans
Copy link
Copy Markdown
Contributor

Add an optional payment field to StoreContent, matching the Python aleph-message implementation. Only hold and credit payment types are accepted; superfluid is rejected. The CLI defaults to credit payment for file uploads.

Add an optional `payment` field to `StoreContent`, matching the Python
aleph-message implementation. Only `hold` and `credit` payment types are
accepted; `superfluid` is rejected. The CLI defaults to credit payment
for file uploads.
Copy link
Copy Markdown

@foxpatch-aleph foxpatch-aleph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR correctly implements optional payment support for STORE messages, matching the Python aleph-message implementation. The code adds a payment field to StoreContent with proper serialization (skipped when None), validation that rejects superfluid while allowing hold and credit, and comprehensive tests covering all scenarios. The CLI defaults to credit payment for file uploads as intended. The changes are well-structured, backward-compatible, and follow existing code patterns.

crates/aleph-types/src/message/store.rs (line 104): The has_valid_payment() method name is clear and the logic correctly allows None, Credit, and Hold while rejecting Superfluid.

crates/heph/src/handlers/store.rs (line 25): Good placement of the payment validation check early in the handler, before any database operations.

crates/aleph-cli/src/commands/file.rs (line 62): Defaulting to Payment::credits() for CLI file uploads is appropriate and matches the PR description.

crates/aleph-types/src/message/store.rs (line 224): Test coverage is excellent — covers missing payment, credit payment, hold payment, superfluid rejection, round-trip serialization, and skip-when-none behavior.

@odesenfans odesenfans merged commit d70014b into main Mar 26, 2026
9 checks passed
@odesenfans odesenfans deleted the od/store-credits branch March 26, 2026 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.

2 participants