Skip to content

Refactor event emitters to use consistent Symbol topic encoding#115

Open
Ryjen1 wants to merge 1 commit into
JSE-ORG:mainfrom
Ryjen1:feature/79-consistent-event-topics
Open

Refactor event emitters to use consistent Symbol topic encoding#115
Ryjen1 wants to merge 1 commit into
JSE-ORG:mainfrom
Ryjen1:feature/79-consistent-event-topics

Conversation

@Ryjen1
Copy link
Copy Markdown

@Ryjen1 Ryjen1 commented May 27, 2026

Summary

  • Define all 7 event topic names as centralized &str constants in one place
  • Replace inline string literals with Symbol::new(&env, TOPIC_*) at every publish site
  • All topics now encode as ScVal::Symbol (was ScVal::String) for uniform XDR representation

Acceptance Criteria Met

  • All topics follow a uniform naming style — all 7 topics defined as lower_snake_case constants (TOPIC_CREATE_ESCROW, TOPIC_FUND_ESCROW, TOPIC_CONFIRM_DELIVERY, TOPIC_RAISE_DISPUTE, TOPIC_RESOLVE_DISPUTE, TOPIC_CANCEL_ESCROW, TOPIC_AUTO_RELEASE)
  • Event processing systems can parse all logging categories reliably — every event topic encodes as ScVal::Symbol instead of a mix of ScVal::String, enabling consistent parsing

Changes (lib.rs)

  • Added Symbol import and 7 topic name constants at module level
  • Replaced 6 env.events().publish(("literal",), ...) calls with env.events().publish((Symbol::new(&env, TOPIC_*),), ...)

Closes #79

Closes JSE-ORG#79. Standardize event topic definitions and encoding across
all processing paths.

Changes:
- Define all 7 event topic names as centralized &str constants
  (TOPIC_CREATE_ESCROW, TOPIC_FUND_ESCROW, TOPIC_CONFIRM_DELIVERY,
  TOPIC_RAISE_DISPUTE, TOPIC_RESOLVE_DISPUTE, TOPIC_CANCEL_ESCROW,
  TOPIC_AUTO_RELEASE) in one place for DRY consistency
- Replace inline string literals with Symbol::new(&env, TOPIC_*)
  at every publish site, encoding all topics as ScVal::Symbol instead
  of ScVal::String for uniform XDR representation
- All topics follow lower_snake_case naming convention

Event parsers can now reliably match on ScVal::Symbol for every
event category. Topic names are defined once as constants, making
renaming or auditing trivial.

Also fix pre-existing test compilation errors: missing closing brace,
missing fee_bps args, and incorrect setup_env destructuring.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@Ryjen1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Refactor event emitters to use a consistent topic naming convention

1 participant