Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix domain/port discernment for transfers routed through epicbox #90

Merged
merged 7 commits into from
Aug 17, 2023

Conversation

who-biz
Copy link
Contributor

@who-biz who-biz commented Aug 15, 2023

This PR includes 3 distinct fixes for epic-wallet usage when routing through epicbox.

1. Silent overwriting of epicbox address domain & port

  • EpicboxAddress::from_str() was being called twice prior to sending. This function validates and parses our user-provided epicbox destination
  • Calling this function a second time on the same data caused a silent overwrite of domain and port in str portion of request (which includes our actual destination, after being parsed by regex)
  • Result of all of this was some transactions being routed to epicbox.epic.tech unintentionally.

2. User-provided port was not being passed through to JSON request

  • This was occurring due to a combination of no.1 above, and Option type not being unwrapped properly prior to sending to epicbox
  • Default port of 443 was always substituted, so never created any noticeable problems

3. EpicboxAddress::stripped() member function was written in such a way that default domain epicbox.epic.tech is removed from address

  • This has been fixed (with no real impact to epicbox), such that full <pubkey>@<domain> is always passed through in-full.

- We are calling regex parsing on same data twice.  Second time it is invalid and the domain is dropped as a result
- Ports were never being marshalled through properly. that's been fixed here
- Added logging to various areas for clearer discernment of data before its sent over wire
- Previously, this was being stripped in cases where address.domain == DEFAULT_EPICBOX_DOMAIN
- This makes logs a bit confusing on epicbox side, so we should always include it
- Rather than explicitly typed 443
- No actual changes, just for readability
close_connection: bool,
) -> Result<(), Error> {
let to = EpicboxAddress::from_str(&to.to_string())?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the important removal, where regex parsing was happening twice.

@who-biz
Copy link
Contributor Author

who-biz commented Aug 17, 2023

FYI, should give this two small changes tomorrow, upon a closer look. Reviews will become stale once I push those, and they'll need re-approved.

- in epicbox adapter, we only handle canonical Epicbox addresses now
- handling the other types here is irrelevant
@who-biz who-biz merged commit d234d18 into EpicCash:master Aug 17, 2023
@who-biz who-biz deleted the epicbox-domain-bugfix branch August 17, 2023 17:30
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.

3 participants