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/rename anyone account #1357 #1718
Fix/rename anyone account #1357 #1718
Conversation
…ckshei/openzeppelin-solidity into fix/rename-anyone-account-#1357
…ckshei/openzeppelin-solidity into fix/rename-anyone-account-#1357 rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @ckshei, thanks a lot!
You mentioned you found an unused instance of other
, where is that? The linter should've caught such a thing, so it's probably a false positive.
@nventuro Thank you so much! I'm trying to get more involved with OS contributions, and this was one of my firsts commits to an OS project. Your responsiveness + direction made it super easy :) The example I saw was in ERC721MintBurn.behavior.js. It's passed in the array. I'm still trying to wrap my head around where these accounts are coming from
|
Huh, it looks like you're right! I wonder why the linter isn't detecting that as an unused variable. Oh well. Mind opening a PR to remove it? :) That helper function is called in
so the array of received accounts are simply the accounts that were not used in the main test (i.e. the ones in |
I saw that in ERC721Mintable.test.js, but I wasn't sure where the Another couple unused variables are
Should I set those as |
Ah, that'd be truffle. It uses mocha under the hood, and passes a set of accounts when you use the
Those look like the result of a nasty copy-paste 😅 Please do!
Since you're already working on the test suite, maybe you could tackle #1687? It's a bit more involved than this one, but it could help you get more familiar with the test suite code base, and with chai (the last piece of the puzzle in the testing setup we use). |
Got it - so mocha passes a set of accounts as an array when you use the contract block, and we're just labeling specific accounts different names? That makes sense. So should I remove the
|
Correct!
No, the reason why we have Does that make sense? We've been wanting to write a testing guide (#1077) for some time explaining these sort of things, but never got to it. |
Yes, I think it makes sense. Basically, Truffle defaults to using the first account in its array for any actions in which you don't specify a sender. If we also happen to set that first account to be the By ensuring the first account has no special privileges, we're adding a bit of redundancy in our tests, so that if an account isn't specified for a test, the test defaults to an account with no special permissions. Is that the gist of it? |
That is absolutely right, yes, and you worded it much better than I did :) |
Fixes #1357 - #1357
Changing all references of an "anyone" account to "other" but keeping descriptions intact.
The "anyone" account is not the best name for a random account with no special permissions. "Other" was decided to be a better descriptor.