Skip to content

feat(contract): standardize event name trimming (#326)#350

Open
Chibey-max wants to merge 1 commit intoAgora-Events:mainfrom
Chibey-max:feat/326-standardize-event-name-trimming
Open

feat(contract): standardize event name trimming (#326)#350
Chibey-max wants to merge 1 commit intoAgora-Events:mainfrom
Chibey-max:feat/326-standardize-event-name-trimming

Conversation

@Chibey-max
Copy link
Copy Markdown

Closes #326

Ensures event names are cleanly stored by trimming leading and trailing whitespace during registration to prevent UI inconsistencies.

Changes

  • Added `name` field to `EventRegistrationArgs` and `EventInfo` structs in `types.rs`
  • Implemented `trim_string` helper in `lib.rs` that strips leading/trailing ASCII whitespace (space, tab, newline, carriage return) from a Soroban `String`
  • Applied trimming to the `name` field in `register_event` before persisting to storage
  • Added `name` field to the local `EventInfo` copy in the `ticket_payment` contract to keep structs in sync
  • Added `test_register_event_name_trimming` test with intentionally messy names (e.g. `" Summer Fest 2025 "`) asserting the stored name is trimmed

Test

```
test test::test_register_event_name_trimming ... ok
test result: ok. 142 passed; 0 failed
```" \

- Add `name` field to `EventRegistrationArgs` and `EventInfo` structs
- Implement `trim_string` helper to strip leading/trailing ASCII whitespace
- Apply trimming to event name in `register_event` before persisting
- Add `name` field to local `EventInfo` copy in ticket_payment contract
- Add `test_register_event_name_trimming` test with intentionally messy names
- Update all existing test fixtures to include the new `name` field
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

@Chibey-max is attempting to deploy a commit to the oseh-svg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@Chibey-max 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

@Yunusabdul38
Copy link
Copy Markdown
Contributor

@Chibey-max fix failling ci check

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.

[Contract] Standardize event name trimming

2 participants