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

Update msg_sender() to return sender when input type is Input::Message #5028

Closed
wants to merge 2 commits into from

Conversation

bitzoic
Copy link
Member

@bitzoic bitzoic commented Aug 24, 2023

Description

This change reflects an issue experienced by an internal contributor where msg_sender().unwrap() would revert when sending a message. Currently, the sender is only returned when the input is of type Input::Coin.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@bitzoic bitzoic added bug Something isn't working lib: std Standard library labels Aug 24, 2023
@bitzoic bitzoic self-assigned this Aug 24, 2023
Copy link
Contributor

@Braqzen Braqzen left a comment

Choose a reason for hiding this comment

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

I believe you should use input_message_recipient instead of input_message_sender because they will be the owner upon receiving the resource

@bitzoic
Copy link
Member Author

bitzoic commented Aug 24, 2023

I believe you should use input_message_recipient instead of input_message_sender because they will be the owner upon receiving the resource

Perhaps I'm misunderstanding, but why would we want the recipient when calling msg_sender()?

@Braqzen
Copy link
Contributor

Braqzen commented Aug 24, 2023

I believe you should use input_message_recipient instead of input_message_sender because they will be the owner upon receiving the resource

Perhaps I'm misunderstanding, but why would we want the recipient when calling msg_sender()?

Well, the high level method is called msg_sender() but the method being adjusted regards the owner of the inputs. When sent the owner of the message may be the sender field but the recipient will become the owner.

There was more talk of this, which yet again I forget the details, from @segfault-magnet for when and what the sender / recipient represent depending on when the message is constructed iirc.

@bitzoic
Copy link
Member Author

bitzoic commented Jul 30, 2024

Resolved by #6231

@bitzoic bitzoic closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib: std Standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants