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

[Feature]: Allow setting msg::sender in unit tests #12

Open
alexfertel opened this issue Apr 3, 2024 · 2 comments · May be fixed by #14
Open

[Feature]: Allow setting msg::sender in unit tests #12

alexfertel opened this issue Apr 3, 2024 · 2 comments · May be fixed by #14

Comments

@alexfertel
Copy link

No description provided.

@alexfertel alexfertel self-assigned this Apr 3, 2024
@alexfertel
Copy link
Author

A spike trying to get this to work resulted in these changes. In the end, it is impossible to set msg::sender right now since it is a global CachedOption private to the SDK, so we can't access it.

@0xNeshi
Copy link
Collaborator

0xNeshi commented Sep 17, 2024

Maybe a wrapper around msg::sender similar to Solidity's Context would alleviate the issue?
If there were a pub trait IContext that was implemented for the Context contract (that other contracts inherit), then the trait can be mocked in tests (e.g. using mockall)

@qalisander qalisander changed the title Allow setting msg::sender in unit tests [Feature]: Allow setting msg::sender in motsu unit tests Oct 3, 2024
@qalisander qalisander changed the title [Feature]: Allow setting msg::sender in motsu unit tests [Feature]: Allow setting msg::sender in unit tests Oct 3, 2024
@ggonzalez94 ggonzalez94 transferred this issue from OpenZeppelin/rust-contracts-stylus Dec 17, 2024
@qalisander qalisander linked a pull request Dec 19, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Blocked
Development

Successfully merging a pull request may close this issue.

2 participants